From 26985d326f98cbc71faa805bd1b973f94313e834 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Fri, 15 May 2009 23:32:38 -0700 Subject: [PATCH] Only collapsing cursor if it's not already collapsed (for the benefit of WebKit). --- static/js/Editor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/js/Editor.js b/static/js/Editor.js index aa6f6c2..6cb4376 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -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 );