Inscryb / inscryb-markdown-editor

A simple, beautiful, and embeddable JavaScript Markdown editor. Based off SimpleMDE by Sparksuite.
MIT License
90 stars 16 forks source link

Editors fail to load text if hidden on pageload #2

Closed Nattle closed 6 years ago

Nattle commented 6 years ago

If the textarea/editor is inside a tag which is not open, the contents of the edit area will be blank. Clicking inside the edit area will force an update and render the initialValue properly. If the edit box is in a tag which is open is behaves properly. This is true if you set either the text inside the textarea, the initialValue, or both. Setting the initialValue and a placeholder still shows a blank box.

If there is no content then the placeholder text will display properly in all cases.

detail_closed_bug.html.txt

CWharton commented 6 years ago

I have had some rendering issues as well when the page needs to scroll. I have not had time to research it yet. I am more then willing to take a PR if you want to look into it.

Nattle commented 6 years ago

My knowledge of Javascript is pretty shaky, though I'm picking up basic react at the moment. I'd wager it'll be a little while before I understand the lifecycle of DOM elements / this library enough to contribute though.

I'm looking to put up a PR soon though, since it would be handy if the autosave code emitted an "autosave" signal(), so that I could also have that write to my datastore.

zipprich commented 6 years ago

Have a look at https://github.com/codemirror/CodeMirror/issues/2469. It seems like this is the expected codemirror behaviour.

kumy commented 5 years ago

I came across this behavior too.

Just call refresh, after the editor becomes visible: inscrybmde.codemirror.refresh();