EpicEditor icon indicating copy to clipboard operation
EpicEditor copied to clipboard

Event when text was edited in Edit-View [emit a "changed" event]

Open mandrasch opened this issue 13 years ago • 3 comments

Hey Folks!

Really nice and beautiful plugin! I wanted to integrate it with AngularJS and bind the markdown text value to a textarea, which is not really a problem.

The problem is that there is no "change"-Event which fires when the raw markdown text changes (e.g. user types something). The "update"-event only fires when there is a save()-Action. But this only works if there is auto-saving. And even then there could be lost content if I hit the save button on a form and auto-save was not triggered. So I had to trigger save() before submitting the form.

An immediate event would be really cool and easier too.

mandrasch avatar Jun 16 '12 13:06 mandrasch

Thanks!

This makes sense I guess for people wanting to make POST ajax calls with no auto save or long auto saving intervals.

The only problem I can think of is actually triggering this reliably. Keypresses are easy, but theres pastes from the file menu and right click menu and importFile() and manually through DOM APIs or the built-in getElement shortcuts. This will probably take some time. I'll for sure put it on the list tho.

In the meantime if you just care about key strokes you could just add an event listener to the editor iframe and emit your own change event to use. That way when we get this in your code should just keep working.

OscarGodson avatar Jun 16 '12 13:06 OscarGodson

Good idea! I now implemented it using the blur event and content comparison. Implementation can be found here: https://github.com/programmieraffe/angular-editors/blob/master/editors/epiceditor/directive.js

I liked your api method for getting the iframe of the editor, very clean!

mandrasch avatar Jun 16 '12 17:06 mandrasch

@programmieraffe I love seeing people's implementation code :) thanks for sharing. This helps a lot in prioritizing tickets when I see what others are doing. Feel free to keep sharing any pain points you may have or bugs.

OscarGodson avatar Jun 16 '12 18:06 OscarGodson