Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Fix: allow opening PDF with Collabora
Signed-off-by: Raul <[email protected]>
  • Loading branch information
Raudius committed Jul 26, 2022
commit 4c49ca500ca7c64b1dba4147ae6fba5f5fd5cc99
8 changes: 8 additions & 0 deletions css/filetypes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@
.icon-filetype-draw {
background-image: url('../img/x-office-drawing.svg');
}

.icon-richdocuments {
background-image: url(../img/app-dark.svg);
}

body.dark .icon-richdocuments {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's drop it since we have one branch per major Nextcloud version ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! We will add it manually for the backports?

background-image: url(../img/app.svg);
}
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 = OC.getCapabilities().richdocuments.mimetypes.concat(OC.getCapabilities().richdocuments.mimetypesNoDefaultOpen)
const actionName = 'Edit with ' + OC.getCapabilities().richdocuments.productName
const actionDisplayName = t('richdocuments', 'Edit with {productName}', { productName: OC.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)
}
}