Added a Disable Macros function that can be called in some contexts where Macros are unsuitable
Summary: Semi Fixed T2397 Test Plan: Can disable the meme button on manually toggling the class variable. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2397 Differential Revision: https://secure.phabricator.com/D4781
This commit is contained in:
committed by
epriestley
parent
39afb3fedb
commit
ccb206e984
@@ -122,7 +122,8 @@ final class PhameBlogEditController
|
|||||||
->setName('description')
|
->setName('description')
|
||||||
->setValue($blog->getDescription())
|
->setValue($blog->getDescription())
|
||||||
->setID('blog-description')
|
->setID('blog-description')
|
||||||
->setUser($user))
|
->setUser($user)
|
||||||
|
->setDisableMacros(true))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormPolicyControl())
|
id(new AphrontFormPolicyControl())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ final class PhamePostEditController
|
|||||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
||||||
->setID('post-body')
|
->setID('post-body')
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
|
->setDisableMacros(true)
|
||||||
)
|
)
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSelectControl())
|
id(new AphrontFormSelectControl())
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
|
final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
|
||||||
|
private $disableMacro = false;
|
||||||
|
public function setDisableMacros($disable) {
|
||||||
|
$this->disableMacro = $disable;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
protected function renderInput() {
|
protected function renderInput() {
|
||||||
$id = $this->getID();
|
$id = $this->getID();
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
@@ -48,19 +52,21 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
|
|||||||
),
|
),
|
||||||
'table' => array(
|
'table' => array(
|
||||||
'tip' => pht('Table'),
|
'tip' => pht('Table'),
|
||||||
),
|
)
|
||||||
array(
|
);
|
||||||
|
if (!$this->disableMacro and function_exists('imagettftext')) {
|
||||||
|
$actions[] = array(
|
||||||
'spacer' => true,
|
'spacer' => true,
|
||||||
),
|
);
|
||||||
'meme' => array(
|
$actions['meme'] = array(
|
||||||
'tip' => pht('Meme'),
|
'tip' => pht('Meme'),
|
||||||
),
|
);
|
||||||
'help' => array(
|
}
|
||||||
|
$actions['help'] = array(
|
||||||
'tip' => pht('Help'),
|
'tip' => pht('Help'),
|
||||||
'align' => 'right',
|
'align' => 'right',
|
||||||
'href' => PhabricatorEnv::getDoclink(
|
'href' => PhabricatorEnv::getDoclink(
|
||||||
'article/Remarkup_Reference.html'),
|
'article/Remarkup_Reference.html'),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$buttons = array();
|
$buttons = array();
|
||||||
@@ -74,7 +80,6 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
|
|||||||
'');
|
'');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$classes = array();
|
$classes = array();
|
||||||
$classes[] = 'remarkup-assist-button';
|
$classes[] = 'remarkup-assist-button';
|
||||||
if (idx($spec, 'align') == 'right') {
|
if (idx($spec, 'align') == 'right') {
|
||||||
|
|||||||
Reference in New Issue
Block a user