Skip to content

Commit

Permalink
MDL-52944 atto: Contenteditable command 'FormatBlock' set to 'p'
Browse files Browse the repository at this point in the history
  • Loading branch information
nikoloup authored and cameorn1730 committed Apr 8, 2016
1 parent 80b5eb7 commit 6c0ec8d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
Expand Up @@ -212,11 +212,6 @@ Y.extend(Editor, Y.Base, {
// Disable odd inline CSS styles.
this.disableCssStyling();

// Use paragraphs not divs.
if (document.queryCommandSupported('DefaultParagraphSeparator')) {
document.execCommand('DefaultParagraphSeparator', false, 'p');
}

// Add the toolbar and editable zone to the page.
this.textarea.get('parentNode').insert(this._wrapper, this.textarea).
setAttribute('class', 'editor_atto_wrap');
Expand Down Expand Up @@ -298,6 +293,12 @@ Y.extend(Editor, Y.Base, {
* @chainable
*/
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(['keyup', 'cut'], this.updateOriginal, this));
this._registerEventHandle(this.editor.on('paste', this.pasteCleanup, this));

Expand Down

0 comments on commit 6c0ec8d

Please sign in to comment.