mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
TinyMCE: wptextpattern: fix issue that removes content
* If the resulting text node is empty, don't remove all the content from the paragraph. * If there's an empty text node at the start of the paragraph, ignore it and consider the next node to be the start. See #31441. git-svn-id: https://develop.svn.wordpress.org/trunk@32832 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -87,6 +87,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! child.nodeValue ) {
|
||||
child = child.nextSibling;
|
||||
}
|
||||
|
||||
if ( child !== node ) {
|
||||
return;
|
||||
}
|
||||
@@ -109,10 +113,18 @@
|
||||
editor.undoManager.add();
|
||||
|
||||
editor.undoManager.transact( function() {
|
||||
var $$parent;
|
||||
|
||||
if ( replace ) {
|
||||
$$( node ).replaceWith( document.createTextNode( replace ) );
|
||||
} else {
|
||||
$$( node.parentNode ).empty().append( '<br>' );
|
||||
$$parent = $$( node.parentNode );
|
||||
|
||||
$$( node ).remove();
|
||||
|
||||
if ( ! $$parent.html() ) {
|
||||
$$parent.append( '<br>' );
|
||||
}
|
||||
}
|
||||
|
||||
editor.selection.setCursorLocation( parent );
|
||||
|
||||
Reference in New Issue
Block a user