Skip to content

Commit

Permalink
Merge pull request #6571 from nextcloud/backport/6560/stable29
Browse files Browse the repository at this point in the history
[stable29] feat(editorApi): Add function to allow setting readonly bar props
  • Loading branch information
mejo- authored Oct 29, 2024
2 parents 531be49 + c084d9a commit d57cca0
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 d57cca0

Please sign in to comment.