diff --git a/src/applications/differential/view/DifferentialAddCommentView.php b/src/applications/differential/view/DifferentialAddCommentView.php index d9d9d745c1..2f529e42a4 100644 --- a/src/applications/differential/view/DifferentialAddCommentView.php +++ b/src/applications/differential/view/DifferentialAddCommentView.php @@ -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()) diff --git a/src/applications/phame/controller/post/PhamePostEditController.php b/src/applications/phame/controller/post/PhamePostEditController.php index a986e20e14..1f18b1a74d 100644 --- a/src/applications/phame/controller/post/PhamePostEditController.php +++ b/src/applications/phame/controller/post/PhamePostEditController.php @@ -259,7 +259,6 @@ final class PhamePostEditController ->setName('body') ->setValue($post->getBody()) ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) - ->setEnableDragAndDropFileUploads(true) ->setID('post-body') ) ->appendChild( diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php index 19b49365ce..adfcbbd8f8 100644 --- a/src/applications/phriction/controller/PhrictionEditController.php +++ b/src/applications/phriction/controller/PhrictionEditController.php @@ -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') diff --git a/src/applications/ponder/view/PonderAddAnswerView.php b/src/applications/ponder/view/PonderAddAnswerView.php index 3acbfe1431..3f8992c821 100644 --- a/src/applications/ponder/view/PonderAddAnswerView.php +++ b/src/applications/ponder/view/PonderAddAnswerView.php @@ -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.')); diff --git a/src/applications/ponder/view/PonderAddCommentView.php b/src/applications/ponder/view/PonderAddCommentView.php index 83e491726b..3d06c7a8d4 100644 --- a/src/applications/ponder/view/PonderAddCommentView.php +++ b/src/applications/ponder/view/PonderAddCommentView.php @@ -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')); diff --git a/src/view/form/control/AphrontFormTextAreaControl.php b/src/view/form/control/AphrontFormTextAreaControl.php index c237eaaf0b..a20f6acca7 100644 --- a/src/view/form/control/AphrontFormTextAreaControl.php +++ b/src/view/form/control/AphrontFormTextAreaControl.php @@ -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())); } diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index 3066b1c2bd..8fe9615c76 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -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());