diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -8,9 +8,9 @@ return array( 'names' => array( 'conpherence.pkg.css' => '82aca405', - 'conpherence.pkg.js' => '6249a1cf', + 'conpherence.pkg.js' => '281b1a73', 'core.pkg.css' => '1bf8fa70', - 'core.pkg.js' => '021685f1', + 'core.pkg.js' => 'fbc1c380', 'darkconsole.pkg.js' => 'e7393ebb', 'differential.pkg.css' => '90b30783', 'differential.pkg.js' => 'ddfeb49b', @@ -375,7 +375,7 @@ 'rsrc/js/application/conpherence/behavior-durable-column.js' => 'aa3bd034', 'rsrc/js/application/conpherence/behavior-menu.js' => '7524fcfa', 'rsrc/js/application/conpherence/behavior-participant-pane.js' => '8604caa8', - 'rsrc/js/application/conpherence/behavior-pontificate.js' => 'f2e58483', + 'rsrc/js/application/conpherence/behavior-pontificate.js' => '55616e04', 'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3', 'rsrc/js/application/conpherence/behavior-toggle-widget.js' => '3dbf94d5', 'rsrc/js/application/countdown/timer.js' => 'e4cc26b3', @@ -503,7 +503,7 @@ 'rsrc/js/core/behavior-object-selector.js' => 'e0ec7f2f', 'rsrc/js/core/behavior-oncopy.js' => '2926fff2', 'rsrc/js/core/behavior-phabricator-nav.js' => '08675c6d', - 'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => 'a0777ea3', + 'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => '0ca788bd', 'rsrc/js/core/behavior-read-only-warning.js' => 'ba158207', 'rsrc/js/core/behavior-refresh-csrf.js' => 'ab2f381b', 'rsrc/js/core/behavior-remarkup-preview.js' => '4b700e9e', @@ -600,7 +600,7 @@ 'javelin-behavior-config-reorder-fields' => 'b6993408', 'javelin-behavior-conpherence-menu' => '7524fcfa', 'javelin-behavior-conpherence-participant-pane' => '8604caa8', - 'javelin-behavior-conpherence-pontificate' => 'f2e58483', + 'javelin-behavior-conpherence-pontificate' => '55616e04', 'javelin-behavior-conpherence-search' => '9bbf3762', 'javelin-behavior-countdown-timer' => 'e4cc26b3', 'javelin-behavior-dark-console' => 'f411b6ae', @@ -664,7 +664,7 @@ 'javelin-behavior-phabricator-notification-example' => '8ce821c5', 'javelin-behavior-phabricator-object-selector' => 'e0ec7f2f', 'javelin-behavior-phabricator-oncopy' => '2926fff2', - 'javelin-behavior-phabricator-remarkup-assist' => 'a0777ea3', + 'javelin-behavior-phabricator-remarkup-assist' => '0ca788bd', 'javelin-behavior-phabricator-reveal-content' => '60821bc7', 'javelin-behavior-phabricator-search-typeahead' => '06c32383', 'javelin-behavior-phabricator-show-older-transactions' => '94c65b72', @@ -988,6 +988,17 @@ 'javelin-dom', 'javelin-router', ), + '0ca788bd' => array( + 'javelin-behavior', + 'javelin-stratcom', + 'javelin-dom', + 'phabricator-phtize', + 'phabricator-textareautils', + 'javelin-workflow', + 'javelin-vector', + 'phuix-autocomplete', + 'javelin-mask', + ), '0f764c35' => array( 'javelin-install', 'javelin-util', @@ -1298,6 +1309,14 @@ 'javelin-request', 'javelin-typeahead-source', ), + '55616e04' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-util', + 'javelin-workflow', + 'javelin-stratcom', + 'conpherence-thread-manager', + ), '558829c2' => array( 'javelin-stratcom', 'javelin-behavior', @@ -1686,17 +1705,6 @@ 'javelin-dom', 'javelin-vector', ), - 'a0777ea3' => array( - 'javelin-behavior', - 'javelin-stratcom', - 'javelin-dom', - 'phabricator-phtize', - 'phabricator-textareautils', - 'javelin-workflow', - 'javelin-vector', - 'phuix-autocomplete', - 'javelin-mask', - ), 'a0b57eb8' => array( 'javelin-behavior', 'javelin-dom', @@ -2165,14 +2173,6 @@ 'f12cbc9f' => array( 'phui-oi-list-view-css', ), - 'f2e58483' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-util', - 'javelin-workflow', - 'javelin-stratcom', - 'conpherence-thread-manager', - ), 'f411b6ae' => array( 'javelin-behavior', 'javelin-stratcom', diff --git a/src/applications/conpherence/controller/ConpherenceViewController.php b/src/applications/conpherence/controller/ConpherenceViewController.php --- a/src/applications/conpherence/controller/ConpherenceViewController.php +++ b/src/applications/conpherence/controller/ConpherenceViewController.php @@ -184,6 +184,7 @@ id(new PhabricatorRemarkupControl()) ->setUser($user) ->setName('text') + ->setSendOnEnter(true) ->setValue($draft->getDraft())); $status_view = phutil_tag( diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -5,6 +5,7 @@ private $disableMacro = false; private $disableFullScreen = false; private $canPin; + private $sendOnEnter = false; public function setDisableMacros($disable) { $this->disableMacro = $disable; @@ -25,6 +26,15 @@ return $this->canPin; } + public function setSendOnEnter($soe) { + $this->sendOnEnter = $soe; + return $this; + } + + public function getSendOnEnter() { + return $this->sendOnEnter; + } + protected function renderInput() { $id = $this->getID(); if (!$id) { @@ -78,6 +88,7 @@ ), 'canPin' => $this->getCanPin(), 'disabled' => $this->getDisabled(), + 'sendOnEnter' => $this->getSendOnEnter(), 'rootID' => $root_id, 'autocompleteMap' => (object)array( 64 => array( // "@" diff --git a/webroot/rsrc/js/application/conpherence/behavior-pontificate.js b/webroot/rsrc/js/application/conpherence/behavior-pontificate.js --- a/webroot/rsrc/js/application/conpherence/behavior-pontificate.js +++ b/webroot/rsrc/js/application/conpherence/behavior-pontificate.js @@ -22,27 +22,4 @@ 'conpherence-pontificate', _sendMessage); - // Send on enter if the shift key is not held. - JX.Stratcom.listen( - 'keydown', - 'conpherence-pontificate', - function(e) { - if (e.getSpecialKey() != 'return') { - return; - } - - var raw = e.getRawEvent(); - if (raw.shiftKey) { - // If the shift key is pressed, let the browser write a newline into - // the textarea. - return; - } - - // From here on, interpret this as a "send" action, not a literal - // newline. - e.kill(); - - _sendMessage(e); - }); - }); diff --git a/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js b/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js --- a/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js +++ b/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js @@ -37,7 +37,7 @@ // First, disable any active mode. if (edit_root) { - if (edit_mode == 'fa-arrows-alt') { + if (edit_mode == 'fullscreen') { JX.DOM.alterClass(edit_root, 'remarkup-control-fullscreen-mode', false); JX.DOM.alterClass(document.body, 'remarkup-fullscreen-mode', false); JX.Mask.hide('jx-light-mask'); @@ -58,7 +58,7 @@ edit_mode = mode; // Now, apply the new mode. - if (mode == 'fa-arrows-alt') { + if (mode == 'fullscreen') { JX.DOM.alterClass(edit_root, 'remarkup-control-fullscreen-mode', true); JX.DOM.alterClass(document.body, 'remarkup-fullscreen-mode', true); JX.Mask.show('jx-light-mask'); @@ -118,7 +118,7 @@ if (!edit_root) { return; } - if (edit_mode != 'fa-arrows-alt') { + if (edit_mode != 'fullscreen') { return; } @@ -140,7 +140,7 @@ return; } - if (edit_mode != 'fa-arrows-alt') { + if (edit_mode != 'fullscreen') { return; } @@ -261,10 +261,10 @@ break; case 'fa-arrows-alt': set_pinned_mode(root, false); - if (edit_mode == 'fa-arrows-alt') { + if (edit_mode == 'fullscreen') { set_edit_mode(root, 'normal'); } else { - set_edit_mode(root, 'fa-arrows-alt'); + set_edit_mode(root, 'fullscreen'); } break; case 'fa-eye': @@ -385,4 +385,36 @@ .register(); } + if (config.sendOnEnter) { + // Send on enter if the shift key is not held. + JX.DOM.listen(area, 'keydown', null, + function(e) { + if (e.getSpecialKey() != 'return') { + return; + } + + var raw = e.getRawEvent(); + if (raw.shiftKey) { + // If the shift key is pressed, let the browser write a newline into + // the textarea. + return; + } + + if (edit_mode == 'fullscreen') { + // Don't send on enter in fullscreen + return; + } + + // From here on, interpret this as a "send" action, not a literal + // newline. + e.kill(); + + // This allows 'workflow' and similar actions to take effect. + // Such as pontificate in Conpherence + var form = e.getNode('tag:form'); + var r = JX.DOM.invoke(form, 'didSyntheticSubmit'); + + }); + } + });