Skip to content

Commit

Permalink
fix(UI): wait until content is loaded before registering at OCA.Viewer
Browse files Browse the repository at this point in the history
avoids conditions where registering is attempted when OCA.Viewer is not
established yet

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
  • Loading branch information
blizzz committed May 14, 2024
1 parent eb14b3a commit cfcc17f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import { getCapabilities } from '@nextcloud/capabilities'

const supportedMimes = getCapabilities().officeonline.mimetypes

if (OCA.Viewer) {
OCA.Viewer.registerHandler({
id: 'officeonline',
group: null,
mimes: supportedMimes,
component: Office,
theme: 'default',
})
}
document.addEventListener('DOMContentLoaded', () => {
if (OCA.Viewer) {
OCA.Viewer.registerHandler({
id: 'officeonline',
group: null,
mimes: supportedMimes,
component: Office,
theme: 'default',
})
}
})

0 comments on commit cfcc17f

Please sign in to comment.