Skip to content

Commit 7a5e8b6

Browse files
committed
fix(editorApi): fix callbacks on editor events
The new Editor.js wrapper component that got introduced in the indexedb PR broke event propagation from Editor.vue component to editorApi consumers. Fixes loading editor and updating read-only content in Collectives. Signed-off-by: Jonas <jonas@freesources.org>
1 parent a976912 commit 7a5e8b6

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/components/Editor.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export default defineComponent({
2727
focus: () => emit('focus'),
2828
ready: () => emit('ready'),
2929
reload: () => (reloading.value = true),
30+
'create:content': (content) => emit('create:content', content),
31+
'update:content': (content) => emit('update:content', content),
3032
},
3133
scopedSlots: slots,
3234
})

src/components/Editor.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,6 @@ export default defineComponent({
937937
resolved() {
938938
localStorage.removeItem(this.indexedDbConflictKey)
939939
this.indexedDbConflictContent = ''
940-
this.$emit('resolved')
941940
},
942941
},
943942
})

src/editor.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ window.OCA.Text.createEditor = async function ({
325325
active: true,
326326
autofocus,
327327
},
328+
on: {
329+
ready: () => vm.$emit('ready'),
330+
'create:content': (content) => vm.$emit('create:content', content),
331+
'update:content': (content) => vm.$emit('update:content', content),
332+
},
328333
scopedSlots,
329334
})
330335
: h(MarkdownContentEditor, {

0 commit comments

Comments
 (0)