mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -05:00
Fix copying when not inside valid doc structure
This commit is contained in:
parent
30dc11fd3c
commit
2c7f7b907c
3 changed files with 5 additions and 5 deletions
|
@ -897,7 +897,7 @@ var deleteContentsOfRange = function ( range, root ) {
|
||||||
fixCursor( root, root );
|
fixCursor( root, root );
|
||||||
range.selectNodeContents( root.firstChild );
|
range.selectNodeContents( root.firstChild );
|
||||||
} else {
|
} else {
|
||||||
range.collapse( false );
|
range.collapse( range.endContainer === root ? true : false );
|
||||||
}
|
}
|
||||||
return frag;
|
return frag;
|
||||||
};
|
};
|
||||||
|
@ -2185,7 +2185,7 @@ var onCopy = function ( event ) {
|
||||||
range = range.cloneRange();
|
range = range.cloneRange();
|
||||||
startBlock = getStartBlockOfRange( range, root );
|
startBlock = getStartBlockOfRange( range, root );
|
||||||
endBlock = getEndBlockOfRange( range, root );
|
endBlock = getEndBlockOfRange( range, root );
|
||||||
copyRoot = ( startBlock === endBlock ) ? startBlock : root;
|
copyRoot = ( ( startBlock === endBlock ) && startBlock ) || root;
|
||||||
moveRangeBoundariesDownTree( range );
|
moveRangeBoundariesDownTree( range );
|
||||||
moveRangeBoundariesUpTree( range, copyRoot );
|
moveRangeBoundariesUpTree( range, copyRoot );
|
||||||
contents = range.cloneContents();
|
contents = range.cloneContents();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -59,7 +59,7 @@ var onCopy = function ( event ) {
|
||||||
range = range.cloneRange();
|
range = range.cloneRange();
|
||||||
startBlock = getStartBlockOfRange( range, root );
|
startBlock = getStartBlockOfRange( range, root );
|
||||||
endBlock = getEndBlockOfRange( range, root );
|
endBlock = getEndBlockOfRange( range, root );
|
||||||
copyRoot = ( startBlock === endBlock ) ? startBlock : root;
|
copyRoot = ( ( startBlock === endBlock ) && startBlock ) || root;
|
||||||
moveRangeBoundariesDownTree( range );
|
moveRangeBoundariesDownTree( range );
|
||||||
moveRangeBoundariesUpTree( range, copyRoot );
|
moveRangeBoundariesUpTree( range, copyRoot );
|
||||||
contents = range.cloneContents();
|
contents = range.cloneContents();
|
||||||
|
|
Loading…
Reference in a new issue