Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Enable entering phrased tags using quotation marks to start/close tags #1378

Closed
wants to merge 2 commits into from

2 participants

@boamaod

Ideas for enhancement:

  • maybe support both single and double quotes
  • disable quotes in search string for correct phrased tag lookup
@linc linc closed this
@linc
Collaborator

We upgraded to a new version of tokenizer which makes this incompatible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 15 deletions.
  1. +26 −15 plugins/Tagging/jquery.tokeninput.js
View
41 plugins/Tagging/jquery.tokeninput.js
@@ -74,7 +74,8 @@ $.TokenList = function (input, settings) {
RIGHT: 39,
DOWN: 40,
COMMA: 188,
- SPACE: 32
+ SPACE: 32,
+ QUOTE: 222
};
$(input).bind('BeforeSubmit', function(e, frm){
@@ -175,23 +176,31 @@ $.TokenList = function (input, settings) {
}
break;
+ case KEY.ESC:
+ hide_dropdown();
+ return true;
+
case KEY.TAB:
case KEY.RETURN:
case KEY.COMMA:
case KEY.SPACE:
- if (selected_dropdown_item) {
- add_token($(selected_dropdown_item));
- } else {
- var val = $(input_box).val();
- add_blank_token(val, val);
- cancel_request = true;
- }
- return false;
- break;
-
- case KEY.ESC:
- hide_dropdown();
- return true;
+ case KEY.QUOTE:
+ var val = $(input_box).val();
+ if((val.charAt(0) != '"' && event.keyCode != KEY.QUOTE) ||
+ (val.charAt(0) == '"' && event.keyCode == KEY.QUOTE)) {
+ if(event.keyCode == KEY.QUOTE) { // close quotation marks
+ val=val.replace('"', ''); // remove quotation marks
+ val=val.replace(' ', ' '); // replace space with nonbr space
+ }
+ if (selected_dropdown_item) {
+ add_token($(selected_dropdown_item));
+ } else {
+ add_blank_token(val, val);
+ cancel_request = true;
+ }
+ return false;
+ break;
+ } // on appropriate quotation mark combo pass to default
default:
if(is_printable_character(event.keyCode)) {
@@ -554,6 +563,8 @@ $.TokenList = function (input, settings) {
// than settings.minChars
function do_search(immediate) {
var query = input_box.val().toLowerCase();
+ if (query.charAt(0) == '"')
+ query = query.substr(1);
if (query && query.length) {
if(selected_token) {
@@ -627,4 +638,4 @@ $.TokenList.Cache = function (options) {
};
};
-})(jQuery);
+})(jQuery);
Something went wrong with that request. Please try again.