Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions css/filetypes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
.icon-filetype-draw {
background-image: url('../img/x-office-drawing.svg');
}

.icon-richdocuments {
background-image: url(../img/app-dark.svg);
filter: var(--background-invert-if-dark);
}
25 changes: 25 additions & 0 deletions src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,28 @@ if (OCA.Viewer) {
theme: 'light',
})
}

// 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) {
const supportedMimes = getCapabilities().richdocuments.mimetypesNoDefaultOpen
const actionName = 'Edit with ' + getCapabilities().richdocuments.productName
const actionDisplayName = t('richdocuments', 'Edit 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: actionDisplayName,
actionHandler: (fileName, context) => {
OCA.Viewer.openWith('richdocuments', {
path: context.fileInfoModel.getFullPath()
})
}
}

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