@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.

Fix autocomplete/send-on-enter interactions

Summary:
Send-on-enter and autocomplete both listen for "return" keypresses, and could race. Have autocomplete let other handlers take a shot at the action before it does.

Also, fix a case where ":)" and the suffix list (which lets you type `someone is 100% to blame here (@epriestley)` and get the results you want) interacted badly, so ":)" cancels the autocompleter like ":3" does.

Test Plan:
- Typed "@xxx" and mashed return real fast over and over again while reloading the page. Before: sometimes handlers raced and text submitted. After: always handled by autocomplete behavior.
- Typed ":", ")", "<return>", sent an emoticon (previously: no).

Reviewers: chad, amckinley

Reviewed By: chad

Subscribers: xxx

Differential Revision: https://secure.phabricator.com/D17794

+14 -5
+7 -2
webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js
··· 393 393 return; 394 394 } 395 395 396 + // Let other listeners (particularly the inline autocomplete) have a 397 + // chance to handle this event. 398 + if (JX.Stratcom.pass()) { 399 + return; 400 + } 401 + 396 402 var raw = e.getRawEvent(); 397 403 if (raw.shiftKey) { 398 404 // If the shift key is pressed, let the browser write a newline into ··· 412 418 // This allows 'workflow' and similar actions to take effect. 413 419 // Such as pontificate in Conpherence 414 420 var form = e.getNode('tag:form'); 415 - var r = JX.DOM.invoke(form, 'didSyntheticSubmit'); 416 - 421 + JX.DOM.invoke(form, 'didSyntheticSubmit'); 417 422 }); 418 423 } 419 424
+7 -3
webroot/rsrc/js/phuix/PHUIXAutocomplete.js
··· 127 127 } 128 128 129 129 // Get all the text on the current line. If the line only contains 130 - // whitespace, don't actiavte: the user is probably typing code or a 130 + // whitespace, don't activate: the user is probably typing code or a 131 131 // numbered list. 132 132 var line = area.value.substring(0, head - 1); 133 133 line = line.split('\n'); ··· 454 454 455 455 // If the user hasn't typed any text yet after typing the character 456 456 // which can summon the autocomplete, deactivate and let the keystroke 457 - // through. For example, We hit this when a line ends with an 457 + // through. For example, we hit this when a line ends with an 458 458 // autocomplete character and the user is trying to type a newline. 459 459 if (range.start == this._cursorHead) { 460 460 this._deactivate(); ··· 529 529 } 530 530 } 531 531 532 + // Deactivate immediately if the user types an ignored token like ":)", 533 + // the smiley face emoticon. Note that we test against "text", not 534 + // "trim", because the ignore list and suffix list can otherwise 535 + // interact destructively. 532 536 var ignore = this._getIgnoreList(); 533 537 for (ii = 0; ii < ignore.length; ii++) { 534 - if (trim.indexOf(ignore[ii]) === 0) { 538 + if (text.indexOf(ignore[ii]) === 0) { 535 539 this._deactivate(); 536 540 return; 537 541 }