diff --git a/src/main/component/Editor.svelte b/src/main/component/Editor.svelte index 41ea2c4..c960883 100644 --- a/src/main/component/Editor.svelte +++ b/src/main/component/Editor.svelte @@ -62,13 +62,13 @@ let element: HTMLElement; let editorRef: any; - let lastVal = value; + let lastVal : { [key:string] : string} = {}; let disablindCache = disabled; const dispatch = createEventDispatcher(); $: { - if (editorRef && lastVal !== value) { + if (editorRef && (!lastVal[id] || lastVal[id] !== value)) { editorRef.setContent(value); text = editorRef.getContent({format: 'text'}); } @@ -103,9 +103,9 @@ editor.setContent(value); // bind model events editor.on(modelEvents, () => { - lastVal = editor.getContent(); - if (lastVal !== value) { - value = lastVal; + lastVal[id] = editor.getContent(); + if (lastVal[id] !== value) { + value = lastVal[id]; text = editor.getContent({format: 'text'}); } }); @@ -144,4 +144,4 @@ onDestroy(() => { {:else} {/if} - \ No newline at end of file +