what i expected is to get current html string by add event listener on “change” event, where “change” event emit is in my custom plugin like code blow:
new Plugin({
key: new PluginKey('justEmitEvent'),
state: {
apply(tr) {
if (tr.docChanged) {
throwEvent(tr, "change");
}
},
},
})
... somewhere else
editorInstance.on('change', (htmlString) => { get htmlString })
on and emit is fired by eventBus library
obviously, it cannot work as expected for the transition has not yet been applied. what i get is a step before what i really tap in the contenteditable box.
any way can achieve that ? only if onChange can get immediately the current htmlString, my editor demo can show content (what user tap in the editorBox next to renderBox) in the renderBox immediately,