summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2017-01-03 18:47:25 +0000
committerFatih Acet <acetfatih@gmail.com>2017-01-03 18:47:25 +0000
commitb23fd4e9ea79732f2639636c31525fa7756036ca (patch)
tree6e8a549fd7736b845d471b524c8b0faaec524fdf
parentdb7a063dd28287fe7ba94982a48c8c9e185ab7eb (diff)
parentc0f4fe06bf69066fd097f0ff1fcb481a3a5607fa (diff)
downloadgitlab-ce-b23fd4e9ea79732f2639636c31525fa7756036ca.tar.gz
Merge branch '25964-label-autocomplete-doesn-t-handle-spaces-after' into 'master'
Resolve "Label autocomplete doesn't handle spaces after `~~`" Closes #25964, #22058, and #23578 See merge request !8254
-rw-r--r--app/assets/javascripts/gfm_auto_complete.js.es611
1 files changed, 3 insertions, 8 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js.es6 b/app/assets/javascripts/gfm_auto_complete.js.es6
index 87c579ac757..6ca543c2b00 100644
--- a/app/assets/javascripts/gfm_auto_complete.js.es6
+++ b/app/assets/javascripts/gfm_auto_complete.js.es6
@@ -48,6 +48,7 @@
},
DefaultOptions: {
sorter: function(query, items, searchKey) {
+ this.setting.highlightFirst = query.length > 0;
if (gl.GfmAutoComplete.isLoading(items)) {
return items;
}
@@ -55,11 +56,9 @@
},
filter: function(query, data, searchKey) {
if (gl.GfmAutoComplete.isLoading(data)) {
- gl.GfmAutoComplete.togglePreventSelection.call(this, true);
gl.GfmAutoComplete.fetchData(this.$inputor, this.at);
return data;
} else {
- gl.GfmAutoComplete.togglePreventSelection.call(this, false);
return $.fn.atwho["default"].callbacks.filter(query, data, searchKey);
}
},
@@ -257,9 +256,9 @@
insertTpl: '${atwho-at}${title}',
callbacks: {
matcher: this.DefaultOptions.matcher,
- sorter: this.DefaultOptions.sorter,
beforeInsert: this.DefaultOptions.beforeInsert,
filter: this.DefaultOptions.filter,
+ sorter: this.DefaultOptions.sorter,
beforeSave: function(merges) {
if (gl.GfmAutoComplete.isLoading(merges)) return merges;
var sanitizeLabelTitle;
@@ -370,11 +369,7 @@
if (!data || !data.length) return false;
if (Array.isArray(data)) data = data[0];
return data === this.defaultLoadingData[0] || data.name === this.defaultLoadingData[0];
- },
- togglePreventSelection(isPrevented = !!this.setting.tabSelectsMatch) {
- this.setting.tabSelectsMatch = !isPrevented;
- this.setting.spaceSelectsMatch = !isPrevented;
- },
+ }
};
}).call(this);