From 1a1e3047b1a9f28a220cb9612f3c0387f627e72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sat, 28 Jan 2023 14:30:01 +0100 Subject: [PATCH] fix: Implement onLoaded callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/editor.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/editor.js b/src/editor.js index 9419798f08c..f8db2a5f223 100644 --- a/src/editor.js +++ b/src/editor.js @@ -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) @@ -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 }