From c084d9a0e01f615cc34bc1bfa9c75727a542b3d9 Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 23 Oct 2024 18:23:05 +0200 Subject: [PATCH] feat(editorApi): Add function to allow setting readonly bar props Required to tackle https://github.com/nextcloud/collectives/issues/1371 Signed-off-by: Jonas --- src/editor.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/editor.js b/src/editor.js index 523ed0eb412..885455a2a3c 100644 --- a/src/editor.js +++ b/src/editor.js @@ -27,7 +27,7 @@ import { ACTION_ATTACHMENT_PROMPT } from './components/Editor/MediaHandler.provi __webpack_nonce__ = btoa(OC.requestToken) // eslint-disable-line __webpack_public_path__ = OC.linkTo('text', 'js/') // eslint-disable-line -const apiVersion = '1.1' +const apiVersion = '1.2' Vue.prototype.t = window.t Vue.prototype.n = window.n @@ -115,6 +115,11 @@ class TextEditorEmbed { return this } + updateReadonlyBarProps(value) { + this.#vm.$set(this.#data, 'readonlyBarProps', value) + return this + } + insertAtCursor(content) { this.#getEditorComponent().$editor.chain().insertContent(content).focus().run() } @@ -169,6 +174,7 @@ window.OCA.Text.createEditor = async function({ const data = Vue.observable({ showOutlineOutside: false, + readonlyBarProps: readonlyBar.props, readOnly, content, }) @@ -200,7 +206,7 @@ window.OCA.Text.createEditor = async function({ ? { readonlyBar: () => { return h(readonlyBar.component, { - props: readonlyBar.props, + props: data.readonlyBarProps, }) }, }