js: reference state via the view in Godo (#85508)
gitea/godo.js/pipeline/head This commit looks good Details

This commit is contained in:
Corentin Sechet 2024-01-10 12:22:08 +01:00
parent 7521de0c45
commit ffcdca5adf
1 changed files with 2 additions and 5 deletions

View File

@ -51,8 +51,7 @@ export default class Godo extends window.HTMLElement {
// must keep a reference on those handlers to be able to remove them
this.onUpdateEvent = () => {
this.state = this._createState(this.linkedInput.value)
this.view.updateState(this.state)
this.view.updateState(this._createState(this.linkedInput.value))
}
this.onLinkedInputFormSubmit = () => {
@ -148,11 +147,9 @@ export default class Godo extends window.HTMLElement {
if (options.schema !== 'basic' && !this.readOnly) this.pluginsList.push(this.blocksMenu)
if (options.instantUpdate) this.pluginsList.push(changeEventPlugin(this))
this.state = this._createState(initialContent)
const label = this.id ? document.querySelector(`label[for=${this.id}]`) : undefined
this.view = new EditorView(this.editorWrapper, {
state: this.state,
state: this._createState(initialContent),
editable: () => !this.readOnly,
attributes: {
class: 'godo--editor',