mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-48973 Atto: Atto does not listen to the drop event
The 'drop' event fires before the native ContentEditable drop handler, so in order to update the underlying textarea we need to call updateOriginal with a brief delay so that the dropped content has actually been added to the editor.
This commit is contained in:
parent
7357af2b0c
commit
10fae2779e
@ -300,6 +300,21 @@ Y.extend(Editor, Y.Base, {
|
||||
setupAutomaticPolling: function() {
|
||||
this._registerEventHandle(this.editor.on(['keyup', 'paste', 'cut'], this.updateOriginal, this));
|
||||
|
||||
// Call this.updateOriginal after dropped content has been processed.
|
||||
this._registerEventHandle(this.editor.on('drop', this.updateOriginalDelayed, this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Calls updateOriginal on a short timer to allow native event handlers to run first.
|
||||
*
|
||||
* @method updateOriginalDelayed
|
||||
* @chainable
|
||||
*/
|
||||
updateOriginalDelayed: function() {
|
||||
Y.soon(Y.bind(this.updateOriginal, this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -298,6 +298,21 @@ Y.extend(Editor, Y.Base, {
|
||||
setupAutomaticPolling: function() {
|
||||
this._registerEventHandle(this.editor.on(['keyup', 'paste', 'cut'], this.updateOriginal, this));
|
||||
|
||||
// Call this.updateOriginal after dropped content has been processed.
|
||||
this._registerEventHandle(this.editor.on('drop', this.updateOriginalDelayed, this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Calls updateOriginal on a short timer to allow native event handlers to run first.
|
||||
*
|
||||
* @method updateOriginalDelayed
|
||||
* @chainable
|
||||
*/
|
||||
updateOriginalDelayed: function() {
|
||||
Y.soon(Y.bind(this.updateOriginal, this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
15
lib/editor/atto/yui/src/editor/js/editor.js
vendored
15
lib/editor/atto/yui/src/editor/js/editor.js
vendored
@ -298,6 +298,21 @@ Y.extend(Editor, Y.Base, {
|
||||
setupAutomaticPolling: function() {
|
||||
this._registerEventHandle(this.editor.on(['keyup', 'paste', 'cut'], this.updateOriginal, this));
|
||||
|
||||
// Call this.updateOriginal after dropped content has been processed.
|
||||
this._registerEventHandle(this.editor.on('drop', this.updateOriginalDelayed, this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Calls updateOriginal on a short timer to allow native event handlers to run first.
|
||||
*
|
||||
* @method updateOriginalDelayed
|
||||
* @chainable
|
||||
*/
|
||||
updateOriginalDelayed: function() {
|
||||
Y.soon(Y.bind(this.updateOriginal, this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user