From babb752050cb271489cc1f58df22d675fa5f8184 Mon Sep 17 00:00:00 2001 From: Harald von Waldow Date: Fri, 11 May 2018 17:33:36 +0200 Subject: [PATCH] autocomplete tagsep - fix --- ckan/public/base/javascript/modules/autocomplete.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ckan/public/base/javascript/modules/autocomplete.js b/ckan/public/base/javascript/modules/autocomplete.js index 8a8f5e9d69c..dbcaf0e2dec 100644 --- a/ckan/public/base/javascript/modules/autocomplete.js +++ b/ckan/public/base/javascript/modules/autocomplete.js @@ -2,14 +2,16 @@ * a list of terms from an API endpoint (provided using data-module-source). * * source - A url pointing to an API autocomplete endpoint. - * interval - The interval between requests in milliseconds (default: 1000). + * interval - The interval between requests in milliseconds (default: 300). * items - The max number of items to display (default: 10) * tags - Boolean attribute if true will create a tag input. * key - A string of the key you want to be the form value to end up on * from the ajax returned results * label - A string of the label you want to appear within the dropdown for * returned results - * + * tokensep - An array (passed as string) that contains characters which will + be interpreted as separators for tags when typed or pasted + (default "[',']"). * Examples * * // @@ -24,6 +26,7 @@ this.ckan.module('autocomplete', function (jQuery) { label: false, items: 10, source: null, + tokensep: [','], interval: 300, dropdownClass: '', containerClass: '' @@ -50,7 +53,8 @@ this.ckan.module('autocomplete', function (jQuery) { formatNoMatches: this.formatNoMatches, formatInputTooShort: this.formatInputTooShort, dropdownCssClass: this.options.dropdownClass, - containerCssClass: this.options.containerClass + containerCssClass: this.options.containerClass, + tokenSeparators: eval(this.options.tokensep) }; // Different keys are required depending on whether the select is