Skip to content

Commit

Permalink
feat(editorApi): Add function to allow setting readonly bar props
Browse files Browse the repository at this point in the history
Required to tackle nextcloud/collectives#1371

Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- committed Oct 24, 2024
1 parent 03732b7 commit 4924b0e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
Expand Down Expand Up @@ -174,6 +179,7 @@ window.OCA.Text.createEditor = async function({

const data = Vue.observable({
showOutlineOutside: false,
readonlyBarProps: readonlyBar.props,
readOnly,
content,
})
Expand Down Expand Up @@ -205,7 +211,7 @@ window.OCA.Text.createEditor = async function({
? {
readonlyBar: () => {
return h(readonlyBar.component, {
props: readonlyBar.props,
props: data.readonlyBarProps,
})
},
}
Expand Down

0 comments on commit 4924b0e

Please sign in to comment.