MDL-45425 editor_atto: Check for change selections asynchronously

This commit is contained in:
Andrew Nicols 2014-05-06 12:49:47 +08:00
parent 5140fac5da
commit ee37639542
5 changed files with 25 additions and 10 deletions

View File

@ -981,11 +981,15 @@ EditorSelection.prototype = {
this.updateOriginal();
}, this);
Y.delegate(['keyup', 'focus'], this._hasSelectionChanged, document.body, '#' + this.editor.get('id'), this);
Y.delegate(['keyup', 'focus'], function(e) {
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, document.body, '#' + this.editor.get('id'), this);
// To capture both mouseup and touchend events, we need to track the gesturemoveend event in standAlone mode. Without
// standAlone, it will only fire if we listened to a gesturemovestart too.
Y.delegate('gesturemoveend', this._hasSelectionChanged, document.body, '#' + this.editor.get('id'), {
Y.delegate('gesturemoveend', function(e) {
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, document.body, '#' + this.editor.get('id'), {
standAlone: true
}, this);
@ -1591,6 +1595,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorFilepicker]);
"yui-throttle",
"moodle-core-notification-dialogue",
"moodle-editor_atto-rangy",
"handlebars"
"handlebars",
"timers"
]
});

File diff suppressed because one or more lines are too long

View File

@ -976,11 +976,15 @@ EditorSelection.prototype = {
this.updateOriginal();
}, this);
Y.delegate(['keyup', 'focus'], this._hasSelectionChanged, document.body, '#' + this.editor.get('id'), this);
Y.delegate(['keyup', 'focus'], function(e) {
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, document.body, '#' + this.editor.get('id'), this);
// To capture both mouseup and touchend events, we need to track the gesturemoveend event in standAlone mode. Without
// standAlone, it will only fire if we listened to a gesturemovestart too.
Y.delegate('gesturemoveend', this._hasSelectionChanged, document.body, '#' + this.editor.get('id'), {
Y.delegate('gesturemoveend', function(e) {
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, document.body, '#' + this.editor.get('id'), {
standAlone: true
}, this);
@ -1586,6 +1590,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorFilepicker]);
"yui-throttle",
"moodle-core-notification-dialogue",
"moodle-editor_atto-rangy",
"handlebars"
"handlebars",
"timers"
]
});

View File

@ -90,11 +90,15 @@ EditorSelection.prototype = {
this.updateOriginal();
}, this);
Y.delegate(['keyup', 'focus'], this._hasSelectionChanged, document.body, '#' + this.editor.get('id'), this);
Y.delegate(['keyup', 'focus'], function(e) {
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, document.body, '#' + this.editor.get('id'), this);
// To capture both mouseup and touchend events, we need to track the gesturemoveend event in standAlone mode. Without
// standAlone, it will only fire if we listened to a gesturemovestart too.
Y.delegate('gesturemoveend', this._hasSelectionChanged, document.body, '#' + this.editor.get('id'), {
Y.delegate('gesturemoveend', function(e) {
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, document.body, '#' + this.editor.get('id'), {
standAlone: true
}, this);

View File

@ -11,7 +11,8 @@
"yui-throttle",
"moodle-core-notification-dialogue",
"moodle-editor_atto-rangy",
"handlebars"
"handlebars",
"timers"
]
},
"moodle-editor_atto-plugin": {