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

Update to latest Squire build

This commit is contained in:
Neil Jenkins 2016-05-26 11:40:42 +10:00
parent 3d36a69d16
commit 8684c2315b
2 changed files with 17 additions and 9 deletions

View file

@ -1098,7 +1098,7 @@ var getEndBlockOfRange = function ( range, root ) {
block = container;
} else {
block = getNodeAfter( container, range.endOffset );
if ( !block ) {
if ( !block || !isOrContains( root, block ) ) {
block = root;
while ( child = block.lastChild ) {
block = child;
@ -1120,8 +1120,9 @@ var contentWalker = new TreeWalker( null,
);
var rangeDoesStartAtBlockBoundary = function ( range, root ) {
var startContainer = range.startContainer,
startOffset = range.startOffset;
var startContainer = range.startContainer;
var startOffset = range.startOffset;
var nodeAfterCursor;
// If in the middle or end of a text node, we're not at the boundary.
contentWalker.root = null;
@ -1129,16 +1130,23 @@ var rangeDoesStartAtBlockBoundary = function ( range, root ) {
if ( startOffset ) {
return false;
}
contentWalker.currentNode = startContainer;
nodeAfterCursor = startContainer;
} else {
contentWalker.currentNode = getNodeAfter( startContainer, startOffset );
if ( !contentWalker.currentNode ) {
contentWalker.currentNode = startContainer;
nodeAfterCursor = getNodeAfter( startContainer, startOffset );
if ( nodeAfterCursor && !isOrContains( root, nodeAfterCursor ) ) {
nodeAfterCursor = null;
}
// The cursor was right at the end of the document
if ( !nodeAfterCursor ) {
nodeAfterCursor = getNodeBefore( startContainer, startOffset );
if ( node.nodeType === TEXT_NODE && node.length ) {
return false;
}
}
}
// Otherwise, look for any previous content in the same block.
contentWalker.currentNode = nodeAfterCursor;
contentWalker.root = getStartBlockOfRange( range, root );
return !contentWalker.previousNode();

File diff suppressed because one or more lines are too long