0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

Fix error when copying inline text-only.

This commit is contained in:
Neil Jenkins 2016-09-10 09:24:14 -04:00
parent 26b71dee8e
commit e1d30b7082
3 changed files with 8 additions and 2 deletions

View file

@ -2132,6 +2132,9 @@ var onCopy = function ( event ) {
moveRangeBoundariesUpTree( range, copyRoot );
contents = range.cloneContents();
parent = range.commonAncestorContainer;
if ( parent.nodeType === TEXT_NODE ) {
parent = parent.parentNode;
}
while ( parent && parent !== copyRoot ) {
newContents = parent.cloneNode( false );
newContents.appendChild( contents );

File diff suppressed because one or more lines are too long

View file

@ -53,6 +53,9 @@ var onCopy = function ( event ) {
moveRangeBoundariesUpTree( range, copyRoot );
contents = range.cloneContents();
parent = range.commonAncestorContainer;
if ( parent.nodeType === TEXT_NODE ) {
parent = parent.parentNode;
}
while ( parent && parent !== copyRoot ) {
newContents = parent.cloneNode( false );
newContents.appendChild( contents );