diff --git a/apps/files/src/components/FilesAppBar.vue b/apps/files/src/components/FilesAppBar.vue index ceaf9900260..91087bcdf4e 100644 --- a/apps/files/src/components/FilesAppBar.vue +++ b/apps/files/src/components/FilesAppBar.vue @@ -533,13 +533,16 @@ export default { if (this.publicPage()) { p = this.$client.publicFiles.putFileContents(filePath, null, this.publicLinkPassword, '') } - p.then(() => { + p.then(async () => { + const file = await this.$client.files.fileInfo(filePath, this.davProperties) + const fileId = file.fileInfo['{http://owncloud.org/ns}fileid'] + this.$_ocFilesFolder_getFolder() this.fileFolderCreationLoading = false this.hideModal() if (this.newFileAction) { - this.$_fileActions_openEditor(this.newFileAction, filePath) + this.$_fileActions_openEditor(this.newFileAction, filePath, fileId) } }).catch(error => { this.fileFolderCreationLoading = false diff --git a/apps/files/src/mixins/fileActions.js b/apps/files/src/mixins/fileActions.js index f0250ece108..be36240ca4d 100644 --- a/apps/files/src/mixins/fileActions.js +++ b/apps/files/src/mixins/fileActions.js @@ -28,6 +28,7 @@ export default { computed: { ...mapState(['apps']), ...mapGetters('Files', ['highlightedFile', 'currentFolder']), + ...mapGetters(['configuration']), $_fileActions_systemActions() { const systemActions = [] @@ -46,7 +47,7 @@ export default { return `Open in ${this.apps.meta[editor.app].name}` }, icon: this.apps.meta[editor.app].icon, - handler: item => this.$_fileActions_openEditor(editor, item.path), + handler: item => this.$_fileActions_openEditor(editor, item.path, item.id), isEnabled: ({ resource }) => { if (editor.routes && checkRoute(editor.routes, this.$route.name)) { return false @@ -65,7 +66,11 @@ export default { methods: { ...mapActions(['openFile']), - $_fileActions_openEditor(editor, filePath) { + $_fileActions_openEditor(editor, filePath, fileId) { + if (editor.handler) { + return editor.handler(this.configuration, filePath, fileId) + } + // TODO: Refactor in the store this.openFile({ filePath: filePath diff --git a/changelog/unreleased/editor-handler b/changelog/unreleased/editor-handler new file mode 100644 index 00000000000..9db9f5f0e08 --- /dev/null +++ b/changelog/unreleased/editor-handler @@ -0,0 +1,5 @@ +Enhancement: Use handler of file editors + +In case the extension is a file editor which defines a custom handler, we are triggering that handler instead of trying to open any assigned route. + +https://github.com/owncloud/phoenix/pull/4324 diff --git a/src/store/apps.js b/src/store/apps.js index 4a06179713a..83b9118fde6 100644 --- a/src/store/apps.js +++ b/src/store/apps.js @@ -82,7 +82,8 @@ const mutations = { icon: e.icon, newTab: e.newTab || false, routeName: e.routeName, - extension: e.extension + extension: e.extension, + handler: e.handler } state.fileEditors.push(editor)