Skip to content

Commit

Permalink
MDL-52944 atto: Use event-key to handle enter key
Browse files Browse the repository at this point in the history
  • Loading branch information
cameorn1730 committed Apr 8, 2016
1 parent 6c0ec8d commit c9a1658
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
Expand Up @@ -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));

Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit c9a1658

Please sign in to comment.