mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 05:00:13 -05:00
Remove empty inline nodes on paste.
This commit is contained in:
parent
7162777a0f
commit
ac14985583
1 changed files with 16 additions and 0 deletions
|
@ -1116,6 +1116,21 @@
|
|||
}
|
||||
};
|
||||
|
||||
var removeEmptyInlines = function ( root ) {
|
||||
var children = root.childNodes,
|
||||
l = children.length,
|
||||
child;
|
||||
while ( l-- ) {
|
||||
child = children[l];
|
||||
if ( child.nodeType === ELEMENT_NODE ) {
|
||||
removeEmptyInlines( child );
|
||||
if ( child.isInline() && !child.firstChild ) {
|
||||
root.removeChild( child );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Two purposes:
|
||||
|
||||
|
@ -1317,6 +1332,7 @@
|
|||
addLinks( frag );
|
||||
cleanTree( frag, false );
|
||||
cleanupBRs( frag );
|
||||
removeEmptyInlines( frag );
|
||||
|
||||
var node = frag,
|
||||
doPaste = true;
|
||||
|
|
Loading…
Reference in a new issue