Skip to content
This repository was archived by the owner on Jul 24, 2019. It is now read-only.

Added an image-inserted event to the editor#47

Open
jordandh wants to merge 1 commit into
mindmup:masterfrom
jordandh:image-event
Open

Added an image-inserted event to the editor#47
jordandh wants to merge 1 commit into
mindmup:masterfrom
jordandh:image-event

Conversation

@jordandh

Copy link
Copy Markdown
Contributor

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.

@gojko

gojko commented Apr 17, 2013

Copy link
Copy Markdown

ok, but this is not triggered on error, but on success. what's your use case for this?

@jordandh

Copy link
Copy Markdown
Contributor Author

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.

@gojko

gojko commented Apr 17, 2013

Copy link
Copy Markdown

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)

@jordandh

Copy link
Copy Markdown
Contributor Author

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.

@gojko

gojko commented Apr 17, 2013

Copy link
Copy Markdown

I think "paste keyup" are good events to listen to as well.

@jordandh

Copy link
Copy Markdown
Contributor Author

input should include both paste and keyup actions.

@jordandh

Copy link
Copy Markdown
Contributor Author

I just tested those 4 events and they cover paste and keyup.

@liuguichuan666

Copy link
Copy Markdown

is this based on bootstrap 2.3 ? how can i use this with bootstrp 3.1 ,

@jordandh

Copy link
Copy Markdown
Contributor Author

This change will work for bootstrap 2.3 and bootstrap 3.1. It's just one line that fires a dom event.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants