Skip to content

Commit

Permalink
Merge pull request #3730 from nextcloud/backport/3727/stable29
Browse files Browse the repository at this point in the history
[stable29] Remove legacy Viewer code
  • Loading branch information
elzody authored Jun 5, 2024
2 parents 3bf7487 + 4b4840f commit aeca3cc
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 aeca3cc

Please sign in to comment.