Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.39k stars 316 forks source link

forceSync not working? #197

Closed spencertweedy closed 4 years ago

spencertweedy commented 4 years ago

Describe the bug forceSync doesn't store the EasyMDE editor's value in the original textarea.

To Reproduce See this Glitch.

spencertweedy commented 4 years ago

It appears that forceSync does immediately sync the EasyMDE content into the original textarea, but for some reason it doesn't fire any events on the original textarea.

I have a StimulusJS controller listening to "change" events on the original textarea and the change event isn't firing when EasyMDE syncs its contents into the textarea.

n3storm commented 3 years ago

Why is closed?

hooopo commented 3 years ago

@spencertweedy I had the same problem as you, how did you solve it?

donv commented 2 years ago

A workaround that works for me:

  new EasyMDE({
    element: ...,
    forceSync: true
  }).codemirror.on('change', (e) => {
    $(e.getTextArea()).trigger('change');
  });