jefago / tiny-markdown-editor

TinyMDE: A tiny, dependency-free embeddable HTML/JavaScript Markdown editor.
MIT License
110 stars 15 forks source link

Wrong initialization content if linked textarea's value is empty #56

Closed movsb closed 5 months ago

movsb commented 5 months ago

When link to a textarea which has empty content, the tiny editor will have content:

# Hello TinyMDE!
Edit **here**f

This is somewhat not as expected as you say in readme:

If neither content nor textarea are given, the content of the editor is initialized with a placeholder text (# Hello TinyMDE!\nEdit here). This is probably not what you want, so you probably want to pass at least one of content or textarea.

And the code here: https://github.com/jefago/tiny-markdown-editor/blob/d1558b09b4bce9b20643162513502be3ad77aec5/src/TinyMDE.js#L46-L47

have selected the placeholder value instead of this.textarea.value (which is empty).

I just want the tiny editor to have exact content that textarea has.

Thanks for the tiny and beautiful editor.

jefago commented 5 months ago

Good catch. Will fix.