From 4924b0e224b164c66c55a28e412df615ce79a214 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 bf699d2702f..f60479277e4 100644 --- a/src/editor.js +++ b/src/editor.js @@ -11,7 +11,7 @@ import { ACTION_ATTACHMENT_PROMPT } from './components/Editor/MediaHandler.provi // eslint-disable-next-line import/no-unresolved, n/no-missing-import import 'vite/modulepreload-polyfill' -const apiVersion = '1.1' +const apiVersion = '1.2' Vue.prototype.t = window.t Vue.prototype.n = window.n @@ -119,6 +119,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() } @@ -174,6 +179,7 @@ window.OCA.Text.createEditor = async function({ const data = Vue.observable({ showOutlineOutside: false, + readonlyBarProps: readonlyBar.props, readOnly, content, }) @@ -205,7 +211,7 @@ window.OCA.Text.createEditor = async function({ ? { readonlyBar: () => { return h(readonlyBar.component, { - props: readonlyBar.props, + props: data.readonlyBarProps, }) }, }