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

Fix bug in deleting all.

This commit is contained in:
Neil Jenkins 2011-11-02 11:54:58 +11:00
parent 110568350b
commit 1d5b841860

View file

@ -120,7 +120,7 @@ implement( Range, {
var startBlock = this.getStartBlock(), var startBlock = this.getStartBlock(),
endBlock = this.getEndBlock(); endBlock = this.getEndBlock();
if ( startBlock !== endBlock ) { if ( startBlock && endBlock && startBlock !== endBlock ) {
startBlock.mergeWithBlock( endBlock, this ); startBlock.mergeWithBlock( endBlock, this );
} }
@ -336,8 +336,7 @@ implement( Range, {
} }
if ( !node.isBlock() ) { if ( !node.isBlock() ) {
node = node.getPreviousBlock() || node = node.getPreviousBlock() ||
this.startContainer.ownerDocument this.startContainer.ownerDocument.body.getNextBlock();
.body.getNextBlock();
} }
return node; return node;
}, },
@ -354,10 +353,12 @@ implement( Range, {
while ( node && !node.nextSibling ) { while ( node && !node.nextSibling ) {
node = node.parentNode; node = node.parentNode;
} }
return node ? if ( node ) {
node.nextSibling.getPreviousBlock() : node = node.nextSibling.getPreviousBlock();
this.startContainer.ownerDocument } else {
.body.lastChild.getPreviousBlock(); node = this.startContainer.ownerDocument.body.lastChild;
if ( node ) { node = node.getPreviousBlock(); }
}
} }
return node; return node;
}, },