Revert "search: Open typeahead on empty string only if lookup triggered by Tab."

This reverts commit b961093c14.
This commit is contained in:
Tim Abbott
2018-12-04 13:55:55 -08:00
parent 250a2b5164
commit 9ea4f50c1b
3 changed files with 5 additions and 9 deletions

View File

@@ -89,8 +89,7 @@ run_test('initizalize', () => {
assert.equal(opts.fixed, true);
assert.equal(opts.items, 12);
assert.equal(opts.naturalSearch, true);
assert.equal(opts.tabOpensEmptyTypeahead, true);
assert.equal(opts.helpOnEmptyStrings, false);
assert.equal(opts.helpOnEmptyStrings, true);
assert.equal(opts.matcher(), true);
{

View File

@@ -70,7 +70,6 @@ exports.initialize = function () {
// just represents the key of the hash, so it's redundant.)
var search_object = {};
// tabOpensEmptyTypeahead overrides helpOnEmptyStrings.
search_query_box.typeahead({
source: function (query) {
var suggestions;
@@ -87,8 +86,7 @@ exports.initialize = function () {
},
fixed: true,
items: 12,
tabOpensEmptyTypeahead: page_params.search_pills_enabled,
helpOnEmptyStrings: !page_params.search_pills_enabled,
helpOnEmptyStrings: true,
naturalSearch: true,
highlighter: function (item) {
var obj = search_object[item];

View File

@@ -1900,10 +1900,10 @@
, lookup: function (event) {
var items
var from_tab = (event === 'from_tab')
this.query = this.$element.is("[contenteditable]") ? this.$element.text() : this.$element.val();
if (!this.options.helpOnEmptyStrings && !(from_tab && this.options.tabOpensEmptyTypeahead)) {
if (!this.options.helpOnEmptyStrings) {
if (!this.query || this.query.length < this.options.minLength) {
return this.shown ? this.hide() : this
}
@@ -2070,7 +2070,7 @@
case 9: // tab
if (!this.shown) {
this.lookup('from_tab')
this.lookup()
return
}
this.select(e)
@@ -2143,7 +2143,6 @@
, stopAdvance: false
, dropup: false
, advanceKeyCodes: []
, tabOpensEmptyTypeahead: false
}
$.fn.typeahead.Constructor = Typeahead