Changeset View
Changeset View
Standalone View
Standalone View
src/view/form/control/PhabricatorRemarkupControl.php
Show All 25 Lines | protected function renderInput() { | ||||
if (!$viewer) { | if (!$viewer) { | ||||
throw new PhutilInvalidStateException('setUser'); | throw new PhutilInvalidStateException('setUser'); | ||||
} | } | ||||
// We need to have this if previews render images, since Ajax can not | // We need to have this if previews render images, since Ajax can not | ||||
// currently ship JS or CSS. | // currently ship JS or CSS. | ||||
require_celerity_resource('lightbox-attachment-css'); | require_celerity_resource('lightbox-attachment-css'); | ||||
if (!$this->getDisabled()) { | |||||
Javelin::initBehavior( | Javelin::initBehavior( | ||||
'aphront-drag-and-drop-textarea', | 'aphront-drag-and-drop-textarea', | ||||
array( | array( | ||||
'target' => $id, | 'target' => $id, | ||||
'activatedClass' => 'aphront-textarea-drag-and-drop', | 'activatedClass' => 'aphront-textarea-drag-and-drop', | ||||
'uri' => '/file/dropupload/', | 'uri' => '/file/dropupload/', | ||||
'chunkThreshold' => PhabricatorFileStorageEngine::getChunkThreshold(), | 'chunkThreshold' => PhabricatorFileStorageEngine::getChunkThreshold(), | ||||
)); | )); | ||||
} | |||||
Javelin::initBehavior( | Javelin::initBehavior( | ||||
'phabricator-remarkup-assist', | 'phabricator-remarkup-assist', | ||||
array( | array( | ||||
'pht' => array( | 'pht' => array( | ||||
'bold text' => pht('bold text'), | 'bold text' => pht('bold text'), | ||||
'italic text' => pht('italic text'), | 'italic text' => pht('italic text'), | ||||
'monospaced text' => pht('monospaced text'), | 'monospaced text' => pht('monospaced text'), | ||||
'List Item' => pht('List Item'), | 'List Item' => pht('List Item'), | ||||
'Quoted Text' => pht('Quoted Text'), | 'Quoted Text' => pht('Quoted Text'), | ||||
'data' => pht('data'), | 'data' => pht('data'), | ||||
'name' => pht('name'), | 'name' => pht('name'), | ||||
'URL' => pht('URL'), | 'URL' => pht('URL'), | ||||
), | ), | ||||
'disabled' => $this->getDisabled(), | |||||
)); | )); | ||||
Javelin::initBehavior('phabricator-tooltips', array()); | Javelin::initBehavior('phabricator-tooltips', array()); | ||||
$actions = array( | $actions = array( | ||||
'fa-bold' => array( | 'fa-bold' => array( | ||||
'tip' => pht('Bold'), | 'tip' => pht('Bold'), | ||||
), | ), | ||||
'fa-italic' => array( | 'fa-italic' => array( | ||||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | foreach ($actions as $action => $spec) { | ||||
$content = javelin_tag( | $content = javelin_tag( | ||||
'span', | 'span', | ||||
array( | array( | ||||
'aural' => true, | 'aural' => true, | ||||
), | ), | ||||
$tip); | $tip); | ||||
} | } | ||||
$sigils = array(); | |||||
$sigils[] = 'remarkup-assist'; | |||||
if (!$this->getDisabled()) { | |||||
$sigils[] = 'has-tooltip'; | |||||
} | |||||
$buttons[] = javelin_tag( | $buttons[] = javelin_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'class' => implode(' ', $classes), | 'class' => implode(' ', $classes), | ||||
'href' => $href, | 'href' => $href, | ||||
'sigil' => 'remarkup-assist has-tooltip', | 'sigil' => implode(' ', $sigils), | ||||
'meta' => $meta, | 'meta' => $meta, | ||||
'mustcapture' => $mustcapture, | 'mustcapture' => $mustcapture, | ||||
'target' => $target, | 'target' => $target, | ||||
'tabindex' => -1, | 'tabindex' => -1, | ||||
), | ), | ||||
phutil_tag( | phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
Show All 23 Lines | protected function renderInput() { | ||||
$this->setCustomClass( | $this->setCustomClass( | ||||
'remarkup-assist-textarea '.$monospaced_textareas_class); | 'remarkup-assist-textarea '.$monospaced_textareas_class); | ||||
return javelin_tag( | return javelin_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'sigil' => 'remarkup-assist-control', | 'sigil' => 'remarkup-assist-control', | ||||
'class' => $this->getDisabled() ? 'disabled-control' : null, | |||||
), | ), | ||||
array( | array( | ||||
$buttons, | $buttons, | ||||
parent::renderInput(), | parent::renderInput(), | ||||
)); | )); | ||||
} | } | ||||
} | } |