Added an image-inserted event to the editor#47
Conversation
|
ok, but this is not triggered on error, but on success. what's your use case for this? |
|
I auto grow the editor as the user types. I need to auto grow when an image is inserted as well. To do that I need to know when an image is inserted. I can make another pull request that replaces the fileUploadError callback with trigger calls. |
|
should we make a proper onchange event that gets triggered? then you can grow it on any change, not just on typing/images (pasting, for example, doesn't trigger change) |
|
Yah a generic change event would work well. I am currently listening to these events: this.$editor.on('input DOMNodeInserted DOMNodeRemoved DOMCharacterDataModified', grow);Chrome, FF, and Safari all use the newer input event that contentEditable elements can fire. The 3 dom mutation events are for IE support. If we add this to the editor then it would essentially be listening for those events and image insertion. |
|
I think "paste keyup" are good events to listen to as well. |
|
input should include both paste and keyup actions. |
|
I just tested those 4 events and they cover paste and keyup. |
|
is this based on bootstrap 2.3 ? how can i use this with bootstrp 3.1 , |
|
This change will work for bootstrap 2.3 and bootstrap 3.1. It's just one line that fires a dom event. |
Added an image-inserted event to the editor. It uses jQuery's trigger on the dom element. I think this would be a better way to do the file upload error callbacks. If they are events then multiple event handlers can be attached at any time instead of once during initialization.