michelson / dante2

A complete rewrite of dante editor in draft-js
https://michelson.github.io/dante2/
Other
912 stars 121 forks source link

onChange does not fire for initial content #185

Closed thith closed 5 years ago

thith commented 5 years ago

When the Dante renders, it always fires onChange with content of blank, and does not fire onChange for initial content.

<Dante
    content={some valid initial content}
    onChange={console.log}
/>

onChange fired with content of blank instead of initial content.

michelson commented 5 years ago

Hi @thith , which version are you using ?

thith commented 5 years ago

Hi @thith , which version are you using ?

@michelson I use 0.5.0-rc21. Dante2 raise the first onChange event with argument.save.editorContent of a blank text (it fires when rendering, no manual editing yet). Subsequent onChange events are passed the correct values.

The same happens for the first save_handler event's second argument.

thith commented 5 years ago

It seems editor.emitSerializedOutput() works so I use it instead of save.editorContent.