Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] Remove legacy Viewer code #3730

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}
Loading