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