MDL-52944 atto: Contenteditable command 'FormatBlock' set to 'p'
This commit is contained in:
committed by
Cameron Ball
parent
80b5eb78dd
commit
6c0ec8dd4c
+6
-5
@@ -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');
|
||||
@@ -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));
|
||||
|
||||
|
||||
+4
-4
File diff suppressed because one or more lines are too long
+6
-5
@@ -210,11 +210,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');
|
||||
@@ -296,6 +291,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));
|
||||
|
||||
|
||||
+6
-5
@@ -210,11 +210,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');
|
||||
@@ -296,6 +291,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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user