0
Fork 0
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:
Neil Jenkins 2013-02-22 15:06:56 +11:00
parent 7162777a0f
commit ac14985583

View file

@ -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: Two purposes:
@ -1317,6 +1332,7 @@
addLinks( frag ); addLinks( frag );
cleanTree( frag, false ); cleanTree( frag, false );
cleanupBRs( frag ); cleanupBRs( frag );
removeEmptyInlines( frag );
var node = frag, var node = frag,
doPaste = true; doPaste = true;