No more endless looping! And fix getSelectionRect to return document relative coordiantes instead of viewport relative.

This commit is contained in:
Inez Korczynski 2012-03-16 21:52:17 +00:00
parent cde7a3bf7e
commit 6ef8ac182a
Notes: Inez Korczynski 2012-03-16 21:52:17 +00:00

View file

@ -578,8 +578,8 @@ ve.ce.Surface.prototype.getSelectionRange = function() {
ve.ce.Surface.prototype.getSelectionRect = function() {
var rangySel = rangy.getSelection();
return {
start: rangySel.getStartClientPos(),
end: rangySel.getEndClientPos()
start: rangySel.getStartDocumentPos(),
end: rangySel.getEndDocumentPos()
};
};
@ -655,6 +655,9 @@ ve.ce.Surface.getLeafNode = function( elem ) {
var $node = $( elem );
while( !$node.hasClass( 'ce-leafNode' ) ) {
$node = $node.parent();
if ( $node.is( 'body') ) {
return null;
}
}
return $node;
};