mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -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 );
|
||||
range.selectNodeContents( root.firstChild );
|
||||
} else {
|
||||
range.collapse( false );
|
||||
range.collapse( range.endContainer === root ? true : false );
|
||||
}
|
||||
return frag;
|
||||
};
|
||||
|
@ -2185,7 +2185,7 @@ var onCopy = function ( event ) {
|
|||
range = range.cloneRange();
|
||||
startBlock = getStartBlockOfRange( range, root );
|
||||
endBlock = getEndBlockOfRange( range, root );
|
||||
copyRoot = ( startBlock === endBlock ) ? startBlock : root;
|
||||
copyRoot = ( ( startBlock === endBlock ) && startBlock ) || root;
|
||||
moveRangeBoundariesDownTree( range );
|
||||
moveRangeBoundariesUpTree( range, copyRoot );
|
||||
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();
|
||||
startBlock = getStartBlockOfRange( range, root );
|
||||
endBlock = getEndBlockOfRange( range, root );
|
||||
copyRoot = ( startBlock === endBlock ) ? startBlock : root;
|
||||
copyRoot = ( ( startBlock === endBlock ) && startBlock ) || root;
|
||||
moveRangeBoundariesDownTree( range );
|
||||
moveRangeBoundariesUpTree( range, copyRoot );
|
||||
contents = range.cloneContents();
|
||||
|
|
Loading…
Reference in a new issue