1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 07:20:57 +01:00

Suggest Phurl URLs on "((..." in Remarkup text areas

Summary: Depends on D19108. Ref T12241. Ref T13077. See D19108. This extends the `[[ ...` autocompleter to `((...` for Phurl URLs.

Test Plan: Typed `((th`, got `((thing))` suggested.

Reviewers: avivey

Reviewed By: avivey

Maniphest Tasks: T13077, T12241

Differential Revision: https://secure.phabricator.com/D19109
This commit is contained in:
epriestley 2018-02-16 09:37:13 -08:00
parent 8771b7d5c4
commit 0202c36b62
4 changed files with 27 additions and 9 deletions

View file

@ -528,7 +528,7 @@ return array(
'rsrc/js/phui/behavior-phui-tab-group.js' => '0a0b10e9',
'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8',
'rsrc/js/phuix/PHUIXActionView.js' => '442efd08',
'rsrc/js/phuix/PHUIXAutocomplete.js' => 'bb19ed2c',
'rsrc/js/phuix/PHUIXAutocomplete.js' => '623a766b',
'rsrc/js/phuix/PHUIXButtonView.js' => '8a91e1ac',
'rsrc/js/phuix/PHUIXDropdownMenu.js' => '04b2ae03',
'rsrc/js/phuix/PHUIXExample.js' => '68af71ca',
@ -881,7 +881,7 @@ return array(
'phui-workpanel-view-css' => 'a3a63478',
'phuix-action-list-view' => 'b5c256b8',
'phuix-action-view' => '442efd08',
'phuix-autocomplete' => 'bb19ed2c',
'phuix-autocomplete' => '623a766b',
'phuix-button-view' => '8a91e1ac',
'phuix-dropdown-menu' => '04b2ae03',
'phuix-form-control-view' => '16ad6224',
@ -1407,6 +1407,12 @@ return array(
'javelin-magical-init',
'javelin-util',
),
'623a766b' => array(
'javelin-install',
'javelin-dom',
'phuix-icon-view',
'phabricator-prefab',
),
'628f59de' => array(
'phui-oi-list-view-css',
),
@ -1868,12 +1874,6 @@ return array(
'javelin-uri',
'phabricator-notification',
),
'bb19ed2c' => array(
'javelin-install',
'javelin-dom',
'phuix-icon-view',
'phabricator-prefab',
),
'bcaccd64' => array(
'javelin-behavior',
'javelin-behavior-device',

View file

@ -24,6 +24,7 @@ final class PhabricatorPhurlURLDatasource
->setDisplayName($url->getName())
->setName($url->getName()." ".$url->getAlias())
->setPHID($url->getPHID())
->setAutocomplete('(('.$url->getAlias().'))')
->addAttribute($url->getLongURL());
$results[] = $result;

View file

@ -73,6 +73,7 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
));
$phriction_datasource = new PhrictionDocumentDatasource();
$phurl_datasource = new PhabricatorPhurlURLDatasource();
Javelin::initBehavior(
'phabricator-remarkup-assist',
@ -130,7 +131,17 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
'|',
']',
),
'prefix' => '^\\[*',
'prefix' => '^\\[',
),
40 => array( // "("
'datasourceURI' => $phurl_datasource->getDatasourceURI(),
'headerIcon' => 'fa-compress',
'headerText' => pht('Find Phurl:'),
'hintText' => $phurl_datasource->getPlaceholderText(),
'cancel' => array(
')',
),
'prefix' => '^\\(',
),
),
));

View file

@ -107,6 +107,12 @@ JX.install('PHUIXAutocomplete', {
prior = '<start>';
}
// If this is a repeating sequence and the previous character is the
// same as the one the user just typed, like "((", don't reactivate.
if (prior === String.fromCharCode(code)) {
return;
}
switch (prior) {
case '<start>':
case ' ':