mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-21 23:03:11 -05:00
Remove redundant <span> after replacing styles
It no CSS left after replacing with semantic equivalent, remove the whole span.
This commit is contained in:
parent
168033d25d
commit
e4ae7c2b81
1 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
import { notWS } from './Constants';
|
||||
import { TreeIterator, SHOW_ELEMENT_OR_TEXT } from './node/TreeIterator';
|
||||
import { createElement, empty, detach } from './node/Node';
|
||||
import { createElement, empty, detach, replaceWith } from './node/Node';
|
||||
import { isInline, isLeaf } from './node/Category';
|
||||
import { fixContainer } from './node/MergeSplit';
|
||||
import { isLineBreak } from './node/Whitespace';
|
||||
|
@ -95,7 +95,11 @@ const replaceStyles = (
|
|||
|
||||
if (newTreeTop && newTreeBottom) {
|
||||
newTreeBottom.appendChild(empty(node));
|
||||
node.appendChild(newTreeTop);
|
||||
if (node.style.cssText) {
|
||||
node.appendChild(newTreeTop);
|
||||
} else {
|
||||
replaceWith(node, newTreeTop);
|
||||
}
|
||||
}
|
||||
|
||||
return newTreeBottom || node;
|
||||
|
|
Loading…
Reference in a new issue