don't bind to ?... check the input value

This commit is contained in:
Cade Scroggins
2017-07-30 00:16:05 -07:00
parent 7c3f8e390f
commit 5bb677b3f1
+4 -12
View File
@@ -397,7 +397,6 @@
case 78: return ctrl ? 'c-n' : 'n'; case 78: return ctrl ? 'c-n' : 'n';
case 80: return ctrl ? 'c-p' : 'n'; case 80: return ctrl ? 'c-p' : 'n';
case 91: return 'super'; case 91: return 'super';
case 191: return shift ? '?' : '/';
} }
}, },
}; };
@@ -919,14 +918,6 @@
_handleKeydown(e) { _handleKeydown(e) {
if ($.isUp(e) || $.isDown(e) || $.isRemove(e)) return; if ($.isUp(e) || $.isDown(e) || $.isRemove(e)) return;
const handleQuestion = () => {
if (!this._inputElVal) {
this.hide();
if ($.bodyClassHas('form')) this._help.toggle(true);
else this._help.toggle();
}
};
switch ($.key(e)) { switch ($.key(e)) {
case 'alt': case 'alt':
case 'ctrl': case 'ctrl':
@@ -934,7 +925,6 @@
case 'shift': case 'shift':
case 'super': return; case 'super': return;
case 'escape': this.hide(); return; case 'escape': this.hide(); return;
case '?': handleQuestion(); return;
} }
this.show(); this.show();
@@ -942,12 +932,14 @@
_handleInput() { _handleInput() {
const newQuery = this._inputEl.value; const newQuery = this._inputEl.value;
const isHelp = newQuery === '?';
const { isKey } = this._queryParser.parse(newQuery); const { isKey } = this._queryParser.parse(newQuery);
this._inputElVal = newQuery; this._inputElVal = newQuery;
this._setBackgroundFromQuery(newQuery); this._setBackgroundFromQuery(newQuery);
if (!newQuery || isHelp ) this.hide();
if (isHelp) this._help.toggle();
if (this._instantRedirect && isKey) this._submitWithValue(newQuery);
if (this._suggester) this._suggester.suggest(newQuery); if (this._suggester) this._suggester.suggest(newQuery);
if (!newQuery) this.hide();
else if (this._instantRedirect && isKey) this._submitWithValue(newQuery);
} }
_loadQueryParam() { _loadQueryParam() {