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' => '3602ce33', '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' => 'c67a2a84', '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' => 'c67a2a84', 'javelin-behavior-phabricator-reveal-content' => '60821bc7', 'javelin-behavior-phabricator-search-typeahead' => '06c32383', 'javelin-behavior-phabricator-show-older-transactions' => '94c65b72', @@ -1298,6 +1298,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 +1694,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', @@ -1947,6 +1944,17 @@ 'c587b80f' => array( 'javelin-install', ), + 'c67a2a84' => array( + 'javelin-behavior', + 'javelin-stratcom', + 'javelin-dom', + 'phabricator-phtize', + 'phabricator-textareautils', + 'javelin-workflow', + 'javelin-vector', + 'phuix-autocomplete', + 'javelin-mask', + ), 'c7ccd872' => array( 'phui-fontkit-css', ), @@ -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 @@ -177,13 +177,14 @@ $form = id(new AphrontFormView()) ->setUser($user) ->setAction($update_uri) - ->addSigil('conpherence-pontificate') + ->addSigil('remarkup-send-on-enter') ->setWorkflow(true) ->addHiddenInput('action', $action) ->appendChild( 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 @@ -20,6 +20,7 @@ var edit_root = null; var preview = null; var pinned = false; + var in_fullscreen = false; // When we pin the comment area to the bottom of the window, we need to put // an extra spacer element at the bottom of the document so that it is @@ -41,6 +42,7 @@ 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'); + in_fullscreen = false; } area.style.height = ''; @@ -62,6 +64,7 @@ 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'); + in_fullscreen = true; // If we're in preview mode, expand the preview to full-size. if (preview) { @@ -385,4 +388,36 @@ .register(); } + if (config.sendonEnter) { + // Send on enter if the shift key is not held. + JX.Stratcom.listen( + 'keydown', + 'remarkup-send-on-enter', + 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 (in_fullscreen) { + // Don't send on enter in fullscreen + return; + } + + // From here on, interpret this as a "send" action, not a literal + // newline. + e.kill(); + + // TODO... works, but no Conpherence AJAX + var form = e.getNode('tag:form'); + form.submit(); + }); + } + });