From 94647c48878958415e5d764e6fcb704aa39b258a Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sun, 29 Jun 2008 15:19:59 -0700 Subject: [PATCH] Backspacing at the end of a link in IE no longer ends the link. Fixed a bug where typing a space within a link in IE caused the space to be added to the end of the link. --- NEWS | 3 +++ static/js/Wiki.js | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 237097e..78109b6 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ 1.4.10: June ?, 2008: * New suggest-as-you-type feature for creating links. + * Fixed a bug where typing a space within a link in IE caused the space + to be added to the end of the link. + * Backspacing at the end of a link in IE no longer ends the link. 1.4.9: June 25, 2008: * When linking to a note by title, the note resolution is now diff --git a/static/js/Wiki.js b/static/js/Wiki.js index dc03b83..7dde35d 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -995,10 +995,15 @@ Wiki.prototype.editor_key_pressed = function ( editor, event ) { } else if ( ( code == 32 || code == 9 ) && editor.document.selection && editor.state_enabled( "a" ) ) { if ( code == 32 ) { var range = editor.document.selection.createRange(); - var text = range.parentElement().firstChild; - text.nodeValue += " "; + range.text = " "; } event.stop(); + // IE: hitting backspace while making a link shouldn't end the link + } else if ( code == 8 && editor.document.selection && editor.state_enabled( "a" ) ) { + var range = editor.document.selection.createRange(); + range.moveStart( "character", -1 ); + range.text = ""; + event.stop(); } }