mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Unconditionally enable drag-and-drop uploads for Remarkup text areas
Summary: Make these always work. Notably, this makes them work in Maniphest. Previously this was at odds with stuff fixed in D3651. Test Plan: Dragged and dropped files into Remarkup in Maniphest. Reviewers: btrahan, vrana Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D3652
This commit is contained in:
parent
8573a1e142
commit
4b6d3e1be9
7 changed files with 17 additions and 28 deletions
|
@ -133,7 +133,6 @@ final class DifferentialAddCommentView extends AphrontView {
|
|||
->setName('comment')
|
||||
->setID('comment-content')
|
||||
->setLabel('Comment')
|
||||
->setEnableDragAndDropFileUploads(true)
|
||||
->setValue($this->draft ? $this->draft->getDraft() : null))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
|
|
|
@ -259,7 +259,6 @@ final class PhamePostEditController
|
|||
->setName('body')
|
||||
->setValue($post->getBody())
|
||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
||||
->setEnableDragAndDropFileUploads(true)
|
||||
->setID('post-body')
|
||||
)
|
||||
->appendChild(
|
||||
|
|
|
@ -223,8 +223,7 @@ final class PhrictionEditController
|
|||
->setValue($content_text)
|
||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
||||
->setName('content')
|
||||
->setID('document-textarea')
|
||||
->setEnableDragAndDropFileUploads(true))
|
||||
->setID('document-textarea'))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Edit Notes')
|
||||
|
|
|
@ -60,8 +60,7 @@ final class PonderAddAnswerView extends AphrontView {
|
|||
->setName('answer')
|
||||
->setLabel('Answer')
|
||||
->setError(true)
|
||||
->setID('answer-content')
|
||||
->setEnableDragAndDropFileUploads(true))
|
||||
->setID('answer-content'))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue($is_serious ? 'Submit' : 'Make it so.'));
|
||||
|
|
|
@ -60,8 +60,7 @@ final class PonderAddCommentView extends AphrontView {
|
|||
->addHiddenInput('question_id', $questionID)
|
||||
->appendChild(
|
||||
id(new AphrontFormTextAreaControl())
|
||||
->setName('content')
|
||||
->setEnableDragAndDropFileUploads(false))
|
||||
->setName('content'))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue($is_serious ? 'Submit' : 'Editorialize'));
|
||||
|
|
|
@ -48,11 +48,6 @@ class AphrontFormTextAreaControl extends AphrontFormControl {
|
|||
return 'aphront-form-control-textarea';
|
||||
}
|
||||
|
||||
public function setEnableDragAndDropFileUploads($enable) {
|
||||
$this->enableDragAndDropFileUploads = $enable;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCustomClass($custom_class) {
|
||||
$this->customClass = $custom_class;
|
||||
return $this;
|
||||
|
@ -74,20 +69,6 @@ class AphrontFormTextAreaControl extends AphrontFormControl {
|
|||
$classes[] = $this->customClass;
|
||||
$classes = trim(implode(' ', $classes));
|
||||
|
||||
$id = $this->getID();
|
||||
if ($this->enableDragAndDropFileUploads) {
|
||||
if (!$id) {
|
||||
$id = celerity_generate_unique_node_id();
|
||||
}
|
||||
Javelin::initBehavior(
|
||||
'aphront-drag-and-drop-textarea',
|
||||
array(
|
||||
'target' => $id,
|
||||
'activatedClass' => 'aphront-textarea-drag-and-drop',
|
||||
'uri' => '/file/dropupload/',
|
||||
));
|
||||
}
|
||||
|
||||
return phutil_render_tag(
|
||||
'textarea',
|
||||
array(
|
||||
|
@ -96,7 +77,7 @@ class AphrontFormTextAreaControl extends AphrontFormControl {
|
|||
'readonly' => $this->getReadonly() ? 'readonly' : null,
|
||||
'class' => $classes,
|
||||
'style' => $this->getControlStyle(),
|
||||
'id' => $id,
|
||||
'id' => $this->getID(),
|
||||
),
|
||||
phutil_escape_html($this->getValue()));
|
||||
}
|
||||
|
|
|
@ -19,6 +19,19 @@
|
|||
final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
|
||||
|
||||
protected function renderInput() {
|
||||
$id = $this->getID();
|
||||
if (!$id) {
|
||||
$id = celerity_generate_unique_node_id();
|
||||
$this->setID($id);
|
||||
}
|
||||
|
||||
Javelin::initBehavior(
|
||||
'aphront-drag-and-drop-textarea',
|
||||
array(
|
||||
'target' => $id,
|
||||
'activatedClass' => 'aphront-textarea-drag-and-drop',
|
||||
'uri' => '/file/dropupload/',
|
||||
));
|
||||
|
||||
Javelin::initBehavior('phabricator-remarkup-assist', array());
|
||||
Javelin::initBehavior('phabricator-tooltips', array());
|
||||
|
|
Loading…
Reference in a new issue