1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Phtize phabricator-remarkup-assist

Test Plan: Translated 'bold text' as 'txt', clicked on B without selection, saw 'txt'.

CC: epriestley, aran

Differential Revision: https://secure.phabricator.com/D7335
This commit is contained in:
Jakub Vrana 2013-10-16 19:01:23 -07:00
parent a9a3bdf3cc
commit 07b8c2cfd0
3 changed files with 64 additions and 50 deletions

View file

@ -2147,16 +2147,17 @@ celerity_register_resource_map(array(
),
'javelin-behavior-phabricator-remarkup-assist' =>
array(
'uri' => '/res/c3f4439f/rsrc/js/core/behavior-phabricator-remarkup-assist.js',
'uri' => '/res/1d8dab1f/rsrc/js/core/behavior-phabricator-remarkup-assist.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-stratcom',
2 => 'javelin-dom',
3 => 'phabricator-textareautils',
4 => 'javelin-workflow',
5 => 'javelin-vector',
3 => 'phabricator-phtize',
4 => 'phabricator-textareautils',
5 => 'javelin-workflow',
6 => 'javelin-vector',
),
'disk' => '/rsrc/js/core/behavior-phabricator-remarkup-assist.js',
),
@ -4324,7 +4325,7 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/a4e76ef8/core.pkg.css',
'type' => 'css',
),
'adee86d9' =>
'6041c6c8' =>
array(
'name' => 'core.pkg.js',
'symbols' =>
@ -4369,7 +4370,7 @@ celerity_register_resource_map(array(
37 => 'javelin-color',
38 => 'javelin-fx',
),
'uri' => '/res/pkg/adee86d9/core.pkg.js',
'uri' => '/res/pkg/6041c6c8/core.pkg.js',
'type' => 'js',
),
'4ccfeb47' =>
@ -4537,16 +4538,16 @@ celerity_register_resource_map(array(
'diffusion-icons-css' => '270f4eb4',
'global-drag-and-drop-css' => 'a4e76ef8',
'inline-comment-summary-css' => '7cd7e387',
'javelin-aphlict' => 'adee86d9',
'javelin-aphlict' => '6041c6c8',
'javelin-behavior' => '3e3be199',
'javelin-behavior-aphlict-dropdown' => 'adee86d9',
'javelin-behavior-aphlict-listen' => 'adee86d9',
'javelin-behavior-aphront-basic-tokenizer' => 'adee86d9',
'javelin-behavior-aphlict-dropdown' => '6041c6c8',
'javelin-behavior-aphlict-listen' => '6041c6c8',
'javelin-behavior-aphront-basic-tokenizer' => '6041c6c8',
'javelin-behavior-aphront-drag-and-drop-textarea' => '5e9e5c4e',
'javelin-behavior-aphront-form-disable-on-submit' => 'adee86d9',
'javelin-behavior-aphront-form-disable-on-submit' => '6041c6c8',
'javelin-behavior-audit-preview' => '96909266',
'javelin-behavior-dark-console' => '4ccfeb47',
'javelin-behavior-device' => 'adee86d9',
'javelin-behavior-device' => '6041c6c8',
'javelin-behavior-differential-accept-with-errors' => '5e9e5c4e',
'javelin-behavior-differential-add-reviewers-and-ccs' => '5e9e5c4e',
'javelin-behavior-differential-comment-jump' => '5e9e5c4e',
@ -4562,37 +4563,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' => 'adee86d9',
'javelin-behavior-history-install' => 'adee86d9',
'javelin-behavior-konami' => 'adee86d9',
'javelin-behavior-lightbox-attachments' => 'adee86d9',
'javelin-behavior-global-drag-and-drop' => '6041c6c8',
'javelin-behavior-history-install' => '6041c6c8',
'javelin-behavior-konami' => '6041c6c8',
'javelin-behavior-lightbox-attachments' => '6041c6c8',
'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' => 'adee86d9',
'javelin-behavior-phabricator-autofocus' => 'adee86d9',
'javelin-behavior-phabricator-gesture' => 'adee86d9',
'javelin-behavior-phabricator-hovercards' => 'adee86d9',
'javelin-behavior-phabricator-keyboard-shortcuts' => 'adee86d9',
'javelin-behavior-phabricator-nav' => 'adee86d9',
'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-object-selector' => '5e9e5c4e',
'javelin-behavior-phabricator-oncopy' => 'adee86d9',
'javelin-behavior-phabricator-remarkup-assist' => 'adee86d9',
'javelin-behavior-phabricator-reveal-content' => 'adee86d9',
'javelin-behavior-phabricator-search-typeahead' => 'adee86d9',
'javelin-behavior-phabricator-tooltips' => 'adee86d9',
'javelin-behavior-phabricator-watch-anchor' => 'adee86d9',
'javelin-behavior-refresh-csrf' => 'adee86d9',
'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-repository-crossreference' => '5e9e5c4e',
'javelin-behavior-toggle-class' => 'adee86d9',
'javelin-behavior-workflow' => 'adee86d9',
'javelin-color' => 'adee86d9',
'javelin-behavior-toggle-class' => '6041c6c8',
'javelin-behavior-workflow' => '6041c6c8',
'javelin-color' => '6041c6c8',
'javelin-dom' => '3e3be199',
'javelin-event' => '3e3be199',
'javelin-fx' => 'adee86d9',
'javelin-fx' => '6041c6c8',
'javelin-history' => '3e3be199',
'javelin-install' => '3e3be199',
'javelin-json' => '3e3be199',
@ -4614,36 +4615,36 @@ celerity_register_resource_map(array(
'maniphest-task-summary-css' => '49898640',
'phabricator-action-list-view-css' => 'a4e76ef8',
'phabricator-application-launch-view-css' => 'a4e76ef8',
'phabricator-busy' => 'adee86d9',
'phabricator-busy' => '6041c6c8',
'phabricator-content-source-view-css' => '7cd7e387',
'phabricator-core-css' => 'a4e76ef8',
'phabricator-crumbs-view-css' => 'a4e76ef8',
'phabricator-drag-and-drop-file-upload' => '5e9e5c4e',
'phabricator-dropdown-menu' => 'adee86d9',
'phabricator-file-upload' => 'adee86d9',
'phabricator-dropdown-menu' => '6041c6c8',
'phabricator-file-upload' => '6041c6c8',
'phabricator-filetree-view-css' => 'a4e76ef8',
'phabricator-flag-css' => 'a4e76ef8',
'phabricator-hovercard' => 'adee86d9',
'phabricator-hovercard' => '6041c6c8',
'phabricator-jump-nav' => 'a4e76ef8',
'phabricator-keyboard-shortcut' => 'adee86d9',
'phabricator-keyboard-shortcut-manager' => 'adee86d9',
'phabricator-keyboard-shortcut' => '6041c6c8',
'phabricator-keyboard-shortcut-manager' => '6041c6c8',
'phabricator-main-menu-view' => 'a4e76ef8',
'phabricator-menu-item' => 'adee86d9',
'phabricator-menu-item' => '6041c6c8',
'phabricator-nav-view-css' => 'a4e76ef8',
'phabricator-notification' => 'adee86d9',
'phabricator-notification' => '6041c6c8',
'phabricator-notification-css' => 'a4e76ef8',
'phabricator-notification-menu-css' => 'a4e76ef8',
'phabricator-object-selector-css' => '7cd7e387',
'phabricator-phtize' => 'adee86d9',
'phabricator-prefab' => 'adee86d9',
'phabricator-phtize' => '6041c6c8',
'phabricator-prefab' => '6041c6c8',
'phabricator-project-tag-css' => '49898640',
'phabricator-remarkup-css' => 'a4e76ef8',
'phabricator-shaped-request' => '5e9e5c4e',
'phabricator-side-menu-view-css' => 'a4e76ef8',
'phabricator-standard-page-view' => 'a4e76ef8',
'phabricator-tag-view-css' => 'a4e76ef8',
'phabricator-textareautils' => 'adee86d9',
'phabricator-tooltip' => 'adee86d9',
'phabricator-textareautils' => '6041c6c8',
'phabricator-tooltip' => '6041c6c8',
'phabricator-transaction-view-css' => 'a4e76ef8',
'phabricator-zindex-css' => 'a4e76ef8',
'phui-button-css' => 'a4e76ef8',

View file

@ -19,6 +19,16 @@ final class Javelin {
'Configure Editor' => pht('Configure Editor'),
);
break;
case 'phabricator-remarkup-assist':
$config['pht'] = array(
'bold text' => pht('bold text'),
'italic text' => pht('italic text'),
'monospaced text' => pht('monospaced text'),
'List Item' => pht('List Item'),
'data' => pht('data'),
);
break;
}
$response = CelerityAPI::getStaticResourceResponse();

View file

@ -3,12 +3,14 @@
* @requires javelin-behavior
* javelin-stratcom
* javelin-dom
* phabricator-phtize
* phabricator-textareautils
* javelin-workflow
* javelin-vector
*/
JX.behavior('phabricator-remarkup-assist', function(config) {
var pht = JX.phtize(config.pht);
var edit_mode = 'normal';
var edit_root = null;
@ -100,13 +102,13 @@ JX.behavior('phabricator-remarkup-assist', function(config) {
switch (action) {
case 'b':
update(area, '**', sel || 'bold text', '**');
update(area, '**', sel || pht('bold text'), '**');
break;
case 'i':
update(area, '//', sel || 'italic text', '//');
update(area, '//', sel || pht('italic text'), '//');
break;
case 'tt':
update(area, '`', sel || 'monospaced text', '`');
update(area, '`', sel || pht('monospaced text'), '`');
break;
case 'ul':
case 'ol':
@ -114,7 +116,7 @@ JX.behavior('phabricator-remarkup-assist', function(config) {
if (sel) {
sel = sel.split("\n");
} else {
sel = ["List Item"];
sel = [pht('List Item')];
}
sel = sel.join("\n" + ch);
update(area, ((r.start === 0) ? "" : "\n\n") + ch, sel, "\n\n");
@ -126,7 +128,8 @@ JX.behavior('phabricator-remarkup-assist', function(config) {
update(area, ((r.start === 0) ? "" : "\n\n"), sel, "\n\n");
break;
case 'table':
update(area, (r.start === 0 ? '' : '\n\n') + '| ', sel || 'data', ' |');
var prefix = (r.start === 0 ? '' : '\n\n');
update(area, prefix + '| ', sel || pht('data'), ' |');
break;
case 'meme':
new JX.Workflow('/macro/meme/create/')