From 82e57ab8a76d52199485cd587d8a5c7046391a50 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Wed, 16 Oct 2013 19:06:30 -0700 Subject: [PATCH] Add Link button to Remarkup assist Summary: Believe it or not, I forgot how to create a link in Remarkup. Test Plan: Clicked on it with selected URL, selected text and without a selection. Reviewers: chad, epriestley Reviewed By: epriestley CC: epriestley, aran, chad Differential Revision: https://secure.phabricator.com/D7336 --- resources/sprite/manifest/icons.json | 2 +- src/__celerity_resource_map__.php | 176 +++++++++--------- src/infrastructure/javelin/Javelin.php | 2 + .../control/PhabricatorRemarkupControl.php | 3 + webroot/rsrc/css/sprite-icons.css | 2 +- .../behavior-phabricator-remarkup-assist.js | 8 + 6 files changed, 103 insertions(+), 90 deletions(-) diff --git a/resources/sprite/manifest/icons.json b/resources/sprite/manifest/icons.json index 80a9ecb15a..b2f94e2462 100644 --- a/resources/sprite/manifest/icons.json +++ b/resources/sprite/manifest/icons.json @@ -1098,7 +1098,7 @@ }, "remarkup-assist-link" : { "name" : "remarkup-assist-link", - "rule" : ".remarkup-assist-", + "rule" : ".remarkup-assist-link", "hash" : "14fd38c00e80b6f4823ac543a96e63c2" }, "remarkup-assist-text_b" : { diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 8f90048877..c54314f0f8 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -2171,7 +2171,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-phabricator-remarkup-assist' => array( - 'uri' => '/res/1d8dab1f/rsrc/js/core/behavior-phabricator-remarkup-assist.js', + 'uri' => '/res/4153e95f/rsrc/js/core/behavior-phabricator-remarkup-assist.js', 'type' => 'js', 'requires' => array( @@ -4206,7 +4206,7 @@ celerity_register_resource_map(array( ), 'sprite-icons-css' => array( - 'uri' => '/res/612d8282/rsrc/css/sprite-icons.css', + 'uri' => '/res/b195fb94/rsrc/css/sprite-icons.css', 'type' => 'css', 'requires' => array( @@ -4297,7 +4297,7 @@ celerity_register_resource_map(array( ), array( 'packages' => array( - '966cb676' => + '7a1959db' => array( 'name' => 'core.pkg.css', 'symbols' => @@ -4346,10 +4346,10 @@ celerity_register_resource_map(array( 41 => 'phabricator-tag-view-css', 42 => 'phui-list-view-css', ), - 'uri' => '/res/pkg/966cb676/core.pkg.css', + 'uri' => '/res/pkg/7a1959db/core.pkg.css', 'type' => 'css', ), - '6041c6c8' => + '2c1dba03' => array( 'name' => 'core.pkg.js', 'symbols' => @@ -4394,7 +4394,7 @@ celerity_register_resource_map(array( 37 => 'javelin-color', 38 => 'javelin-fx', ), - 'uri' => '/res/pkg/6041c6c8/core.pkg.js', + 'uri' => '/res/pkg/2c1dba03/core.pkg.js', 'type' => 'js', ), '4ccfeb47' => @@ -4538,15 +4538,15 @@ celerity_register_resource_map(array( ), 'reverse' => array( - 'aphront-dialog-view-css' => '966cb676', - 'aphront-error-view-css' => '966cb676', - 'aphront-list-filter-view-css' => '966cb676', - 'aphront-pager-view-css' => '966cb676', - 'aphront-panel-view-css' => '966cb676', - 'aphront-table-view-css' => '966cb676', - 'aphront-tokenizer-control-css' => '966cb676', - 'aphront-tooltip-css' => '966cb676', - 'aphront-typeahead-control-css' => '966cb676', + 'aphront-dialog-view-css' => '7a1959db', + 'aphront-error-view-css' => '7a1959db', + 'aphront-list-filter-view-css' => '7a1959db', + 'aphront-pager-view-css' => '7a1959db', + 'aphront-panel-view-css' => '7a1959db', + 'aphront-table-view-css' => '7a1959db', + 'aphront-tokenizer-control-css' => '7a1959db', + 'aphront-tooltip-css' => '7a1959db', + 'aphront-typeahead-control-css' => '7a1959db', 'differential-changeset-view-css' => '7cd7e387', 'differential-core-view-css' => '7cd7e387', 'differential-inline-comment-editor' => '5e9e5c4e', @@ -4560,18 +4560,18 @@ celerity_register_resource_map(array( 'differential-table-of-contents-css' => '7cd7e387', 'diffusion-commit-view-css' => '270f4eb4', 'diffusion-icons-css' => '270f4eb4', - 'global-drag-and-drop-css' => '966cb676', + 'global-drag-and-drop-css' => '7a1959db', 'inline-comment-summary-css' => '7cd7e387', - 'javelin-aphlict' => '6041c6c8', + 'javelin-aphlict' => '2c1dba03', 'javelin-behavior' => '3e3be199', - 'javelin-behavior-aphlict-dropdown' => '6041c6c8', - 'javelin-behavior-aphlict-listen' => '6041c6c8', - 'javelin-behavior-aphront-basic-tokenizer' => '6041c6c8', + 'javelin-behavior-aphlict-dropdown' => '2c1dba03', + 'javelin-behavior-aphlict-listen' => '2c1dba03', + 'javelin-behavior-aphront-basic-tokenizer' => '2c1dba03', 'javelin-behavior-aphront-drag-and-drop-textarea' => '5e9e5c4e', - 'javelin-behavior-aphront-form-disable-on-submit' => '6041c6c8', + 'javelin-behavior-aphront-form-disable-on-submit' => '2c1dba03', 'javelin-behavior-audit-preview' => '96909266', 'javelin-behavior-dark-console' => '4ccfeb47', - 'javelin-behavior-device' => '6041c6c8', + 'javelin-behavior-device' => '2c1dba03', 'javelin-behavior-differential-accept-with-errors' => '5e9e5c4e', 'javelin-behavior-differential-add-reviewers-and-ccs' => '5e9e5c4e', 'javelin-behavior-differential-comment-jump' => '5e9e5c4e', @@ -4587,37 +4587,37 @@ celerity_register_resource_map(array( 'javelin-behavior-diffusion-commit-graph' => '96909266', 'javelin-behavior-diffusion-pull-lastmodified' => '96909266', 'javelin-behavior-error-log' => '4ccfeb47', - 'javelin-behavior-global-drag-and-drop' => '6041c6c8', - 'javelin-behavior-history-install' => '6041c6c8', - 'javelin-behavior-konami' => '6041c6c8', - 'javelin-behavior-lightbox-attachments' => '6041c6c8', + 'javelin-behavior-global-drag-and-drop' => '2c1dba03', + 'javelin-behavior-history-install' => '2c1dba03', + 'javelin-behavior-konami' => '2c1dba03', + 'javelin-behavior-lightbox-attachments' => '2c1dba03', 'javelin-behavior-load-blame' => '5e9e5c4e', 'javelin-behavior-maniphest-batch-selector' => '0a694954', 'javelin-behavior-maniphest-subpriority-editor' => '0a694954', 'javelin-behavior-maniphest-transaction-controls' => '0a694954', 'javelin-behavior-maniphest-transaction-expand' => '0a694954', 'javelin-behavior-maniphest-transaction-preview' => '0a694954', - 'javelin-behavior-phabricator-active-nav' => '6041c6c8', - 'javelin-behavior-phabricator-autofocus' => '6041c6c8', - 'javelin-behavior-phabricator-gesture' => '6041c6c8', - 'javelin-behavior-phabricator-hovercards' => '6041c6c8', - 'javelin-behavior-phabricator-keyboard-shortcuts' => '6041c6c8', - 'javelin-behavior-phabricator-nav' => '6041c6c8', + 'javelin-behavior-phabricator-active-nav' => '2c1dba03', + 'javelin-behavior-phabricator-autofocus' => '2c1dba03', + 'javelin-behavior-phabricator-gesture' => '2c1dba03', + 'javelin-behavior-phabricator-hovercards' => '2c1dba03', + 'javelin-behavior-phabricator-keyboard-shortcuts' => '2c1dba03', + 'javelin-behavior-phabricator-nav' => '2c1dba03', 'javelin-behavior-phabricator-object-selector' => '5e9e5c4e', - 'javelin-behavior-phabricator-oncopy' => '6041c6c8', - 'javelin-behavior-phabricator-remarkup-assist' => '6041c6c8', - 'javelin-behavior-phabricator-reveal-content' => '6041c6c8', - 'javelin-behavior-phabricator-search-typeahead' => '6041c6c8', - 'javelin-behavior-phabricator-tooltips' => '6041c6c8', - 'javelin-behavior-phabricator-watch-anchor' => '6041c6c8', - 'javelin-behavior-refresh-csrf' => '6041c6c8', + 'javelin-behavior-phabricator-oncopy' => '2c1dba03', + 'javelin-behavior-phabricator-remarkup-assist' => '2c1dba03', + 'javelin-behavior-phabricator-reveal-content' => '2c1dba03', + 'javelin-behavior-phabricator-search-typeahead' => '2c1dba03', + 'javelin-behavior-phabricator-tooltips' => '2c1dba03', + 'javelin-behavior-phabricator-watch-anchor' => '2c1dba03', + 'javelin-behavior-refresh-csrf' => '2c1dba03', 'javelin-behavior-repository-crossreference' => '5e9e5c4e', - 'javelin-behavior-toggle-class' => '6041c6c8', - 'javelin-behavior-workflow' => '6041c6c8', - 'javelin-color' => '6041c6c8', + 'javelin-behavior-toggle-class' => '2c1dba03', + 'javelin-behavior-workflow' => '2c1dba03', + 'javelin-color' => '2c1dba03', 'javelin-dom' => '3e3be199', 'javelin-event' => '3e3be199', - 'javelin-fx' => '6041c6c8', + 'javelin-fx' => '2c1dba03', 'javelin-history' => '3e3be199', 'javelin-install' => '3e3be199', 'javelin-json' => '3e3be199', @@ -4635,56 +4635,56 @@ celerity_register_resource_map(array( 'javelin-util' => '3e3be199', 'javelin-vector' => '3e3be199', 'javelin-workflow' => '3e3be199', - 'lightbox-attachment-css' => '966cb676', + 'lightbox-attachment-css' => '7a1959db', 'maniphest-task-summary-css' => '49898640', - 'phabricator-action-list-view-css' => '966cb676', - 'phabricator-application-launch-view-css' => '966cb676', - 'phabricator-busy' => '6041c6c8', + 'phabricator-action-list-view-css' => '7a1959db', + 'phabricator-application-launch-view-css' => '7a1959db', + 'phabricator-busy' => '2c1dba03', 'phabricator-content-source-view-css' => '7cd7e387', - 'phabricator-core-css' => '966cb676', - 'phabricator-crumbs-view-css' => '966cb676', + 'phabricator-core-css' => '7a1959db', + 'phabricator-crumbs-view-css' => '7a1959db', 'phabricator-drag-and-drop-file-upload' => '5e9e5c4e', - 'phabricator-dropdown-menu' => '6041c6c8', - 'phabricator-file-upload' => '6041c6c8', - 'phabricator-filetree-view-css' => '966cb676', - 'phabricator-flag-css' => '966cb676', - 'phabricator-hovercard' => '6041c6c8', - 'phabricator-jump-nav' => '966cb676', - 'phabricator-keyboard-shortcut' => '6041c6c8', - 'phabricator-keyboard-shortcut-manager' => '6041c6c8', - 'phabricator-main-menu-view' => '966cb676', - 'phabricator-menu-item' => '6041c6c8', - 'phabricator-nav-view-css' => '966cb676', - 'phabricator-notification' => '6041c6c8', - 'phabricator-notification-css' => '966cb676', - 'phabricator-notification-menu-css' => '966cb676', + 'phabricator-dropdown-menu' => '2c1dba03', + 'phabricator-file-upload' => '2c1dba03', + 'phabricator-filetree-view-css' => '7a1959db', + 'phabricator-flag-css' => '7a1959db', + 'phabricator-hovercard' => '2c1dba03', + 'phabricator-jump-nav' => '7a1959db', + 'phabricator-keyboard-shortcut' => '2c1dba03', + 'phabricator-keyboard-shortcut-manager' => '2c1dba03', + 'phabricator-main-menu-view' => '7a1959db', + 'phabricator-menu-item' => '2c1dba03', + 'phabricator-nav-view-css' => '7a1959db', + 'phabricator-notification' => '2c1dba03', + 'phabricator-notification-css' => '7a1959db', + 'phabricator-notification-menu-css' => '7a1959db', 'phabricator-object-selector-css' => '7cd7e387', - 'phabricator-phtize' => '6041c6c8', - 'phabricator-prefab' => '6041c6c8', + 'phabricator-phtize' => '2c1dba03', + 'phabricator-prefab' => '2c1dba03', 'phabricator-project-tag-css' => '49898640', - 'phabricator-remarkup-css' => '966cb676', + 'phabricator-remarkup-css' => '7a1959db', 'phabricator-shaped-request' => '5e9e5c4e', - 'phabricator-side-menu-view-css' => '966cb676', - 'phabricator-standard-page-view' => '966cb676', - 'phabricator-tag-view-css' => '966cb676', - 'phabricator-textareautils' => '6041c6c8', - 'phabricator-tooltip' => '6041c6c8', - 'phabricator-transaction-view-css' => '966cb676', - 'phabricator-zindex-css' => '966cb676', - 'phui-button-css' => '966cb676', - 'phui-form-css' => '966cb676', - 'phui-form-view-css' => '966cb676', - 'phui-header-view-css' => '966cb676', - 'phui-icon-view-css' => '966cb676', - 'phui-list-view-css' => '966cb676', - 'phui-object-item-list-view-css' => '966cb676', - 'phui-property-list-view-css' => '966cb676', - 'phui-spacing-css' => '966cb676', - 'sprite-apps-large-css' => '966cb676', - 'sprite-gradient-css' => '966cb676', - 'sprite-icons-css' => '966cb676', - 'sprite-menu-css' => '966cb676', - 'sprite-status-css' => '966cb676', - 'syntax-highlighting-css' => '966cb676', + 'phabricator-side-menu-view-css' => '7a1959db', + 'phabricator-standard-page-view' => '7a1959db', + 'phabricator-tag-view-css' => '7a1959db', + 'phabricator-textareautils' => '2c1dba03', + 'phabricator-tooltip' => '2c1dba03', + 'phabricator-transaction-view-css' => '7a1959db', + 'phabricator-zindex-css' => '7a1959db', + 'phui-button-css' => '7a1959db', + 'phui-form-css' => '7a1959db', + 'phui-form-view-css' => '7a1959db', + 'phui-header-view-css' => '7a1959db', + 'phui-icon-view-css' => '7a1959db', + 'phui-list-view-css' => '7a1959db', + 'phui-object-item-list-view-css' => '7a1959db', + 'phui-property-list-view-css' => '7a1959db', + 'phui-spacing-css' => '7a1959db', + 'sprite-apps-large-css' => '7a1959db', + 'sprite-gradient-css' => '7a1959db', + 'sprite-icons-css' => '7a1959db', + 'sprite-menu-css' => '7a1959db', + 'sprite-status-css' => '7a1959db', + 'syntax-highlighting-css' => '7a1959db', ), )); diff --git a/src/infrastructure/javelin/Javelin.php b/src/infrastructure/javelin/Javelin.php index 77420a5315..686f6e1c67 100644 --- a/src/infrastructure/javelin/Javelin.php +++ b/src/infrastructure/javelin/Javelin.php @@ -27,6 +27,8 @@ final class Javelin { 'monospaced text' => pht('monospaced text'), 'List Item' => pht('List Item'), 'data' => pht('data'), + 'name' => pht('name'), + 'URL' => pht('URL'), ); break; } diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index 67ff3ef548..7d873466df 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -40,6 +40,9 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { 'tt' => array( 'tip' => pht('Monospaced'), ), + 'link' => array( + 'tip' => pht('Link'), + ), array( 'spacer' => true, ), diff --git a/webroot/rsrc/css/sprite-icons.css b/webroot/rsrc/css/sprite-icons.css index 15f6727428..117df13bc7 100644 --- a/webroot/rsrc/css/sprite-icons.css +++ b/webroot/rsrc/css/sprite-icons.css @@ -894,7 +894,7 @@ only screen and (-webkit-min-device-pixel-ratio: 1.5) { background-position: -120px -210px; } -.remarkup-assist- { +.remarkup-assist-link { background-position: -135px -210px; } diff --git a/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js b/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js index 5bd8b91555..d67741f58e 100644 --- a/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js +++ b/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js @@ -107,6 +107,14 @@ JX.behavior('phabricator-remarkup-assist', function(config) { case 'i': update(area, '//', sel || pht('italic text'), '//'); break; + case 'link': + var name = pht('name'); + if (/^https?:/i.test(sel)) { + update(area, '[[ ' + sel + ' | ', name, ' ]]'); + } else { + update(area, '[[ ', pht('URL'), ' | ' + (sel || name) + ' ]]'); + } + break; case 'tt': update(area, '`', sel || pht('monospaced text'), '`'); break;