mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +02:00
MDL-44810 editor_atto: restore selection after button press
Fixed issue where clicking on buttons erroneously lost viewport focus and selection.
This commit is contained in:
parent
1a727e121e
commit
0a1456dfa8
5 changed files with 26 additions and 2 deletions
|
@ -95,6 +95,11 @@ Y.extend(EditorPlugin, Y.Base, {
|
||||||
* @method markUpdated
|
* @method markUpdated
|
||||||
*/
|
*/
|
||||||
markUpdated: function() {
|
markUpdated: function() {
|
||||||
|
// Save selection after changes to the DOM. If you don't do this here,
|
||||||
|
// subsequent calls to restoreSelection() will fail expecting the
|
||||||
|
// previous DOM state.
|
||||||
|
this.get('host').saveSelection();
|
||||||
|
|
||||||
return this.get('host').updateOriginal();
|
return this.get('host').updateOriginal();
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
@ -760,6 +765,9 @@ EditorPluginButtons.prototype = {
|
||||||
// Build the arguments list, but remove the callback we're calling.
|
// Build the arguments list, but remove the callback we're calling.
|
||||||
var args = [e, callbackArgs];
|
var args = [e, callbackArgs];
|
||||||
|
|
||||||
|
// Restore selection before making changes.
|
||||||
|
this.get('host').restoreSelection();
|
||||||
|
|
||||||
// Actually call the callback now.
|
// Actually call the callback now.
|
||||||
return callback.apply(this, args);
|
return callback.apply(this, args);
|
||||||
},
|
},
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -95,6 +95,11 @@ Y.extend(EditorPlugin, Y.Base, {
|
||||||
* @method markUpdated
|
* @method markUpdated
|
||||||
*/
|
*/
|
||||||
markUpdated: function() {
|
markUpdated: function() {
|
||||||
|
// Save selection after changes to the DOM. If you don't do this here,
|
||||||
|
// subsequent calls to restoreSelection() will fail expecting the
|
||||||
|
// previous DOM state.
|
||||||
|
this.get('host').saveSelection();
|
||||||
|
|
||||||
return this.get('host').updateOriginal();
|
return this.get('host').updateOriginal();
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
@ -758,6 +763,9 @@ EditorPluginButtons.prototype = {
|
||||||
// Build the arguments list, but remove the callback we're calling.
|
// Build the arguments list, but remove the callback we're calling.
|
||||||
var args = [e, callbackArgs];
|
var args = [e, callbackArgs];
|
||||||
|
|
||||||
|
// Restore selection before making changes.
|
||||||
|
this.get('host').restoreSelection();
|
||||||
|
|
||||||
// Actually call the callback now.
|
// Actually call the callback now.
|
||||||
return callback.apply(this, args);
|
return callback.apply(this, args);
|
||||||
},
|
},
|
||||||
|
|
|
@ -618,6 +618,9 @@ EditorPluginButtons.prototype = {
|
||||||
// Build the arguments list, but remove the callback we're calling.
|
// Build the arguments list, but remove the callback we're calling.
|
||||||
var args = [e, callbackArgs];
|
var args = [e, callbackArgs];
|
||||||
|
|
||||||
|
// Restore selection before making changes.
|
||||||
|
this.get('host').restoreSelection();
|
||||||
|
|
||||||
// Actually call the callback now.
|
// Actually call the callback now.
|
||||||
return callback.apply(this, args);
|
return callback.apply(this, args);
|
||||||
},
|
},
|
||||||
|
|
|
@ -93,6 +93,11 @@ Y.extend(EditorPlugin, Y.Base, {
|
||||||
* @method markUpdated
|
* @method markUpdated
|
||||||
*/
|
*/
|
||||||
markUpdated: function() {
|
markUpdated: function() {
|
||||||
|
// Save selection after changes to the DOM. If you don't do this here,
|
||||||
|
// subsequent calls to restoreSelection() will fail expecting the
|
||||||
|
// previous DOM state.
|
||||||
|
this.get('host').saveSelection();
|
||||||
|
|
||||||
return this.get('host').updateOriginal();
|
return this.get('host').updateOriginal();
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue