Skip to content

Commit

Permalink
fix: remove legacy viewer code
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <[email protected]>
  • Loading branch information
elzody authored and backportbot[bot] committed Jun 5, 2024
1 parent 3bf7487 commit 4b4840f
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 @@ -39,29 +39,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 4b4840f

Please sign in to comment.