Skip to content

Commit

Permalink
Merge pull request #166 from carpii/onload_event
Browse files Browse the repository at this point in the history
Onload event

fix #152
fix #78
  • Loading branch information
mervick committed Oct 9, 2017
2 parents dd2a048 + df56877 commit 464c18c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/function/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function($, emojione, blankImg, slice, css_class, emojioneSupportMode, invisible
},
editor = self.editor = div("editor").attr({
contenteditable: (self.standalone) ? false : true,
placeholder: options["placeholder"] || source.data("placeholder") || source.attr("placeholder") || "",
placeholder: options.placeholder || source.data("placeholder") || source.attr("placeholder") || "",
tabindex: 0
}),
button = self.button = div('button',
Expand Down Expand Up @@ -194,7 +194,7 @@ function($, emojione, blankImg, slice, css_class, emojioneSupportMode, invisible
attach(self, [picker, button], {mousedown: "!mousedown"}, editor);
attach(self, button, {click: "button.click"});
attach(self, editor, {paste :"!paste"}, editor);
attach(self, editor, ["focus", "blur"], function() { return self.stayFocused ? false : editor } );
attach(self, editor, ["focus", "blur"], function() { return self.stayFocused ? false : editor; } );
attach(self, picker, {mousedown: "picker.mousedown", mouseup: "picker.mouseup", click: "picker.click",
keyup: "picker.keyup", keydown: "picker.keydown", keypress: "picker.keypress"});
attach(self, editor, ["mousedown", "mouseup", "click", "keyup", "keydown", "keypress"]);
Expand Down Expand Up @@ -295,7 +295,7 @@ function($, emojione, blankImg, slice, css_class, emojioneSupportMode, invisible
self.stayFocused = false;
calcButtonPosition.apply(self);
trigger(self, 'paste', [editor, text, html]);
}
};

if (event.originalEvent.clipboardData) {
var text = event.originalEvent.clipboardData.getData('text/plain');
Expand All @@ -305,7 +305,7 @@ function($, emojione, blankImg, slice, css_class, emojioneSupportMode, invisible
event.preventDefault();
} else {
event.stop();
};
}

event.returnValue = false;
event.stopPropagation();
Expand Down Expand Up @@ -363,7 +363,7 @@ function($, emojione, blankImg, slice, css_class, emojioneSupportMode, invisible
if ($(event.target).hasClass('search')) {
// Allow search clicks
self.stayFocused = true;
if (self.searchSel == null) {
if (self.searchSel === null) {
self.searchSel = saveSelection(editor[0]);
}
} else {
Expand Down Expand Up @@ -425,7 +425,7 @@ function($, emojione, blankImg, slice, css_class, emojioneSupportMode, invisible
$category.hide();
filterBtns.filter('[data-filter="' + $category.attr('name') + '"]').hide();
} else {
var $notMatched = $category.find('.emojibtn:not([data-name*="' + term + '"])')
var $notMatched = $category.find('.emojibtn:not([data-name*="' + term + '"])');
$notMatched.hide();

$matched.show();
Expand Down Expand Up @@ -542,6 +542,7 @@ function($, emojione, blankImg, slice, css_class, emojioneSupportMode, invisible
document.execCommand("enableObjectResizing", false, false);
}

self.trigger("onLoad", editor);
//}, self.id === 1); // calcElapsedTime()
};
});

0 comments on commit 464c18c

Please sign in to comment.