Skip to content

Commit

Permalink
Merge pull request #3727 from nextcloud/fix/remove-legacy-viewer-code
Browse files Browse the repository at this point in the history
Remove legacy Viewer code
  • Loading branch information
juliushaertl committed Jun 5, 2024
2 parents 8b41a61 + c38b426 commit 9c92498
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,3 @@ if (OCA.Viewer) {
canCompare: true,
})
}

// TODO: Viewer.openWith introduced with https://github.com/nextcloud/viewer/pull/1273
// This check can be replaced with `if(OCA.Viewer)` once NC 24 is EOL.
if (OCA.Viewer.openWith && OCA?.Files?.fileActions) {
const supportedMimes = getCapabilities().richdocuments.mimetypesNoDefaultOpen
const actionName = 'Edit with ' + getCapabilities().richdocuments.productName
const actionDisplayNameEdit = t('richdocuments', 'Edit with {productName}', { productName: getCapabilities().richdocuments.productName }, undefined, { escape: false })
const actionDisplayNameOpen = t('richdocuments', 'Open with {productName}', { productName: getCapabilities().richdocuments.productName }, undefined, { escape: false })

for (const mime of supportedMimes) {
const action = {
name: actionName,
mime,
permissions: OC.PERMISSION_READ,
iconClass: 'icon-richdocuments',
displayName: mime === 'application/pdf' ? actionDisplayNameOpen : actionDisplayNameEdit,
actionHandler: (fileName, context) => {
OCA.Viewer.openWith('richdocuments', {
path: context.fileInfoModel.getFullPath(),
})
},
}

OCA.Files.fileActions.registerAction(action)
}
}

0 comments on commit 9c92498

Please sign in to comment.