fix: migrate to @nextcloud/viewer 2 and Vue 3 - #6142
juliusknorr wants to merge 11 commits into
Conversation
|
Scared me at first when I saw the line diff. Luckily, most of it is from updating Was going to suggest a more logical separation in terms of migrating to Vue 3 and then doing the migration to |
Register the viewer handler as a custom element and open files through getViewer() instead of the removed OCA.Viewer global. Load the handler on BeforeTemplateRenderedEvent since LoadViewer is gone with the viewer app. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Julius Knorr <jus@bitgrid.net>
…ding on save Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Julius Knorr <jus@bitgrid.net>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Julius Knorr <jus@bitgrid.net>
62a5621 to
470c964
Compare
…ding Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Julius Knorr <jus@bitgrid.net>
Server master dropped the bundled Viewer app, so released richdocuments no longer opens files. Build nextcloud/richdocuments#6142 until it is released. Revert once a release supports @nextcloud/viewer. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Julius Knorr <jus@bitgrid.net>
The problem is that then we would build vue 3 compatible version that we could not test without an older server commit or only against stable33. I feel reasonably comfortable with doing both changes also considering CI is mostly happy (except for the mentioned cases). |
Summary
Port off the removed
OCA.Viewerglobal (nextcloud/server#63954):@nextcloud/vue9,@nextcloud/dialogs7 and@nextcloud/viewer2 (beta)richdocuments-viewercustom element withenabled(nodes)getViewer().open()(file actions, public share, "continue editing online")BeforeTemplateRenderedEventinstead ofLoadViewerKnown limitation: no "Compare to current version" for office files
On server master the versions tab only offers compare for images, see
FilesVersionsSidebarTab.vue#L120-L127, because@nextcloud/viewerhad nocanComparehandler flag. The comparison itself works with this PR (getViewer().compare()shows current and old version side by side).To fix, once nextcloud-libraries/nextcloud-viewer#94 is released (after 2.0.0-beta.14):
canCompare(node)from@nextcloud/viewer@nextcloud/viewerand setcanCompare: trueinregisterHandler()insrc/init-viewer.jsTODO
getViewer().compare()canCompareonce the viewer release is out (see above)The new viewer remounts a handler on every
files:node:updatedfor the file it shows, which reloaded the document on each save. The editor now holds that event back until it closes, so the files list updates its modification time on close. A handler flag in@nextcloud/viewerto opt out of the reload would be the cleaner fix.Expected CI failures from other apps on server master, not this PR:
talk.spec.js: Talk still callsOCA.Viewer.registerHandleropen.spec.js"Open PDF with files PDF viewer":files_pdfviewerregisters no viewer handler on master yetshare-link.jsnow reopens the folder instead of reloading, as server master does not serve the/s/{token}/{fileid}URLs the files app navigates to on public shares.Not changed here:
src/public.jsreads hidden inputs (#mimetype,#hideDownload) that public share pages no longer render, so its PDF special case does nothing on current servers. Documents on shares still open through the Files app.Checklist