mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-45239 editor_atto: The editor cannot be active if it is not the active element
FireFox thinks that you can have an active selection on an element which currently does not have focus. How this can be the case is a mystery. Conflicts: lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
This commit is contained in:
parent
17f253faeb
commit
1ce043614f
@ -1023,6 +1023,11 @@ EditorSelection.prototype = {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We can't be active if the editor doesn't have focus at the moment.
|
||||
if (!document.activeElement || document.activeElement !== this.editor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check whether the range intersects the editor selection.
|
||||
range.selectNode(this.editor.getDOMNode());
|
||||
return range.intersectsRange(selection.getRangeAt(0));
|
||||
@ -1051,9 +1056,7 @@ EditorSelection.prototype = {
|
||||
* @method saveSelection
|
||||
*/
|
||||
saveSelection: function() {
|
||||
if (this.isActive()) {
|
||||
this._selections = this.getSelection();
|
||||
}
|
||||
this._selections = this.getSelection();
|
||||
},
|
||||
|
||||
/**
|
||||
|
File diff suppressed because one or more lines are too long
@ -1018,6 +1018,11 @@ EditorSelection.prototype = {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We can't be active if the editor doesn't have focus at the moment.
|
||||
if (!document.activeElement || document.activeElement !== this.editor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check whether the range intersects the editor selection.
|
||||
range.selectNode(this.editor.getDOMNode());
|
||||
return range.intersectsRange(selection.getRangeAt(0));
|
||||
@ -1046,9 +1051,7 @@ EditorSelection.prototype = {
|
||||
* @method saveSelection
|
||||
*/
|
||||
saveSelection: function() {
|
||||
if (this.isActive()) {
|
||||
this._selections = this.getSelection();
|
||||
}
|
||||
this._selections = this.getSelection();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -120,6 +120,11 @@ EditorSelection.prototype = {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We can't be active if the editor doesn't have focus at the moment.
|
||||
if (!document.activeElement || document.activeElement !== this.editor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check whether the range intersects the editor selection.
|
||||
range.selectNode(this.editor.getDOMNode());
|
||||
return range.intersectsRange(selection.getRangeAt(0));
|
||||
@ -148,9 +153,7 @@ EditorSelection.prototype = {
|
||||
* @method saveSelection
|
||||
*/
|
||||
saveSelection: function() {
|
||||
if (this.isActive()) {
|
||||
this._selections = this.getSelection();
|
||||
}
|
||||
this._selections = this.getSelection();
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user