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

This commit is contained in:
Cameron Ball
2016-04-08 12:29:01 +08:00
parent 6c0ec8dd4c
commit c9a1658c50
5 changed files with 16 additions and 19 deletions
@@ -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) {
document.execCommand('formatBlock', false, 'p');
}
}, this));
this._registerEventHandle(this.editor.on('key', function() {
document.execCommand('formatBlock', false, 'p');
}, '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
@@ -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) {
document.execCommand('formatBlock', false, 'p');
}
}, this));
this._registerEventHandle(this.editor.on('key', function() {
document.execCommand('formatBlock', false, 'p');
}, '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",
+3 -5
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) {
document.execCommand('formatBlock', false, 'p');
}
}, this));
this._registerEventHandle(this.editor.on('key', function() {
document.execCommand('formatBlock', false, 'p');
}, 'press:enter', this));
this._registerEventHandle(this.editor.on(['keyup', 'cut'], this.updateOriginal, this));
this._registerEventHandle(this.editor.on('paste', this.pasteCleanup, this));
@@ -7,6 +7,7 @@
"overlay",
"escape",
"event",
"event-key",
"event-simulate",
"event-custom",
"node-event-html5",