Repository navigation
fix: migrate to @nextcloud/viewer 2 and Vue 3 - #6142
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 |
62a5621 to
470c964
Compare
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). |
Server master dropped the bundled Viewer app, so released richdocuments no longer opens files. Build nextcloud/richdocuments#6142, pinned to a commit, 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>
Server master dropped the bundled Viewer app, so released richdocuments no longer opens files. Build nextcloud/richdocuments#6142, pinned to a commit, 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>
elzody
left a comment
There was a problem hiding this comment.
Looks pretty good after taking a look through things manually. A review with Claude revealed the following that might be interesting to double check.
The viewer keeps richdocument's component hidden until it emits loaded, which is only emitted after Collabora's iframe reports back; so if an error were to occur before that then it's possible the viewer will be stuck loading while the failure is hidden and the viewer keeps spinning. I don't have a good answer for that, but maybe we could do something with the viewer's errored event.
A smaller nitpick would be to guard BeforeTemplateRenderedEvent against loading the viewer on an error page rendering since documents can't be opened there. Other apps do this too:
if ($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_ERROR) {
return;
}|
Thanks, I'll check on those |
77bb9da to
7464a24
Compare
|
@elzody Thanks, both fixed: any loading failure, now including a failed token request, reports the editor as loaded so the viewer shows our error screen instead of spinning ( |
76b0c89 to
ffc1f20
Compare
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>
…ding 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>
Bumps @nextcloud/viewer to 2.0.0-beta.15 for the canCompare handler flag. 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>
38bb958 to
1738455
Compare
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