diff options
Diffstat (limited to 'src/components/MenuBar.vue')
-rw-r--r-- | src/components/MenuBar.vue | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/components/MenuBar.vue b/src/components/MenuBar.vue index 64637047d..4b0e57fe7 100644 --- a/src/components/MenuBar.vue +++ b/src/components/MenuBar.vue @@ -123,6 +123,8 @@ import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip' import menuBarIcons from './../mixins/menubar' import isMobile from './../mixins/isMobile' +import { useEditorMixin } from './EditorWrapper.provider' + import Actions from '@nextcloud/vue/dist/Components/Actions' import ActionButton from '@nextcloud/vue/dist/Components/ActionButton' import PopoverMenu from '@nextcloud/vue/dist/Components/PopoverMenu' @@ -145,17 +147,9 @@ export default { }, mixins: [ isMobile, + useEditorMixin, ], props: { - editor: { - type: Object, - required: true, - }, - syncService: { - type: Object, - required: false, - default: null, - }, isRichEditor: { type: Boolean, default: true, @@ -211,16 +205,16 @@ export default { return false } const args = Array.isArray(isActive) ? isActive : [isActive] - return this.editor.isActive(...args) + return this.$editor.isActive(...args) } }, isVisible() { - return this.editor.isFocused + return this.$editor.isFocused || Object.values(this.submenuVisibility).find((v) => v) }, disabled() { return (menuItem) => { - return menuItem.action && !menuItem.action(this.editor.can()) + return menuItem.action && !menuItem.action(this.$editor.can()) } }, isChildMenuVisible() { @@ -302,7 +296,7 @@ export default { }) }, refocus() { - this.editor.chain().focus().run() + this.$editor.chain().focus().run() }, clickIcon(icon) { if (icon.click) { @@ -310,7 +304,7 @@ export default { } // Some actions run themselves. // others still need to have .run() called upon them. - const action = icon.action(this.editor.chain().focus()) + const action = icon.action(this.$editor.chain().focus()) action && action.run() }, getWindowWidth(event) { @@ -369,7 +363,7 @@ export default { return current.fill('..').concat(target).join('/') }, addEmoji(icon, emojiObject) { - return icon.action(this.editor.chain(), { id: emojiObject.id, native: emojiObject.native }) + return icon.action(this.$editor.chain(), { id: emojiObject.id, native: emojiObject.native }) .focus() .run() }, |