witten
/
luminotes
Archived
1
0
Fork 0

Only collapsing cursor if it's not already collapsed (for the benefit of WebKit).

This commit is contained in:
Dan Helfman 2009-05-15 23:32:38 -07:00
parent 9f42372ebc
commit 26985d326f
1 changed files with 2 additions and 1 deletions

View File

@ -488,7 +488,8 @@ Editor.prototype.position_cursor_after = function ( node ) {
Editor.prototype.collapse_cursor = function () {
if ( this.iframe.contentWindow && this.iframe.contentWindow.getSelection ) { // browsers such as Firefox
var selection = this.iframe.contentWindow.getSelection();
selection.collapseToEnd();
if ( !selection.isCollapsed )
selection.collapseToEnd();
} else if ( this.document.selection ) { // browsers such as IE
var range = this.document.selection.createRange();
range.collapse( false );