fix: fix updating editorProps via setOptions (#1540), fix #1518

This commit is contained in:
Robert van Hoesel
2021-08-09 17:19:50 +02:00
committed by GitHub
parent 916852fdee
commit e6f67caef3
2 changed files with 64 additions and 0 deletions

View File

@@ -133,6 +133,12 @@ export class Editor extends EventEmitter {
*/
public setOptions(options: Partial<EditorOptions> = {}): void {
this.options = { ...this.options, ...options }
// Update editorProps directly on the view and store reference to configured props
if (this.view) {
if (options.editorProps) this.view.setProps(options.editorProps)
this.options.editorProps = this.view.props
}
}
/**
@@ -251,6 +257,9 @@ export class Editor extends EventEmitter {
// So well have access to it for tests.
const dom = this.view.dom as HTMLElement
dom.editor = this
// Reference the resulting view props in our options
this.options.editorProps = this.view.props
}
/**