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
This commit is contained in:
Chad Little
2017-04-10 14:39:36 -07:00
parent dee9c33be2
commit 4a84954957
5 changed files with 75 additions and 54 deletions

View File

@@ -184,6 +184,7 @@ final class ConpherenceViewController extends
id(new PhabricatorRemarkupControl())
->setUser($user)
->setName('text')
->setSendOnEnter(true)
->setValue($draft->getDraft()));
$status_view = phutil_tag(

View File

@@ -5,6 +5,7 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
private $disableMacro = false;
private $disableFullScreen = false;
private $canPin;
private $sendOnEnter = false;
public function setDisableMacros($disable) {
$this->disableMacro = $disable;
@@ -25,6 +26,15 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
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 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
),
'canPin' => $this->getCanPin(),
'disabled' => $this->getDisabled(),
'sendOnEnter' => $this->getSendOnEnter(),
'rootID' => $root_id,
'autocompleteMap' => (object)array(
64 => array( // "@"