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

feat(editorApi): Add function to allow setting readonly bar props #6560

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 @@ -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
Loading