Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] feat(editorApi): Add function to allow setting readonly bar props #6571

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading