mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-03 02:18:24 +01:00
Don't show the autocompleter until the user types at least one character
Summary: Ref T10163. Activate on `@d`, not just `@`. Note that if you type `@d` and then press delete once so you're left with `@`, we stay active (and show the "type a username" hint). Test Plan: - Typed `@`, no completer. - Typed `d`, got completer. - Typed delete, still had completer, now showing hint prompt. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10163 Differential Revision: https://secure.phabricator.com/D15037
This commit is contained in:
parent
4f3a9a8aca
commit
14ebf662f3
2 changed files with 33 additions and 14 deletions
|
@ -507,7 +507,7 @@ return array(
|
|||
'rsrc/js/phui/behavior-phui-object-box-tabs.js' => '2bfa2836',
|
||||
'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8',
|
||||
'rsrc/js/phuix/PHUIXActionView.js' => '8cf6d262',
|
||||
'rsrc/js/phuix/PHUIXAutocomplete.js' => '569edc21',
|
||||
'rsrc/js/phuix/PHUIXAutocomplete.js' => '377c9b3e',
|
||||
'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca',
|
||||
'rsrc/js/phuix/PHUIXFormControl.js' => '8fba1997',
|
||||
'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b',
|
||||
|
@ -836,7 +836,7 @@ return array(
|
|||
'phui-workpanel-view-css' => 'adec7699',
|
||||
'phuix-action-list-view' => 'b5c256b8',
|
||||
'phuix-action-view' => '8cf6d262',
|
||||
'phuix-autocomplete' => '569edc21',
|
||||
'phuix-autocomplete' => '377c9b3e',
|
||||
'phuix-dropdown-menu' => 'bd4c8dca',
|
||||
'phuix-form-control-view' => '8fba1997',
|
||||
'phuix-icon-view' => 'bff6884b',
|
||||
|
@ -1064,6 +1064,12 @@ return array(
|
|||
'javelin-vector',
|
||||
'phuix-autocomplete',
|
||||
),
|
||||
'377c9b3e' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'phuix-icon-view',
|
||||
'phabricator-prefab',
|
||||
),
|
||||
'3ab51e2c' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-behavior-device',
|
||||
|
@ -1204,12 +1210,6 @@ return array(
|
|||
'javelin-vector',
|
||||
'javelin-dom',
|
||||
),
|
||||
'569edc21' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
'phuix-icon-view',
|
||||
'phabricator-prefab',
|
||||
),
|
||||
'56a1ca03' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-behavior-device',
|
||||
|
|
|
@ -32,6 +32,9 @@ JX.install('PHUIXAutocomplete', {
|
|||
_focus: null,
|
||||
_focusRef: null,
|
||||
_listNodes: null,
|
||||
_x: null,
|
||||
_y: null,
|
||||
_visible: false,
|
||||
|
||||
setArea: function(area) {
|
||||
this._area = area;
|
||||
|
@ -186,6 +189,7 @@ JX.install('PHUIXAutocomplete', {
|
|||
JX.DOM.hide(node);
|
||||
|
||||
this._active = false;
|
||||
this._visible = false;
|
||||
},
|
||||
|
||||
_onkeypress: function(e) {
|
||||
|
@ -412,18 +416,33 @@ JX.install('PHUIXAutocomplete', {
|
|||
|
||||
this._datasource.didChange(trim);
|
||||
|
||||
var node = this._getNode();
|
||||
node.style.left = x + 'px';
|
||||
node.style.top = y + 'px';
|
||||
JX.DOM.show(node);
|
||||
this._x = x;
|
||||
this._y = y;
|
||||
|
||||
var echo = this._getEchoNode();
|
||||
var hint = trim;
|
||||
if (!hint.length) {
|
||||
if (hint.length) {
|
||||
// We only show the autocompleter after the user types at least one
|
||||
// character. For example, "@" does not trigger it, but "@d" does.
|
||||
this._visible = true;
|
||||
} else {
|
||||
hint = this._getSpec().hintText;
|
||||
}
|
||||
|
||||
var echo = this._getEchoNode();
|
||||
JX.DOM.setContent(echo, hint);
|
||||
|
||||
this._redraw();
|
||||
},
|
||||
|
||||
_redraw: function() {
|
||||
if (!this._visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
var node = this._getNode();
|
||||
node.style.left = this._x + 'px';
|
||||
node.style.top = this._y + 'px';
|
||||
JX.DOM.show(node);
|
||||
},
|
||||
|
||||
_autocomplete: function() {
|
||||
|
|
Loading…
Add table
Reference in a new issue