Permalink
Browse files

Update dist files

  • Loading branch information...
1 parent fe883c0 commit 5042a63ba55488be88e05de7d8a534136e887df0 @hackerwins hackerwins committed Aug 7, 2016
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -6,7 +6,7 @@
* Copyright 2013-2016 Alan Hong. and other contributors
* summernote may be freely distributed under the MIT license./
*
- * Date: 2016-07-18T18:01Z
+ * Date: 2016-08-07T05:11Z
*/
(function (factory) {
/* global define */
@@ -140,6 +140,35 @@
}).join('');
};
+ /**
+ * Returns a function, that, as long as it continues to be invoked, will not
+ * be triggered. The function will be called after it stops being called for
+ * N milliseconds. If `immediate` is passed, trigger the function on the
+ * leading edge, instead of the trailing.
+ * @param {Function} func
+ * @param {Number} wait
+ * @param {Boolean} immediate
+ * @return {Function}
+ */
+ var debounce = function (func, wait, immediate) {
+ var timeout;
+ return function () {
+ var context = this, args = arguments;
+ var later = function () {
+ timeout = null;
+ if (!immediate) {
+ func.apply(context, args);
+ }
+ };
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) {
+ func.apply(context, args);
+ }
+ };
+ };
+
return {
eq: eq,
eq2: eq2,
@@ -153,7 +182,8 @@
uniqueId: uniqueId,
rect2bnd: rect2bnd,
invertObject: invertObject,
- namespaceToCamel: namespaceToCamel
+ namespaceToCamel: namespaceToCamel,
+ debounce: debounce
};
})();
@@ -3788,9 +3818,9 @@
// [workaround] IE doesn't have input events for contentEditable
// - see: https://goo.gl/4bfIvA
var changeEventName = agent.isMSIE ? 'DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted' : 'input';
- $editable.on(changeEventName, function () {
+ $editable.on(changeEventName, func.debounce(function () {
context.triggerEvent('change', $editable.html());
- });
+ }, 250));
$editor.on('focusin', function (event) {
context.triggerEvent('focusin', event);
Oops, something went wrong.

0 comments on commit 5042a63

Please sign in to comment.