@jscasca thank you for pointing it out, I may miss something but I mean the case when `value` as exported property is changed regardless of interraction with editor so the line 106 is not even executed.
The first time Svelet editor compoment instance receives 'some value' as value , it goes to editorRef.setContent(value) and it is displayed on UI becasue lastVal is empty and not equal to 'some value'.
Don't touch editor directly, the lastVal is still '' but assume smth happend and value prop of Svelet editor compoment recived '', the value changed from 'some value' to '' but it is still 'some value' in editor on UI because editorRef.setContent(value) was not execute (lastVal === value === ''), basicaly mismatch between UI and state of Svelte Editor component.
I apologize but don't see this is solved by the line 106 or by other lines, as workaround I align the mismatch by using
let mce;
$: if (mce && value !== mce.getContent()) {
mce.setContent(value);
}
const onInit = e => mce = e.detail.editor;
I hope this workaround works without unexpected side effects.
The first time Svelet editor compoment instance receives
'some value'
asvalue
, it goes toeditorRef.setContent(value)
and it is displayed on UI becasuelastVal
is empty and not equal to'some value'
. Don't touch editor directly, thelastVal
is still''
but assume smth happend andvalue
prop of Svelet editor compoment recived''
, the value changed from'some value'
to''
but it is still'some value'
in editor on UI becauseeditorRef.setContent(value)
was not execute (lastVal === value === ''
), basicaly mismatch between UI and state of Svelte Editor component.I apologize but don't see this is solved by the line 106 or by other lines, as workaround I align the mismatch by using
I hope this workaround works without unexpected side effects.
Originally posted by @EugeneGoroschenyaExt in https://github.com/tinymce/tinymce-svelte/issues/5#issuecomment-1284860642