mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -05:00
Fix error when copying inline text-only.
This commit is contained in:
parent
26b71dee8e
commit
e1d30b7082
3 changed files with 8 additions and 2 deletions
|
@ -2132,6 +2132,9 @@ var onCopy = function ( event ) {
|
||||||
moveRangeBoundariesUpTree( range, copyRoot );
|
moveRangeBoundariesUpTree( range, copyRoot );
|
||||||
contents = range.cloneContents();
|
contents = range.cloneContents();
|
||||||
parent = range.commonAncestorContainer;
|
parent = range.commonAncestorContainer;
|
||||||
|
if ( parent.nodeType === TEXT_NODE ) {
|
||||||
|
parent = parent.parentNode;
|
||||||
|
}
|
||||||
while ( parent && parent !== copyRoot ) {
|
while ( parent && parent !== copyRoot ) {
|
||||||
newContents = parent.cloneNode( false );
|
newContents = parent.cloneNode( false );
|
||||||
newContents.appendChild( contents );
|
newContents.appendChild( contents );
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -53,6 +53,9 @@ var onCopy = function ( event ) {
|
||||||
moveRangeBoundariesUpTree( range, copyRoot );
|
moveRangeBoundariesUpTree( range, copyRoot );
|
||||||
contents = range.cloneContents();
|
contents = range.cloneContents();
|
||||||
parent = range.commonAncestorContainer;
|
parent = range.commonAncestorContainer;
|
||||||
|
if ( parent.nodeType === TEXT_NODE ) {
|
||||||
|
parent = parent.parentNode;
|
||||||
|
}
|
||||||
while ( parent && parent !== copyRoot ) {
|
while ( parent && parent !== copyRoot ) {
|
||||||
newContents = parent.cloneNode( false );
|
newContents = parent.cloneNode( false );
|
||||||
newContents.appendChild( contents );
|
newContents.appendChild( contents );
|
||||||
|
|
Loading…
Reference in a new issue