Implement order and chaos modes for Remarkup editing

Summary:
Ref T2599.

Implements an "order" mode which fullscreens the editor and reduces distractions, similar to Asana's "focus" mode and GitHub's "zen" mode. This can help users who need fewer distractions get work done.

Implements a "chaos" mode which does the opposite. This can help users who need more distractions to get work done.

Test Plan: Clicked "order" and "chaos" buttons.

Reviewers: chad, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2599

Differential Revision: https://secure.phabricator.com/D5735
This commit is contained in:
epriestley
2013-04-19 19:50:21 -07:00
parent f4ab0da50a
commit e6720bd6d6
28 changed files with 1077 additions and 838 deletions

View File

@@ -597,15 +597,15 @@ celerity_register_resource_map(array(
),
'/rsrc/image/sprite-icon-X2.png' =>
array(
'hash' => '4d4194cd569f25263e28ba2bf0160b2b',
'uri' => '/res/4d4194cd/rsrc/image/sprite-icon-X2.png',
'hash' => 'd9d7e2a4ede625d34e04877e836e6c38',
'uri' => '/res/d9d7e2a4/rsrc/image/sprite-icon-X2.png',
'disk' => '/rsrc/image/sprite-icon-X2.png',
'type' => 'png',
),
'/rsrc/image/sprite-icon.png' =>
array(
'hash' => 'b1f5ba8c544e25fd5fd7f7f2f827ccee',
'uri' => '/res/b1f5ba8c/rsrc/image/sprite-icon.png',
'hash' => '000c96ed6b43fbb26caec3ff2b13687f',
'uri' => '/res/000c96ed/rsrc/image/sprite-icon.png',
'disk' => '/rsrc/image/sprite-icon.png',
'type' => 'png',
),
@@ -1992,7 +1992,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-phabricator-remarkup-assist' =>
array(
'uri' => '/res/07406487/rsrc/js/application/core/behavior-phabricator-remarkup-assist.js',
'uri' => '/res/c1986694/rsrc/js/application/core/behavior-phabricator-remarkup-assist.js',
'type' => 'js',
'requires' =>
array(
@@ -2000,6 +2000,8 @@ celerity_register_resource_map(array(
1 => 'javelin-stratcom',
2 => 'javelin-dom',
3 => 'phabricator-textareautils',
4 => 'javelin-workflow',
5 => 'phabricator-notification',
),
'disk' => '/rsrc/js/application/core/behavior-phabricator-remarkup-assist.js',
),
@@ -3240,7 +3242,7 @@ celerity_register_resource_map(array(
),
'phabricator-remarkup-css' =>
array(
'uri' => '/res/06db5164/rsrc/css/core/remarkup.css',
'uri' => '/res/adef7cfa/rsrc/css/core/remarkup.css',
'type' => 'css',
'requires' =>
array(
@@ -3849,7 +3851,7 @@ celerity_register_resource_map(array(
),
'sprite-icon-css' =>
array(
'uri' => '/res/da3b861b/rsrc/css/sprite-icon.css',
'uri' => '/res/8261da31/rsrc/css/sprite-icon.css',
'type' => 'css',
'requires' =>
array(
@@ -3922,7 +3924,7 @@ celerity_register_resource_map(array(
), array(
'packages' =>
array(
'85d71a9b' =>
'53664e83' =>
array(
'name' => 'core.pkg.css',
'symbols' =>
@@ -3964,10 +3966,10 @@ celerity_register_resource_map(array(
34 => 'phabricator-object-item-list-view-css',
35 => 'global-drag-and-drop-css',
),
'uri' => '/res/pkg/85d71a9b/core.pkg.css',
'uri' => '/res/pkg/53664e83/core.pkg.css',
'type' => 'css',
),
'bf16b308' =>
'e32b785c' =>
array(
'name' => 'core.pkg.js',
'symbols' =>
@@ -4007,7 +4009,7 @@ celerity_register_resource_map(array(
32 => 'javelin-behavior-global-drag-and-drop',
33 => 'javelin-behavior-phabricator-reveal-content',
),
'uri' => '/res/pkg/bf16b308/core.pkg.js',
'uri' => '/res/pkg/e32b785c/core.pkg.js',
'type' => 'js',
),
'e208b108' =>
@@ -4154,16 +4156,16 @@ celerity_register_resource_map(array(
'reverse' =>
array(
'aphront-attached-file-view-css' => '6b1fccc6',
'aphront-dialog-view-css' => '85d71a9b',
'aphront-error-view-css' => '85d71a9b',
'aphront-form-view-css' => '85d71a9b',
'aphront-list-filter-view-css' => '85d71a9b',
'aphront-pager-view-css' => '85d71a9b',
'aphront-panel-view-css' => '85d71a9b',
'aphront-table-view-css' => '85d71a9b',
'aphront-tokenizer-control-css' => '85d71a9b',
'aphront-tooltip-css' => '85d71a9b',
'aphront-typeahead-control-css' => '85d71a9b',
'aphront-dialog-view-css' => '53664e83',
'aphront-error-view-css' => '53664e83',
'aphront-form-view-css' => '53664e83',
'aphront-list-filter-view-css' => '53664e83',
'aphront-pager-view-css' => '53664e83',
'aphront-panel-view-css' => '53664e83',
'aphront-table-view-css' => '53664e83',
'aphront-tokenizer-control-css' => '53664e83',
'aphront-tooltip-css' => '53664e83',
'aphront-typeahead-control-css' => '53664e83',
'differential-changeset-view-css' => '8aaacd1b',
'differential-core-view-css' => '8aaacd1b',
'differential-inline-comment-editor' => 'e96b08f8',
@@ -4177,19 +4179,19 @@ celerity_register_resource_map(array(
'differential-table-of-contents-css' => '8aaacd1b',
'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88',
'global-drag-and-drop-css' => '85d71a9b',
'global-drag-and-drop-css' => '53664e83',
'inline-comment-summary-css' => '8aaacd1b',
'javelin-aphlict' => 'bf16b308',
'javelin-aphlict' => 'e32b785c',
'javelin-behavior' => '41f3916d',
'javelin-behavior-aphlict-dropdown' => 'bf16b308',
'javelin-behavior-aphlict-listen' => 'bf16b308',
'javelin-behavior-aphront-basic-tokenizer' => 'bf16b308',
'javelin-behavior-aphlict-dropdown' => 'e32b785c',
'javelin-behavior-aphlict-listen' => 'e32b785c',
'javelin-behavior-aphront-basic-tokenizer' => 'e32b785c',
'javelin-behavior-aphront-drag-and-drop' => 'e96b08f8',
'javelin-behavior-aphront-drag-and-drop-textarea' => 'e96b08f8',
'javelin-behavior-aphront-form-disable-on-submit' => 'bf16b308',
'javelin-behavior-aphront-form-disable-on-submit' => 'e32b785c',
'javelin-behavior-audit-preview' => 'f96657b8',
'javelin-behavior-dark-console' => 'e208b108',
'javelin-behavior-device' => 'bf16b308',
'javelin-behavior-device' => 'e32b785c',
'javelin-behavior-differential-accept-with-errors' => 'e96b08f8',
'javelin-behavior-differential-add-reviewers-and-ccs' => 'e96b08f8',
'javelin-behavior-differential-comment-jump' => 'e96b08f8',
@@ -4205,32 +4207,32 @@ celerity_register_resource_map(array(
'javelin-behavior-diffusion-commit-graph' => 'f96657b8',
'javelin-behavior-diffusion-pull-lastmodified' => 'f96657b8',
'javelin-behavior-error-log' => 'e208b108',
'javelin-behavior-global-drag-and-drop' => 'bf16b308',
'javelin-behavior-history-install' => 'bf16b308',
'javelin-behavior-konami' => 'bf16b308',
'javelin-behavior-lightbox-attachments' => 'bf16b308',
'javelin-behavior-global-drag-and-drop' => 'e32b785c',
'javelin-behavior-history-install' => 'e32b785c',
'javelin-behavior-konami' => 'e32b785c',
'javelin-behavior-lightbox-attachments' => 'e32b785c',
'javelin-behavior-load-blame' => 'e96b08f8',
'javelin-behavior-maniphest-batch-selector' => 'f85eb6d8',
'javelin-behavior-maniphest-subpriority-editor' => 'f85eb6d8',
'javelin-behavior-maniphest-transaction-controls' => 'f85eb6d8',
'javelin-behavior-maniphest-transaction-expand' => 'f85eb6d8',
'javelin-behavior-maniphest-transaction-preview' => 'f85eb6d8',
'javelin-behavior-phabricator-active-nav' => 'bf16b308',
'javelin-behavior-phabricator-autofocus' => 'bf16b308',
'javelin-behavior-phabricator-gesture' => 'bf16b308',
'javelin-behavior-phabricator-keyboard-shortcuts' => 'bf16b308',
'javelin-behavior-phabricator-nav' => 'bf16b308',
'javelin-behavior-phabricator-active-nav' => 'e32b785c',
'javelin-behavior-phabricator-autofocus' => 'e32b785c',
'javelin-behavior-phabricator-gesture' => 'e32b785c',
'javelin-behavior-phabricator-keyboard-shortcuts' => 'e32b785c',
'javelin-behavior-phabricator-nav' => 'e32b785c',
'javelin-behavior-phabricator-object-selector' => 'e96b08f8',
'javelin-behavior-phabricator-oncopy' => 'bf16b308',
'javelin-behavior-phabricator-remarkup-assist' => 'bf16b308',
'javelin-behavior-phabricator-reveal-content' => 'bf16b308',
'javelin-behavior-phabricator-search-typeahead' => 'bf16b308',
'javelin-behavior-phabricator-tooltips' => 'bf16b308',
'javelin-behavior-phabricator-watch-anchor' => 'bf16b308',
'javelin-behavior-refresh-csrf' => 'bf16b308',
'javelin-behavior-phabricator-oncopy' => 'e32b785c',
'javelin-behavior-phabricator-remarkup-assist' => 'e32b785c',
'javelin-behavior-phabricator-reveal-content' => 'e32b785c',
'javelin-behavior-phabricator-search-typeahead' => 'e32b785c',
'javelin-behavior-phabricator-tooltips' => 'e32b785c',
'javelin-behavior-phabricator-watch-anchor' => 'e32b785c',
'javelin-behavior-refresh-csrf' => 'e32b785c',
'javelin-behavior-repository-crossreference' => 'e96b08f8',
'javelin-behavior-toggle-class' => 'bf16b308',
'javelin-behavior-workflow' => 'bf16b308',
'javelin-behavior-toggle-class' => 'e32b785c',
'javelin-behavior-workflow' => 'e32b785c',
'javelin-dom' => '41f3916d',
'javelin-event' => '41f3916d',
'javelin-install' => '41f3916d',
@@ -4249,47 +4251,47 @@ celerity_register_resource_map(array(
'javelin-util' => '41f3916d',
'javelin-vector' => '41f3916d',
'javelin-workflow' => '41f3916d',
'lightbox-attachment-css' => '85d71a9b',
'lightbox-attachment-css' => '53664e83',
'maniphest-task-summary-css' => '6b1fccc6',
'maniphest-transaction-detail-css' => '6b1fccc6',
'phabricator-busy' => 'bf16b308',
'phabricator-busy' => 'e32b785c',
'phabricator-content-source-view-css' => '8aaacd1b',
'phabricator-core-buttons-css' => '85d71a9b',
'phabricator-core-css' => '85d71a9b',
'phabricator-crumbs-view-css' => '85d71a9b',
'phabricator-directory-css' => '85d71a9b',
'phabricator-core-buttons-css' => '53664e83',
'phabricator-core-css' => '53664e83',
'phabricator-crumbs-view-css' => '53664e83',
'phabricator-directory-css' => '53664e83',
'phabricator-drag-and-drop-file-upload' => 'e96b08f8',
'phabricator-dropdown-menu' => 'bf16b308',
'phabricator-file-upload' => 'bf16b308',
'phabricator-filetree-view-css' => '85d71a9b',
'phabricator-flag-css' => '85d71a9b',
'phabricator-form-view-css' => '85d71a9b',
'phabricator-header-view-css' => '85d71a9b',
'phabricator-jump-nav' => '85d71a9b',
'phabricator-keyboard-shortcut' => 'bf16b308',
'phabricator-keyboard-shortcut-manager' => 'bf16b308',
'phabricator-main-menu-view' => '85d71a9b',
'phabricator-menu-item' => 'bf16b308',
'phabricator-nav-view-css' => '85d71a9b',
'phabricator-notification' => 'bf16b308',
'phabricator-notification-css' => '85d71a9b',
'phabricator-notification-menu-css' => '85d71a9b',
'phabricator-object-item-list-view-css' => '85d71a9b',
'phabricator-dropdown-menu' => 'e32b785c',
'phabricator-file-upload' => 'e32b785c',
'phabricator-filetree-view-css' => '53664e83',
'phabricator-flag-css' => '53664e83',
'phabricator-form-view-css' => '53664e83',
'phabricator-header-view-css' => '53664e83',
'phabricator-jump-nav' => '53664e83',
'phabricator-keyboard-shortcut' => 'e32b785c',
'phabricator-keyboard-shortcut-manager' => 'e32b785c',
'phabricator-main-menu-view' => '53664e83',
'phabricator-menu-item' => 'e32b785c',
'phabricator-nav-view-css' => '53664e83',
'phabricator-notification' => 'e32b785c',
'phabricator-notification-css' => '53664e83',
'phabricator-notification-menu-css' => '53664e83',
'phabricator-object-item-list-view-css' => '53664e83',
'phabricator-object-selector-css' => '8aaacd1b',
'phabricator-prefab' => 'bf16b308',
'phabricator-prefab' => 'e32b785c',
'phabricator-project-tag-css' => '6b1fccc6',
'phabricator-remarkup-css' => '85d71a9b',
'phabricator-remarkup-css' => '53664e83',
'phabricator-shaped-request' => 'e96b08f8',
'phabricator-side-menu-view-css' => '85d71a9b',
'phabricator-standard-page-view' => '85d71a9b',
'phabricator-textareautils' => 'bf16b308',
'phabricator-tooltip' => 'bf16b308',
'phabricator-transaction-view-css' => '85d71a9b',
'phabricator-zindex-css' => '85d71a9b',
'sprite-apps-large-css' => '85d71a9b',
'sprite-gradient-css' => '85d71a9b',
'sprite-icon-css' => '85d71a9b',
'sprite-menu-css' => '85d71a9b',
'syntax-highlighting-css' => '85d71a9b',
'phabricator-side-menu-view-css' => '53664e83',
'phabricator-standard-page-view' => '53664e83',
'phabricator-textareautils' => 'e32b785c',
'phabricator-tooltip' => 'e32b785c',
'phabricator-transaction-view-css' => '53664e83',
'phabricator-zindex-css' => '53664e83',
'sprite-apps-large-css' => '53664e83',
'sprite-gradient-css' => '53664e83',
'sprite-icon-css' => '53664e83',
'sprite-menu-css' => '53664e83',
'syntax-highlighting-css' => '53664e83',
),
));

View File

@@ -2,16 +2,15 @@
final class PhabricatorExternalAccount extends PhabricatorUserDAO {
private $phid;
private $userPHID;
private $accountType;
private $accountDomain;
private $accountSecret;
private $accountID;
private $displayName;
private $userPHID;
private $accountType;
private $accountDomain;
private $accountSecret;
private $accountID;
private $displayName;
public function generatePHID() {
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPHIDConstants::PHID_TYPE_XUSR);
}
}
}

View File

@@ -475,3 +475,17 @@ Some general notes about this syntax:
not);
- you can use other Remarkup rules (like **bold**, //italics//, etc.) inside
table cells.
= Order and Chaos =
Remarkup editors provide two special composition modes.
In **Order** mode, the editor expands to the full size of the screen. This can
make it easier to edit large blocks of text, or improve focus by removing
distractions. You can exit **Order** mode by clicking the button again or by
pressing escape.
In **Chaos** mode, the opposite happens.
For serious business installs, **Chaos** mode is unavailable and **Order** mode
is called **Fullscreen Mode**.

View File

@@ -64,9 +64,18 @@ final class CeleritySpriteGenerator {
// Strip 'text_' from these file names.
$class_name = substr($icon, 5);
if ($class_name == 'order_off') {
$tcss = '.remarkup-control-order-mode .remarkup-assist-order';
} else if ($class_name == 'chaos_off') {
$tcss = '.remarkup-control-chaos-mode .remarkup-assist-chaos';
} else {
$tcss = '.remarkup-assist-'.$class_name;
}
$sprite = id(clone $template)
->setName('remarkup-assist-'.$icon)
->setTargetCSS('.remarkup-assist-'.$class_name);
->setTargetCSS($tcss);
foreach ($scales as $scale_key => $scale) {
$path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png');
$sprite->setSourceFile($path, $scale);

View File

@@ -64,6 +64,7 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
'tip' => pht('Meme'),
);
}
$actions['help'] = array(
'tip' => pht('Help'),
'align' => 'right',
@@ -71,21 +72,48 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
'article/Remarkup_Reference.html'),
);
$actions[] = array(
'spacer' => true,
'align' => 'right',
);
$is_serious = PhabricatorEnv::getEnvConfig(
'phabricator.serious-business');
$actions['order'] = array(
'tip' => $is_serious
? pht('Fullscreen Mode')
: pht('Order Mode'),
'align' => 'right',
);
if (!$is_serious) {
$actions['chaos'] = array(
'tip' => pht('Chaos Mode'),
'align' => 'right',
);
}
$buttons = array();
foreach ($actions as $action => $spec) {
$classes = array();
if (idx($spec, 'align') == 'right') {
$classes[] = 'remarkup-assist-right';
}
if (idx($spec, 'spacer')) {
$classes[] = 'remarkup-assist-separator';
$buttons[] = phutil_tag(
'span',
array(
'class' => 'remarkup-assist-separator',
'class' => implode(' ', $classes),
),
'');
continue;
}
$classes = array();
$classes[] = 'remarkup-assist-button';
if (idx($spec, 'align') == 'right') {
$classes[] = 'remarkup-assist-right';
} else {
$classes[] = 'remarkup-assist-button';
}
$href = idx($spec, 'href', '#');