mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +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')
|
->setName('comment')
|
||||||
->setID('comment-content')
|
->setID('comment-content')
|
||||||
->setLabel('Comment')
|
->setLabel('Comment')
|
||||||
->setEnableDragAndDropFileUploads(true)
|
|
||||||
->setValue($this->draft ? $this->draft->getDraft() : null))
|
->setValue($this->draft ? $this->draft->getDraft() : null))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSubmitControl())
|
id(new AphrontFormSubmitControl())
|
||||||
|
|
|
@ -259,7 +259,6 @@ final class PhamePostEditController
|
||||||
->setName('body')
|
->setName('body')
|
||||||
->setValue($post->getBody())
|
->setValue($post->getBody())
|
||||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
||||||
->setEnableDragAndDropFileUploads(true)
|
|
||||||
->setID('post-body')
|
->setID('post-body')
|
||||||
)
|
)
|
||||||
->appendChild(
|
->appendChild(
|
||||||
|
|
|
@ -223,8 +223,7 @@ final class PhrictionEditController
|
||||||
->setValue($content_text)
|
->setValue($content_text)
|
||||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
||||||
->setName('content')
|
->setName('content')
|
||||||
->setID('document-textarea')
|
->setID('document-textarea'))
|
||||||
->setEnableDragAndDropFileUploads(true))
|
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormTextControl())
|
id(new AphrontFormTextControl())
|
||||||
->setLabel('Edit Notes')
|
->setLabel('Edit Notes')
|
||||||
|
|
|
@ -60,8 +60,7 @@ final class PonderAddAnswerView extends AphrontView {
|
||||||
->setName('answer')
|
->setName('answer')
|
||||||
->setLabel('Answer')
|
->setLabel('Answer')
|
||||||
->setError(true)
|
->setError(true)
|
||||||
->setID('answer-content')
|
->setID('answer-content'))
|
||||||
->setEnableDragAndDropFileUploads(true))
|
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSubmitControl())
|
id(new AphrontFormSubmitControl())
|
||||||
->setValue($is_serious ? 'Submit' : 'Make it so.'));
|
->setValue($is_serious ? 'Submit' : 'Make it so.'));
|
||||||
|
|
|
@ -60,8 +60,7 @@ final class PonderAddCommentView extends AphrontView {
|
||||||
->addHiddenInput('question_id', $questionID)
|
->addHiddenInput('question_id', $questionID)
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormTextAreaControl())
|
id(new AphrontFormTextAreaControl())
|
||||||
->setName('content')
|
->setName('content'))
|
||||||
->setEnableDragAndDropFileUploads(false))
|
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSubmitControl())
|
id(new AphrontFormSubmitControl())
|
||||||
->setValue($is_serious ? 'Submit' : 'Editorialize'));
|
->setValue($is_serious ? 'Submit' : 'Editorialize'));
|
||||||
|
|
|
@ -48,11 +48,6 @@ class AphrontFormTextAreaControl extends AphrontFormControl {
|
||||||
return 'aphront-form-control-textarea';
|
return 'aphront-form-control-textarea';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setEnableDragAndDropFileUploads($enable) {
|
|
||||||
$this->enableDragAndDropFileUploads = $enable;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCustomClass($custom_class) {
|
public function setCustomClass($custom_class) {
|
||||||
$this->customClass = $custom_class;
|
$this->customClass = $custom_class;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -74,20 +69,6 @@ class AphrontFormTextAreaControl extends AphrontFormControl {
|
||||||
$classes[] = $this->customClass;
|
$classes[] = $this->customClass;
|
||||||
$classes = trim(implode(' ', $classes));
|
$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(
|
return phutil_render_tag(
|
||||||
'textarea',
|
'textarea',
|
||||||
array(
|
array(
|
||||||
|
@ -96,7 +77,7 @@ class AphrontFormTextAreaControl extends AphrontFormControl {
|
||||||
'readonly' => $this->getReadonly() ? 'readonly' : null,
|
'readonly' => $this->getReadonly() ? 'readonly' : null,
|
||||||
'class' => $classes,
|
'class' => $classes,
|
||||||
'style' => $this->getControlStyle(),
|
'style' => $this->getControlStyle(),
|
||||||
'id' => $id,
|
'id' => $this->getID(),
|
||||||
),
|
),
|
||||||
phutil_escape_html($this->getValue()));
|
phutil_escape_html($this->getValue()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,19 @@
|
||||||
final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
|
final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
|
||||||
|
|
||||||
protected function renderInput() {
|
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-remarkup-assist', array());
|
||||||
Javelin::initBehavior('phabricator-tooltips', array());
|
Javelin::initBehavior('phabricator-tooltips', array());
|
||||||
|
|
Loading…
Reference in a new issue