mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-02 09:58:24 +01:00
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:
parent
39afb3fedb
commit
ccb206e984
3 changed files with 18 additions and 11 deletions
|
@ -122,7 +122,8 @@ final class PhameBlogEditController
|
|||
->setName('description')
|
||||
->setValue($blog->getDescription())
|
||||
->setID('blog-description')
|
||||
->setUser($user))
|
||||
->setUser($user)
|
||||
->setDisableMacros(true))
|
||||
->appendChild(
|
||||
id(new AphrontFormPolicyControl())
|
||||
->setUser($user)
|
||||
|
|
|
@ -133,6 +133,7 @@ final class PhamePostEditController
|
|||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
||||
->setID('post-body')
|
||||
->setUser($user)
|
||||
->setDisableMacros(true)
|
||||
)
|
||||
->appendChild(
|
||||
id(new AphrontFormSelectControl())
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
|
||||
|
||||
private $disableMacro = false;
|
||||
public function setDisableMacros($disable) {
|
||||
$this->disableMacro = $disable;
|
||||
return $this;
|
||||
}
|
||||
protected function renderInput() {
|
||||
$id = $this->getID();
|
||||
if (!$id) {
|
||||
|
@ -48,20 +52,22 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
|
|||
),
|
||||
'table' => array(
|
||||
'tip' => pht('Table'),
|
||||
),
|
||||
array(
|
||||
)
|
||||
);
|
||||
if (!$this->disableMacro and function_exists('imagettftext')) {
|
||||
$actions[] = array(
|
||||
'spacer' => true,
|
||||
),
|
||||
'meme' => array(
|
||||
);
|
||||
$actions['meme'] = array(
|
||||
'tip' => pht('Meme'),
|
||||
),
|
||||
'help' => array(
|
||||
);
|
||||
}
|
||||
$actions['help'] = array(
|
||||
'tip' => pht('Help'),
|
||||
'align' => 'right',
|
||||
'href' => PhabricatorEnv::getDoclink(
|
||||
'article/Remarkup_Reference.html'),
|
||||
),
|
||||
);
|
||||
);
|
||||
|
||||
$buttons = array();
|
||||
foreach ($actions as $action => $spec) {
|
||||
|
@ -74,7 +80,6 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
|
|||
'');
|
||||
continue;
|
||||
}
|
||||
|
||||
$classes = array();
|
||||
$classes[] = 'remarkup-assist-button';
|
||||
if (idx($spec, 'align') == 'right') {
|
||||
|
|
Loading…
Add table
Reference in a new issue