Skip to content

Commit

Permalink
Merge branch 'pr-8'
Browse files Browse the repository at this point in the history
  • Loading branch information
ipeychev committed Nov 14, 2014
2 parents ae13208 + 321e734 commit 167f921
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/core/debounce.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}, timeout);
};

callFn.cancel = function() {
callFn.detach = function() {
clearTimeout(debounceHandle);
};

Expand Down
24 changes: 18 additions & 6 deletions src/ui/yui/src/adapter/yui.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ YUI.add('alloy-editor', function(Y) {
* @param config {Object} Configuration object literal for the editor.
*/
initializer: function(config) {
var editor,
var documentKeyHandle,
editor,
editorKeyHandle,
eventsDelay,
node;
node,
onDocInteractTask,
onEditorKeyTask;

node = this.get('srcNode');

Expand All @@ -53,11 +57,19 @@ YUI.add('alloy-editor', function(Y) {

eventsDelay = this.get('eventsDelay');

onDocInteractTask = CKEDITOR.tools.debounce(this._onDocInteract, eventsDelay, this);

onEditorKeyTask = CKEDITOR.tools.debounce(this._onEditorKey, eventsDelay, this);

editorKeyHandle = Y.one(Y.config.doc).on(['click', 'keydown'], onDocInteractTask);

documentKeyHandle = node.on('keydown', onEditorKeyTask);

this._eventHandles = [
Y.one(Y.config.doc).on(['click', 'keydown'],
CKEDITOR.tools.debounce(this._onDocInteract, eventsDelay, this)),
node.on('keydown',
CKEDITOR.tools.debounce(this._onEditorKey, eventsDelay, this))
onDocInteractTask,
onEditorKeyTask,
editorKeyHandle,
documentKeyHandle
];

// Custom events will be attached automatically, there is no need to put them in to the list
Expand Down

0 comments on commit 167f921

Please sign in to comment.