docs: force Alpine to rerender when the selection updates

This commit is contained in:
Hans Pagel
2021-05-11 19:23:36 +02:00
parent b69cf4106e
commit 8d5e6deab4

View File

@@ -53,6 +53,7 @@ window.setupEditor = function(content) {
return { return {
editor: null, editor: null,
content: content, content: content,
updatedAt: Date.now(), // force Alpine to rerender on selection change
init(element) { init(element) {
this.editor = new Editor({ this.editor = new Editor({
element: element, element: element,
@@ -61,6 +62,9 @@ window.setupEditor = function(content) {
onUpdate: ({ editor }) => { onUpdate: ({ editor }) => {
this.content = editor.getHTML() this.content = editor.getHTML()
}, },
onSelectionUpdate: () => {
this.updatedAt = Date.now()
},
}) })
}, },
} }