Editor content not updating if value changes to empty without editor interaction
jscasca opened this issue · 2 comments
@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.
Originally posted by @EugeneGoroschenyaExt in #5 (comment)
@EugeneGoroschenyaExt moved here for tracking purposes. This should be addressed by #23
Fix was released for v1.0.1