From 7e519a202f833e9e71dd1f51929880527f5b96d3 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sat, 12 Jul 2008 14:24:00 -0700 Subject: [PATCH] Fixed a bug in which pressing tab/shift-tab when a suggest pulldown was open caused the current text to indent/outdent. Now, tab/shift-tab only cause indent/outdent when there is no suggest pulldown. --- NEWS | 4 ++++ static/js/Wiki.js | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/NEWS b/NEWS index 7b0d6a6..a08dbe2 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +1.4.14: July 12, 2008: + * Fixed a bug in which pressing tab/shift-tab when a suggest pulldown was + open caused the current text to indent/outdent. + 1.4.13: July 11, 2008: * New "revert" button to roll back a note's contents to an earlier revision. diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 0f29db2..7244173 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -962,6 +962,7 @@ Wiki.prototype.key_pressed = function ( event ) { Wiki.prototype.editor_key_pressed = function ( editor, event ) { var code = event.key().code; + if ( event.modifier().ctrl ) { // ctrl-backtick: alert with frame HTML contents (temporary for debugging) if ( code == 192 || code == 96 ) { @@ -1001,10 +1002,20 @@ Wiki.prototype.editor_key_pressed = function ( editor, event ) { } // shift-tab: outdent } else if ( event.modifier().shift && code == 9 ) { + // ignore shift-tab here if a Suggest_pulldown is open + var link = editor.find_link_at_cursor(); + if ( link && link.pulldown && link.pulldown.update_suggestions ) + return; + editor.exec_command( "outdent" ); event.stop(); // tab: outdent } else if ( code == 9 ) { + // ignore tab here if a Suggest_pulldown is open + var link = editor.find_link_at_cursor(); + if ( link && link.pulldown && link.pulldown.update_suggestions ) + return; + editor.exec_command( "indent" ); event.stop(); // IE: hitting space while making a link shouldn't end the link