Commit b23fd4e9 authored by Fatih Acet's avatar Fatih Acet

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
parents db7a063d c0f4fe06
......@@ -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);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment