fix: ensure pageStore.content is populated on editor create and collab sync

pull/7973/head
Gabriel Mowses (Mouse) 3 months ago
parent d49893b714
commit 90f40276a0

@ -702,6 +702,11 @@ function init () {
if (html) {
console.info('[Collab] Y.Doc empty, inserting page content:', html.length, 'chars')
editor.value.commands.setContent(html)
// Update page store so save works
pageStore.$patch({
content: JSON.stringify(editor.value.getJSON()),
render: editor.value.getHTML()
})
}
}
},
@ -766,6 +771,15 @@ function init () {
TextStyle,
Typography
],
onCreate: ({ editor }) => {
// Ensure content is populated on editor creation
if (editor && !editor.isEmpty) {
pageStore.$patch({
content: JSON.stringify(editor.getJSON()),
render: editor.getHTML()
})
}
},
onUpdate: ({ editor }) => {
editorStore.$patch({
lastChangeTimestamp: DateTime.utc()

Loading…
Cancel
Save