@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Prevent Send on Enter in Fullscreen Remarkup Mode

Summary: Fixes T12138. Test for the presence of being in fullscreen mode, and disable send on enter if present. Side note, I'd love a first class "hasClass" type Javelin function.

Test Plan:
- Go to Conpherence
- Type some smack, see it send on enter
- Go fullscreen like a boss
- Let the words flow
- Close fullscreen, then send on enter.
- (might be nice someday to add a "submit" button to fullscreen editor)

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12138

Differential Revision: https://secure.phabricator.com/D17590

+75 -54
+25 -25
resources/celerity/map.php
··· 8 8 return array( 9 9 'names' => array( 10 10 'conpherence.pkg.css' => '82aca405', 11 - 'conpherence.pkg.js' => '6249a1cf', 11 + 'conpherence.pkg.js' => '281b1a73', 12 12 'core.pkg.css' => '1bf8fa70', 13 - 'core.pkg.js' => '021685f1', 13 + 'core.pkg.js' => 'fbc1c380', 14 14 'darkconsole.pkg.js' => 'e7393ebb', 15 15 'differential.pkg.css' => '90b30783', 16 16 'differential.pkg.js' => 'ddfeb49b', ··· 375 375 'rsrc/js/application/conpherence/behavior-durable-column.js' => 'aa3bd034', 376 376 'rsrc/js/application/conpherence/behavior-menu.js' => '7524fcfa', 377 377 'rsrc/js/application/conpherence/behavior-participant-pane.js' => '8604caa8', 378 - 'rsrc/js/application/conpherence/behavior-pontificate.js' => 'f2e58483', 378 + 'rsrc/js/application/conpherence/behavior-pontificate.js' => '55616e04', 379 379 'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3', 380 380 'rsrc/js/application/conpherence/behavior-toggle-widget.js' => '3dbf94d5', 381 381 'rsrc/js/application/countdown/timer.js' => 'e4cc26b3', ··· 503 503 'rsrc/js/core/behavior-object-selector.js' => 'e0ec7f2f', 504 504 'rsrc/js/core/behavior-oncopy.js' => '2926fff2', 505 505 'rsrc/js/core/behavior-phabricator-nav.js' => '08675c6d', 506 - 'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => 'a0777ea3', 506 + 'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => '0ca788bd', 507 507 'rsrc/js/core/behavior-read-only-warning.js' => 'ba158207', 508 508 'rsrc/js/core/behavior-refresh-csrf.js' => 'ab2f381b', 509 509 'rsrc/js/core/behavior-remarkup-preview.js' => '4b700e9e', ··· 600 600 'javelin-behavior-config-reorder-fields' => 'b6993408', 601 601 'javelin-behavior-conpherence-menu' => '7524fcfa', 602 602 'javelin-behavior-conpherence-participant-pane' => '8604caa8', 603 - 'javelin-behavior-conpherence-pontificate' => 'f2e58483', 603 + 'javelin-behavior-conpherence-pontificate' => '55616e04', 604 604 'javelin-behavior-conpherence-search' => '9bbf3762', 605 605 'javelin-behavior-countdown-timer' => 'e4cc26b3', 606 606 'javelin-behavior-dark-console' => 'f411b6ae', ··· 664 664 'javelin-behavior-phabricator-notification-example' => '8ce821c5', 665 665 'javelin-behavior-phabricator-object-selector' => 'e0ec7f2f', 666 666 'javelin-behavior-phabricator-oncopy' => '2926fff2', 667 - 'javelin-behavior-phabricator-remarkup-assist' => 'a0777ea3', 667 + 'javelin-behavior-phabricator-remarkup-assist' => '0ca788bd', 668 668 'javelin-behavior-phabricator-reveal-content' => '60821bc7', 669 669 'javelin-behavior-phabricator-search-typeahead' => '06c32383', 670 670 'javelin-behavior-phabricator-show-older-transactions' => '94c65b72', ··· 988 988 'javelin-dom', 989 989 'javelin-router', 990 990 ), 991 + '0ca788bd' => array( 992 + 'javelin-behavior', 993 + 'javelin-stratcom', 994 + 'javelin-dom', 995 + 'phabricator-phtize', 996 + 'phabricator-textareautils', 997 + 'javelin-workflow', 998 + 'javelin-vector', 999 + 'phuix-autocomplete', 1000 + 'javelin-mask', 1001 + ), 991 1002 '0f764c35' => array( 992 1003 'javelin-install', 993 1004 'javelin-util', ··· 1298 1309 'javelin-request', 1299 1310 'javelin-typeahead-source', 1300 1311 ), 1312 + '55616e04' => array( 1313 + 'javelin-behavior', 1314 + 'javelin-dom', 1315 + 'javelin-util', 1316 + 'javelin-workflow', 1317 + 'javelin-stratcom', 1318 + 'conpherence-thread-manager', 1319 + ), 1301 1320 '558829c2' => array( 1302 1321 'javelin-stratcom', 1303 1322 'javelin-behavior', ··· 1685 1704 'javelin-stratcom', 1686 1705 'javelin-dom', 1687 1706 'javelin-vector', 1688 - ), 1689 - 'a0777ea3' => array( 1690 - 'javelin-behavior', 1691 - 'javelin-stratcom', 1692 - 'javelin-dom', 1693 - 'phabricator-phtize', 1694 - 'phabricator-textareautils', 1695 - 'javelin-workflow', 1696 - 'javelin-vector', 1697 - 'phuix-autocomplete', 1698 - 'javelin-mask', 1699 1707 ), 1700 1708 'a0b57eb8' => array( 1701 1709 'javelin-behavior', ··· 2164 2172 ), 2165 2173 'f12cbc9f' => array( 2166 2174 'phui-oi-list-view-css', 2167 - ), 2168 - 'f2e58483' => array( 2169 - 'javelin-behavior', 2170 - 'javelin-dom', 2171 - 'javelin-util', 2172 - 'javelin-workflow', 2173 - 'javelin-stratcom', 2174 - 'conpherence-thread-manager', 2175 2175 ), 2176 2176 'f411b6ae' => array( 2177 2177 'javelin-behavior',
+1
src/applications/conpherence/controller/ConpherenceViewController.php
··· 184 184 id(new PhabricatorRemarkupControl()) 185 185 ->setUser($user) 186 186 ->setName('text') 187 + ->setSendOnEnter(true) 187 188 ->setValue($draft->getDraft())); 188 189 189 190 $status_view = phutil_tag(
+11
src/view/form/control/PhabricatorRemarkupControl.php
··· 5 5 private $disableMacro = false; 6 6 private $disableFullScreen = false; 7 7 private $canPin; 8 + private $sendOnEnter = false; 8 9 9 10 public function setDisableMacros($disable) { 10 11 $this->disableMacro = $disable; ··· 23 24 24 25 public function getCanPin() { 25 26 return $this->canPin; 27 + } 28 + 29 + public function setSendOnEnter($soe) { 30 + $this->sendOnEnter = $soe; 31 + return $this; 32 + } 33 + 34 + public function getSendOnEnter() { 35 + return $this->sendOnEnter; 26 36 } 27 37 28 38 protected function renderInput() { ··· 78 88 ), 79 89 'canPin' => $this->getCanPin(), 80 90 'disabled' => $this->getDisabled(), 91 + 'sendOnEnter' => $this->getSendOnEnter(), 81 92 'rootID' => $root_id, 82 93 'autocompleteMap' => (object)array( 83 94 64 => array( // "@"
-23
webroot/rsrc/js/application/conpherence/behavior-pontificate.js
··· 22 22 'conpherence-pontificate', 23 23 _sendMessage); 24 24 25 - // Send on enter if the shift key is not held. 26 - JX.Stratcom.listen( 27 - 'keydown', 28 - 'conpherence-pontificate', 29 - function(e) { 30 - if (e.getSpecialKey() != 'return') { 31 - return; 32 - } 33 - 34 - var raw = e.getRawEvent(); 35 - if (raw.shiftKey) { 36 - // If the shift key is pressed, let the browser write a newline into 37 - // the textarea. 38 - return; 39 - } 40 - 41 - // From here on, interpret this as a "send" action, not a literal 42 - // newline. 43 - e.kill(); 44 - 45 - _sendMessage(e); 46 - }); 47 - 48 25 });
+38 -6
webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js
··· 37 37 38 38 // First, disable any active mode. 39 39 if (edit_root) { 40 - if (edit_mode == 'fa-arrows-alt') { 40 + if (edit_mode == 'fullscreen') { 41 41 JX.DOM.alterClass(edit_root, 'remarkup-control-fullscreen-mode', false); 42 42 JX.DOM.alterClass(document.body, 'remarkup-fullscreen-mode', false); 43 43 JX.Mask.hide('jx-light-mask'); ··· 58 58 edit_mode = mode; 59 59 60 60 // Now, apply the new mode. 61 - if (mode == 'fa-arrows-alt') { 61 + if (mode == 'fullscreen') { 62 62 JX.DOM.alterClass(edit_root, 'remarkup-control-fullscreen-mode', true); 63 63 JX.DOM.alterClass(document.body, 'remarkup-fullscreen-mode', true); 64 64 JX.Mask.show('jx-light-mask'); ··· 118 118 if (!edit_root) { 119 119 return; 120 120 } 121 - if (edit_mode != 'fa-arrows-alt') { 121 + if (edit_mode != 'fullscreen') { 122 122 return; 123 123 } 124 124 ··· 140 140 return; 141 141 } 142 142 143 - if (edit_mode != 'fa-arrows-alt') { 143 + if (edit_mode != 'fullscreen') { 144 144 return; 145 145 } 146 146 ··· 261 261 break; 262 262 case 'fa-arrows-alt': 263 263 set_pinned_mode(root, false); 264 - if (edit_mode == 'fa-arrows-alt') { 264 + if (edit_mode == 'fullscreen') { 265 265 set_edit_mode(root, 'normal'); 266 266 } else { 267 - set_edit_mode(root, 'fa-arrows-alt'); 267 + set_edit_mode(root, 'fullscreen'); 268 268 } 269 269 break; 270 270 case 'fa-eye': ··· 383 383 set_pinned_mode(root, !pinned); 384 384 }) 385 385 .register(); 386 + } 387 + 388 + if (config.sendOnEnter) { 389 + // Send on enter if the shift key is not held. 390 + JX.DOM.listen(area, 'keydown', null, 391 + function(e) { 392 + if (e.getSpecialKey() != 'return') { 393 + return; 394 + } 395 + 396 + var raw = e.getRawEvent(); 397 + if (raw.shiftKey) { 398 + // If the shift key is pressed, let the browser write a newline into 399 + // the textarea. 400 + return; 401 + } 402 + 403 + if (edit_mode == 'fullscreen') { 404 + // Don't send on enter in fullscreen 405 + return; 406 + } 407 + 408 + // From here on, interpret this as a "send" action, not a literal 409 + // newline. 410 + e.kill(); 411 + 412 + // This allows 'workflow' and similar actions to take effect. 413 + // Such as pontificate in Conpherence 414 + var form = e.getNode('tag:form'); 415 + var r = JX.DOM.invoke(form, 'didSyntheticSubmit'); 416 + 417 + }); 386 418 } 387 419 388 420 });