Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/main/component/Editor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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'});
}
Expand Down Expand Up @@ -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'});
}
});
Expand Down Expand Up @@ -144,4 +144,4 @@ onDestroy(() => {
{:else}
<textarea id={id} bind:this={element} style="visibility:hidden"></textarea>
{/if}
</div>
</div>