Remove invalid parent paragraph when pasting in the visual editor or switching visual to HTML and back, keep multiple empty lines in a <pre> tag, fixes #15095 fixes #15367
git-svn-id: http://svn.automattic.com/wordpress/trunk@16394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -166,6 +166,7 @@
|
||||
});
|
||||
|
||||
ed.onInit.add(function(ed) {
|
||||
// make sure these run last
|
||||
ed.onNodeChange.add( function(ed, cm, e) {
|
||||
var DL;
|
||||
|
||||
@@ -187,6 +188,14 @@
|
||||
cm.setActive('justifycenter', 1);
|
||||
}
|
||||
});
|
||||
|
||||
// remove invalid parent paragraphs when pasting HTML and/or switching to the HTML editor and back
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
if ( o.content ) {
|
||||
o.content = o.content.replace(/<p>\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi, '<$1$2>');
|
||||
o.content = o.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi, '</$1>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Word count if script is loaded
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user