Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Migrate off the OCA.Viewer global before Nextcloud 36

Aperta
#8,358 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
74/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
frontend

Direzione di ricerca

Inizia in src/components/card/AttachmentList.vue alle righe 251 e 262, quindi segui come vengono rappresentati i dati dell’allegato prima dell’apertura del viewer. Usa la guida alla migrazione di @nextcloud/viewer per portare i controlli di visualizzabilità e l’apertura, preservando onClose; il lavoro è completato quando gli allegati delle card si aprono e i tipi MIME non supportati rimangono non disponibili con Viewer 7 e Nextcloud 36.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Deck opens card attachments in the viewer:

  • src/components/card/AttachmentList.vue:251: window.OCA.Viewer.availableHandlers.map(h => h.mimes).flat().includes(mimetype)
  • src/components/card/AttachmentList.vue:262: window.OCA.Viewer.open({ path, onClose })

Flattening availableHandlers[].mimes becomes canView(node). onClose is still there, as
part of the options object: getViewer().open(nodes, file, { onClose }).


OCA.Viewer is gone in Viewer 7.0.0. The viewer ships as the
@nextcloud/viewer library rather than a
bundled app, and nextcloud/server#63954 removes the viewer app from Nextcloud 36 altogether.

Roughly what it looks like:

import { canView, getViewer } from '@nextcloud/viewer'

// OCA.Viewer.open({ path }) / ({ fileInfo, list })
getViewer().open(nodes, file)          // @nextcloud/files nodes
getViewer().openFolder(folder, file)   // when a path is all you have, let it fetch

// OCA.Viewer.mimetypes.includes(mime) / availableHandlers
canView(node)

The part that is not a rename is that the viewer takes @nextcloud/files nodes now, not
fileinfo objects or path strings. Importing the package is also all it takes to get the viewer
onto the page: no LoadViewer event to dispatch, and nothing to check about whether the app is
enabled.

[!IMPORTANT]
There is no compatibility shim, which was a deliberate call, so this is a real port rather
than a rename. Nothing breaks until the server PR lands; after that these calls throw on
Nextcloud 36.

[!TIP]
The developer manual covers the migration under
Critical changes
(being added in nextcloud/documentation#15597), and the
README
has the full before/after table. Happy to help with the port, just ping me.

👾 This issue was written with the help of Claude Code.

Lingua principale
JavaScript
Stelle
1.4k
Fork
358
Merge medio
1g 22h
PR unite (30g)
101

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nextcloud/deck

Tutte le issue di nextcloud/deck

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.