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- authored and backportbot[bot] committed Oct 29, 2024
1 parent 531be49 commit c084d9a
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 @@ -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
Expand Down Expand Up @@ -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()
}
Expand Down Expand Up @@ -169,6 +174,7 @@ window.OCA.Text.createEditor = async function({

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

0 comments on commit c084d9a

Please sign in to comment.