Merge branch 'MDL-52825_master-fix' of git://github.com/dmonllao/moodle

This commit is contained in:
Andrew Nicols
2016-01-28 12:01:31 +08:00
committed by David Monllao
4 changed files with 65 additions and 26 deletions
@@ -1919,6 +1919,16 @@ EditorSelection.prototype = {
*/
_focusFromClick: false,
/**
* Whether if the last gesturemovestart event target was contained in this editor or not.
*
* @property _gesturestartededitor
* @type Boolean
* @default false
* @private
*/
_gesturestartededitor: false,
/**
* Set up the watchers for selection save and restoration.
*
@@ -1949,18 +1959,21 @@ EditorSelection.prototype = {
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, 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.
this.editor.on('gesturemoveend', function(e) {
Y.one(document.body).on('gesturemovestart', function(e) {
if (this._wrapper.contains(e.target._node)) {
this._gesturestartededitor = true;
} else {
this._gesturestartededitor = false;
}
}, null, this);
// Ignore the event if the target is not part of the current editor.
if (!this._wrapper.contains(e.target._node)) {
Y.one(document.body).on('gesturemoveend', function(e) {
if (!this._gesturestartededitor) {
// Ignore the event if movestart target was not contained in the editor.
return;
}
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, {
standAlone: true
}, this);
}, null, this);
return this;
},
File diff suppressed because one or more lines are too long
@@ -1906,6 +1906,16 @@ EditorSelection.prototype = {
*/
_focusFromClick: false,
/**
* Whether if the last gesturemovestart event target was contained in this editor or not.
*
* @property _gesturestartededitor
* @type Boolean
* @default false
* @private
*/
_gesturestartededitor: false,
/**
* Set up the watchers for selection save and restoration.
*
@@ -1936,18 +1946,21 @@ EditorSelection.prototype = {
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, 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.
this.editor.on('gesturemoveend', function(e) {
Y.one(document.body).on('gesturemovestart', function(e) {
if (this._wrapper.contains(e.target._node)) {
this._gesturestartededitor = true;
} else {
this._gesturestartededitor = false;
}
}, null, this);
// Ignore the event if the target is not part of the current editor.
if (!this._wrapper.contains(e.target._node)) {
Y.one(document.body).on('gesturemoveend', function(e) {
if (!this._gesturestartededitor) {
// Ignore the event if movestart target was not contained in the editor.
return;
}
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, {
standAlone: true
}, this);
}, null, this);
return this;
},
+21 -8
View File
@@ -64,6 +64,16 @@ EditorSelection.prototype = {
*/
_focusFromClick: false,
/**
* Whether if the last gesturemovestart event target was contained in this editor or not.
*
* @property _gesturestartededitor
* @type Boolean
* @default false
* @private
*/
_gesturestartededitor: false,
/**
* Set up the watchers for selection save and restoration.
*
@@ -94,18 +104,21 @@ EditorSelection.prototype = {
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, 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.
this.editor.on('gesturemoveend', function(e) {
Y.one(document.body).on('gesturemovestart', function(e) {
if (this._wrapper.contains(e.target._node)) {
this._gesturestartededitor = true;
} else {
this._gesturestartededitor = false;
}
}, null, this);
// Ignore the event if the target is not part of the current editor.
if (!this._wrapper.contains(e.target._node)) {
Y.one(document.body).on('gesturemoveend', function(e) {
if (!this._gesturestartededitor) {
// Ignore the event if movestart target was not contained in the editor.
return;
}
Y.soon(Y.bind(this._hasSelectionChanged, this, e));
}, {
standAlone: true
}, this);
}, null, this);
return this;
},