@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+33 -14
+8 -8
resources/celerity/map.php
··· 507 507 'rsrc/js/phui/behavior-phui-object-box-tabs.js' => '2bfa2836', 508 508 'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8', 509 509 'rsrc/js/phuix/PHUIXActionView.js' => '8cf6d262', 510 - 'rsrc/js/phuix/PHUIXAutocomplete.js' => '569edc21', 510 + 'rsrc/js/phuix/PHUIXAutocomplete.js' => '377c9b3e', 511 511 'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca', 512 512 'rsrc/js/phuix/PHUIXFormControl.js' => '8fba1997', 513 513 'rsrc/js/phuix/PHUIXIconView.js' => 'bff6884b', ··· 836 836 'phui-workpanel-view-css' => 'adec7699', 837 837 'phuix-action-list-view' => 'b5c256b8', 838 838 'phuix-action-view' => '8cf6d262', 839 - 'phuix-autocomplete' => '569edc21', 839 + 'phuix-autocomplete' => '377c9b3e', 840 840 'phuix-dropdown-menu' => 'bd4c8dca', 841 841 'phuix-form-control-view' => '8fba1997', 842 842 'phuix-icon-view' => 'bff6884b', ··· 1064 1064 'javelin-vector', 1065 1065 'phuix-autocomplete', 1066 1066 ), 1067 + '377c9b3e' => array( 1068 + 'javelin-install', 1069 + 'javelin-dom', 1070 + 'phuix-icon-view', 1071 + 'phabricator-prefab', 1072 + ), 1067 1073 '3ab51e2c' => array( 1068 1074 'javelin-behavior', 1069 1075 'javelin-behavior-device', ··· 1203 1209 'javelin-behavior', 1204 1210 'javelin-vector', 1205 1211 'javelin-dom', 1206 - ), 1207 - '569edc21' => array( 1208 - 'javelin-install', 1209 - 'javelin-dom', 1210 - 'phuix-icon-view', 1211 - 'phabricator-prefab', 1212 1212 ), 1213 1213 '56a1ca03' => array( 1214 1214 'javelin-behavior',
+25 -6
webroot/rsrc/js/phuix/PHUIXAutocomplete.js
··· 32 32 _focus: null, 33 33 _focusRef: null, 34 34 _listNodes: null, 35 + _x: null, 36 + _y: null, 37 + _visible: false, 35 38 36 39 setArea: function(area) { 37 40 this._area = area; ··· 186 189 JX.DOM.hide(node); 187 190 188 191 this._active = false; 192 + this._visible = false; 189 193 }, 190 194 191 195 _onkeypress: function(e) { ··· 412 416 413 417 this._datasource.didChange(trim); 414 418 415 - var node = this._getNode(); 416 - node.style.left = x + 'px'; 417 - node.style.top = y + 'px'; 418 - JX.DOM.show(node); 419 + this._x = x; 420 + this._y = y; 419 421 420 - var echo = this._getEchoNode(); 421 422 var hint = trim; 422 - if (!hint.length) { 423 + if (hint.length) { 424 + // We only show the autocompleter after the user types at least one 425 + // character. For example, "@" does not trigger it, but "@d" does. 426 + this._visible = true; 427 + } else { 423 428 hint = this._getSpec().hintText; 424 429 } 425 430 431 + var echo = this._getEchoNode(); 426 432 JX.DOM.setContent(echo, hint); 433 + 434 + this._redraw(); 435 + }, 436 + 437 + _redraw: function() { 438 + if (!this._visible) { 439 + return; 440 + } 441 + 442 + var node = this._getNode(); 443 + node.style.left = this._x + 'px'; 444 + node.style.top = this._y + 'px'; 445 + JX.DOM.show(node); 427 446 }, 428 447 429 448 _autocomplete: function() {