From 3951d147b3cf900b735d0a39b44fd669b7de9642 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sun, 29 Jun 2008 13:13:20 -0700 Subject: [PATCH] Now can use tab and shift-tab in Suggest_pulldown, as alternative to down and up keys. --- NEWS | 3 +++ static/js/Wiki.js | 16 +++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index d989f80..237097e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +1.4.10: June ?, 2008: + * New suggest-as-you-type feature for creating links. + 1.4.9: June 25, 2008: * When linking to a note by title, the note resolution is now case-insensitive instead of case-sensitive. diff --git a/static/js/Wiki.js b/static/js/Wiki.js index ca6f401..7a43baa 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -993,9 +993,11 @@ Wiki.prototype.editor_key_pressed = function ( editor, event ) { } // IE: hitting space or tab while making a link shouldn't end the link } else if ( ( code == 32 || code == 9 ) && editor.document.selection && editor.state_enabled( "a" ) ) { - var range = editor.document.selection.createRange(); - var text = range.parentElement().firstChild; - text.nodeValue += " "; + if ( code == 32 ) { + var range = editor.document.selection.createRange(); + var text = range.parentElement().firstChild; + text.nodeValue += " "; + } event.stop(); } } @@ -3442,8 +3444,8 @@ Suggest_pulldown.prototype.key_pressed = function ( event ) { var code = event.key().code; - // up arrow: move up to the previous suggestion - if ( code == 38 ) { + // up arrow or shift-tab: move up to the previous suggestion + if ( code == 38 || ( code == 9 && event.modifier().shift ) ) { var selected = getFirstElementByTagAndClassName( "div", "selected_suggestion", this.div ); // if something is selected and there's a previous suggestion in the list, move the selection up @@ -3454,8 +3456,8 @@ Suggest_pulldown.prototype.key_pressed = function ( event ) { } else { addElementClass( this.div, "invisible" ); } - // down arrow: move down to the previous suggestion - } else if ( code == 40 ) { + // down arrow or tab: move down to the previous suggestion + } else if ( code == 40 || code == 9 ) { var selected = getFirstElementByTagAndClassName( "div", "selected_suggestion", this.div ); // if something is selected and there's a next suggestion in the list, move the selection down