Skip to content

Commit

Permalink
fix: Implement onLoaded callback
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Jan 30, 2023
1 parent 0ccad06 commit 37900dc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ class TextEditorEmbed {
return this
}

onLoaded(onLoadedCallback = () => {}) {
this.#vm.$on('ready', () => {
onLoadedCallback()
})
return this
}

onUpdate(onUpdateCallback = () => {}) {
this.#vm.$on('update:content', (content) => {
onUpdateCallback(content)
Expand All @@ -57,7 +64,7 @@ class TextEditorEmbed {
el.innerHTML = ''
const element = document.createElement('div')
el.appendChild(element)
this.#vm.$mount(el)
this.#vm.$mount(element)
return this
}

Expand Down

0 comments on commit 37900dc

Please sign in to comment.