Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/etch.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
// you use to initialize editing
editableInit: function(e) {
e.stopPropagation();
var self = this;
var target = e.target || e.srcElement;
var $editable = $(target).etchFindEditable();
$editable.attr('contenteditable', true);
Expand Down Expand Up @@ -298,16 +299,18 @@
}
}

self.model && self.model.trigger('etch:init');

// listen for mousedowns that are not coming from the editor
// and close the editor
$('body').bind('mousedown.editor', function(e) {
// check to see if the click was in an etch tool
var target = e.target || e.srcElement;
if ($(target).not('.etch-editor-panel, .etch-editor-panel *, .etch-image-tools, .etch-image-tools *').size()) {
// remove editor
self.model && self.model.trigger('etch:remove');
$editor.remove();


if (models.EditableImage) {
// unblind the image-tools if the editor isn't active
$editable.find('img').unbind('mouseenter');
Expand Down