MDL-52944 atto: Use event-key to handle enter key

This commit is contained in:
Cameron Ball 2016-04-08 12:22:14 +08:00
parent 92a8ca4ba2
commit a6a59bcaa4
5 changed files with 16 additions and 19 deletions

View file

@ -294,11 +294,9 @@ Y.extend(Editor, Y.Base, {
*/
setupAutomaticPolling: function() {
// Force use of <p> tags when pressing enter key
this._registerEventHandle(this.editor.on('keypress', function(ev) {
if(ev.keyCode === 13) {
this._registerEventHandle(this.editor.on('key', function() {
document.execCommand('formatBlock', false, 'p');
}
}, this));
}, 'press:enter', this));
this._registerEventHandle(this.editor.on(['keyup', 'cut'], this.updateOriginal, this));
this._registerEventHandle(this.editor.on('paste', this.pasteCleanup, this));
@ -2585,6 +2583,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorFilepicker]);
"overlay",
"escape",
"event",
"event-key",
"event-simulate",
"event-custom",
"node-event-html5",

File diff suppressed because one or more lines are too long

View file

@ -292,11 +292,9 @@ Y.extend(Editor, Y.Base, {
*/
setupAutomaticPolling: function() {
// Force use of <p> tags when pressing enter key
this._registerEventHandle(this.editor.on('keypress', function(ev) {
if(ev.keyCode === 13) {
this._registerEventHandle(this.editor.on('key', function() {
document.execCommand('formatBlock', false, 'p');
}
}, this));
}, 'press:enter', this));
this._registerEventHandle(this.editor.on(['keyup', 'cut'], this.updateOriginal, this));
this._registerEventHandle(this.editor.on('paste', this.pasteCleanup, this));
@ -2572,6 +2570,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorFilepicker]);
"overlay",
"escape",
"event",
"event-key",
"event-simulate",
"event-custom",
"node-event-html5",

View file

@ -292,11 +292,9 @@ Y.extend(Editor, Y.Base, {
*/
setupAutomaticPolling: function() {
// Force use of <p> tags when pressing enter key
this._registerEventHandle(this.editor.on('keypress', function(ev) {
if(ev.keyCode === 13) {
this._registerEventHandle(this.editor.on('key', function() {
document.execCommand('formatBlock', false, 'p');
}
}, this));
}, 'press:enter', this));
this._registerEventHandle(this.editor.on(['keyup', 'cut'], this.updateOriginal, this));
this._registerEventHandle(this.editor.on('paste', this.pasteCleanup, this));

View file

@ -7,6 +7,7 @@
"overlay",
"escape",
"event",
"event-key",
"event-simulate",
"event-custom",
"node-event-html5",