mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
typeahead: Refactor to avoid no-case-declarations issue.
This commit is contained in:
@@ -554,16 +554,6 @@ import {get_string_diff} from "../../src/util";
|
|||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var hideOnEmpty = false;
|
|
||||||
// backspace
|
|
||||||
if (
|
|
||||||
e.keyCode === 8 &&
|
|
||||||
this.options.helpOnEmptyStrings && // Support for inputs to set the hideOnEmpty option explicitly to false
|
|
||||||
// to display typeahead after hitting backspace to clear the input.
|
|
||||||
(typeof this.options.hideOnEmpty === undefined || this.options.hideOnEmpty)
|
|
||||||
) {
|
|
||||||
hideOnEmpty = true;
|
|
||||||
}
|
|
||||||
if (this.options.openInputFieldOnKeyUp !== null && !this.shown) {
|
if (this.options.openInputFieldOnKeyUp !== null && !this.shown) {
|
||||||
// If the typeahead isn't shown yet, the `lookup` call will open it.
|
// If the typeahead isn't shown yet, the `lookup` call will open it.
|
||||||
// Here we make a callback to the input field before we open the
|
// Here we make a callback to the input field before we open the
|
||||||
@@ -571,7 +561,17 @@ import {get_string_diff} from "../../src/util";
|
|||||||
// the search bar).
|
// the search bar).
|
||||||
this.options.openInputFieldOnKeyUp();
|
this.options.openInputFieldOnKeyUp();
|
||||||
}
|
}
|
||||||
this.lookup(hideOnEmpty);
|
// backspace
|
||||||
|
if (
|
||||||
|
e.keyCode === 8 &&
|
||||||
|
this.options.helpOnEmptyStrings && // Support for inputs to set the hideOnEmpty option explicitly to false
|
||||||
|
// to display typeahead after hitting backspace to clear the input.
|
||||||
|
(typeof this.options.hideOnEmpty === undefined || this.options.hideOnEmpty)
|
||||||
|
) {
|
||||||
|
this.lookup(true);
|
||||||
|
} else {
|
||||||
|
this.lookup(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.maybeStopAdvance(e);
|
this.maybeStopAdvance(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user