diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-06-21 15:55:21 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-06-21 15:55:21 +0300 |
commit | cfe4ea7d1771aeb453d457c22a2b51e8900a28cd (patch) | |
tree | 32dbb7e380fc8ae5806289eb5d0e7c3321b69b30 | |
parent | d4a82113a05fd2d2ab4f9e2117878b631453d4a0 (diff) |
Fix create file in public list
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r-- | src/components/EditorWrapper.vue | 2 | ||||
-rw-r--r-- | src/components/PublicFilesEditor.vue | 14 | ||||
-rw-r--r-- | src/public.js | 4 | ||||
-rw-r--r-- | src/publicPlugins.js | 7 |
4 files changed, 15 insertions, 12 deletions
diff --git a/src/components/EditorWrapper.vue b/src/components/EditorWrapper.vue index a80ea0a87..5098570d9 100644 --- a/src/components/EditorWrapper.vue +++ b/src/components/EditorWrapper.vue @@ -39,7 +39,7 @@ </div> </menu-bar> <menu-bubble v-if="!readOnly" :editor="tiptap" /> - <editor-content class="editor__content" :editor="tiptap" v-show="initialLoading"/> + <editor-content v-show="initialLoading" class="editor__content" :editor="tiptap" /> </div> <read-only-editor v-if="hasSyncCollission" :content="syncError.data.outsideChange" /> </div> diff --git a/src/components/PublicFilesEditor.vue b/src/components/PublicFilesEditor.vue index e7144a091..4a51f6610 100644 --- a/src/components/PublicFilesEditor.vue +++ b/src/components/PublicFilesEditor.vue @@ -21,9 +21,9 @@ --> <template> - <Modal v-if="active" @close="close" :title="fileName"> + <modal v-if="active" :title="fileName" @close="close"> <editor-wrapper :relative-path="relativePath" :active="active" :share-token="shareToken" /> - </Modal> + </modal> </template> <script> @@ -49,15 +49,15 @@ export default { default: null } }, + computed: { + fileName() { + return this.relativePath.substring(this.relativePath.lastIndexOf('/') + 1) + } + }, methods: { close() { this.active = false } - }, - computed: { - fileName() { - return this.relativePath.substring(this.relativePath.lastIndexOf('/')+1) - } } } </script> diff --git a/src/public.js b/src/public.js index 1d0af71a4..e8323e6d8 100644 --- a/src/public.js +++ b/src/public.js @@ -11,7 +11,6 @@ documentReady(() => { // Load regular viewer integration if (dir !== '') { - const path = window.FileList.getCurrentDirectory() + '/' + filename const ViewerRoot = document.createElement('div') ViewerRoot.id = 'viewerpublic' document.body.appendChild(ViewerRoot) @@ -26,6 +25,7 @@ documentReady(() => { import('vue'), import('./components/PublicFilesEditor') ]).then((imports) => { + const path = window.FileList.getCurrentDirectory() + '/' + filename const Vue = imports[0].default Vue.prototype.t = window.t Vue.prototype.OCA = window.OCA @@ -44,7 +44,7 @@ documentReady(() => { }, t('text', 'Edit') ) - OCA.Files.fileActions.setDefault('text/markdown', 'Edit with text'); + OCA.Files.fileActions.setDefault('text/markdown', 'Edit with text') } else { const container = document.createElement('div') container.id = 'texteditor' diff --git a/src/publicPlugins.js b/src/publicPlugins.js index 77a4133b5..5c8f970c5 100644 --- a/src/publicPlugins.js +++ b/src/publicPlugins.js @@ -20,13 +20,16 @@ * */ +const openFileExtensions = [ + 'md', 'markdown' +] const newFileMenuPlugin = { attach: function(menu) { var fileList = menu.fileList // only attach to main file list, public view is not supported yet - if (fileList.id !== 'files') { + if (fileList.id !== 'files.public') { return } @@ -42,7 +45,7 @@ const newFileMenuPlugin = { const fileExtension = name.split('.').pop() if (openFileExtensions.indexOf(fileExtension) > -1) { let fileInfoModel = new OCA.Files.FileInfoModel(data) - OCA.Files.fileActions.triggerAction('view', fileInfoModel, fileList) + OCA.Files.fileActions.triggerAction('Edit with text', fileInfoModel, fileList) } else if (typeof OCA.Files_Texteditor !== 'undefined') { const dir = fileList.getCurrentDirectory() OCA.Files_Texteditor._onEditorTrigger( |