Page MenuHomePhorge

D25052.1734625102.diff
No OneTemporary

D25052.1734625102.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -10,10 +10,10 @@
'conpherence.pkg.css' => '0e3cf785',
'conpherence.pkg.js' => '020aebcf',
'core.pkg.css' => '80481fe6',
- 'core.pkg.js' => 'd2de90d9',
+ 'core.pkg.js' => '531554bb',
'dark-console.pkg.js' => '187792c2',
'differential.pkg.css' => 'ffb69e3d',
- 'differential.pkg.js' => 'c60bec1b',
+ 'differential.pkg.js' => '5e49e0e6',
'diffusion.pkg.css' => '42c75c37',
'diffusion.pkg.js' => '78c9885d',
'maniphest.pkg.css' => '35995d6d',
@@ -461,6 +461,7 @@
'rsrc/js/core/MultirowRowManager.js' => '5b54c823',
'rsrc/js/core/Notification.js' => 'a9b91e3f',
'rsrc/js/core/Prefab.js' => '5793d835',
+ 'rsrc/js/core/RemarkupMetadata.js' => 'f4936a54',
'rsrc/js/core/ShapedRequest.js' => '995f5102',
'rsrc/js/core/TextAreaUtils.js' => 'f340a484',
'rsrc/js/core/Title.js' => '43bc9360',
@@ -473,7 +474,7 @@
'rsrc/js/core/behavior-copy.js' => 'cf32921f',
'rsrc/js/core/behavior-detect-timezone.js' => '78bc5d94',
'rsrc/js/core/behavior-device.js' => 'ac2b1e01',
- 'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '3277c62d',
+ 'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '3fde4753',
'rsrc/js/core/behavior-fancy-datepicker.js' => 'b545d0a0',
'rsrc/js/core/behavior-form.js' => '55d7b788',
'rsrc/js/core/behavior-gesture.js' => 'b58d1a2a',
@@ -489,7 +490,7 @@
'rsrc/js/core/behavior-more.js' => '506aa3f4',
'rsrc/js/core/behavior-object-selector.js' => '98ef467f',
'rsrc/js/core/behavior-oncopy.js' => 'da8f5259',
- 'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => '54262396',
+ 'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => 'b4bd5eaa',
'rsrc/js/core/behavior-read-only-warning.js' => 'b9109f8f',
'rsrc/js/core/behavior-redirect.js' => '407ee861',
'rsrc/js/core/behavior-refresh-csrf.js' => '46116c01',
@@ -589,7 +590,7 @@
'javelin-behavior-aphlict-listen' => '4e61fa88',
'javelin-behavior-aphlict-status' => 'c3703a16',
'javelin-behavior-aphront-basic-tokenizer' => '3b4899b0',
- 'javelin-behavior-aphront-drag-and-drop-textarea' => '3277c62d',
+ 'javelin-behavior-aphront-drag-and-drop-textarea' => '3fde4753',
'javelin-behavior-aphront-form-disable-on-submit' => '55d7b788',
'javelin-behavior-aphront-more' => '506aa3f4',
'javelin-behavior-audio-source' => '3dc5ad43',
@@ -653,7 +654,7 @@
'javelin-behavior-phabricator-notification-example' => '29819b75',
'javelin-behavior-phabricator-object-selector' => '98ef467f',
'javelin-behavior-phabricator-oncopy' => 'da8f5259',
- 'javelin-behavior-phabricator-remarkup-assist' => '54262396',
+ 'javelin-behavior-phabricator-remarkup-assist' => 'b4bd5eaa',
'javelin-behavior-phabricator-reveal-content' => 'b105a3a6',
'javelin-behavior-phabricator-search-typeahead' => '1cb7d027',
'javelin-behavior-phabricator-show-older-transactions' => '8b5c7d65',
@@ -800,6 +801,7 @@
'phabricator-phtize' => '2f1db1ed',
'phabricator-prefab' => '5793d835',
'phabricator-remarkup-css' => '5baa3bd9',
+ 'phabricator-remarkup-metadata' => 'f4936a54',
'phabricator-search-results-css' => '9ea70ace',
'phabricator-shaped-request' => '995f5102',
'phabricator-slowvote-css' => '1694baed',
@@ -1195,13 +1197,6 @@
'javelin-install',
'javelin-util',
),
- '3277c62d' => array(
- 'javelin-behavior',
- 'javelin-dom',
- 'javelin-json',
- 'phabricator-drag-and-drop-file-upload',
- 'phabricator-textareautils',
- ),
'32db8374' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1264,6 +1259,13 @@
'phabricator-drag-and-drop-file-upload',
'phabricator-draggable-list',
),
+ '3fde4753' => array(
+ 'javelin-behavior',
+ 'javelin-dom',
+ 'phabricator-drag-and-drop-file-upload',
+ 'phabricator-textareautils',
+ 'phabricator-remarkup-metadata',
+ ),
'407ee861' => array(
'javelin-behavior',
'javelin-uri',
@@ -1413,17 +1415,6 @@
'541f81c3' => array(
'javelin-install',
),
- 54262396 => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'phabricator-phtize',
- 'phabricator-textareautils',
- 'javelin-workflow',
- 'javelin-vector',
- 'phuix-autocomplete',
- 'javelin-mask',
- ),
'548567f6' => array(
'syntax-default-css',
),
@@ -1946,6 +1937,18 @@
'multirow-row-manager',
'trigger-rule',
),
+ 'b4bd5eaa' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'phabricator-phtize',
+ 'phabricator-textareautils',
+ 'phabricator-remarkup-metadata',
+ 'javelin-workflow',
+ 'javelin-vector',
+ 'phuix-autocomplete',
+ 'javelin-mask',
+ ),
'b517bfa0' => array(
'phui-oi-list-view-css',
),
@@ -2174,6 +2177,11 @@
'javelin-dom',
'javelin-vector',
),
+ 'f4936a54' => array(
+ 'javelin-install',
+ 'javelin-dom',
+ 'javelin-json',
+ ),
'f84bcbf4' => array(
'javelin-behavior',
'javelin-stratcom',
diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php
--- a/src/view/form/control/PhabricatorRemarkupControl.php
+++ b/src/view/form/control/PhabricatorRemarkupControl.php
@@ -128,6 +128,8 @@
'disabled' => $this->getDisabled(),
'sendOnEnter' => $this->getSendOnEnter(),
'rootID' => $root_id,
+ 'remarkupMetadataID' => $metadata_id,
+ 'remarkupMetadataValue' => $metadata_value,
'autocompleteMap' => (object)array(
64 => array( // "@"
'datasourceURI' => $user_datasource->getDatasourceURI(),
diff --git a/webroot/rsrc/js/core/RemarkupMetadata.js b/webroot/rsrc/js/core/RemarkupMetadata.js
new file mode 100644
--- /dev/null
+++ b/webroot/rsrc/js/core/RemarkupMetadata.js
@@ -0,0 +1,43 @@
+/**
+ * @requires javelin-install
+ * javelin-dom
+ * javelin-json
+ * @provides phabricator-remarkup-metadata
+ * @javelin
+ */
+
+JX.install('RemarkupMetadata', {
+
+ construct: function(metadataValue, metadataID) {
+ if(JX.RemarkupMetadata._metadataValue == null) {
+ JX.RemarkupMetadata._metadataValue = metadataValue;
+ }
+ this._metadataNode = JX.$(metadataID);
+ },
+
+ statics: {
+ _metadataValue: null
+ },
+
+ members: {
+ _metadataNode: null,
+
+ _writeMetadata: function() {
+ this._metadataNode.value = JX.JSON.stringify(
+ JX.RemarkupMetadata._metadataValue);
+ },
+
+ getMetadata: function(key, default_value) {
+ if (JX.RemarkupMetadata._metadataValue.hasOwnProperty(key)) {
+ return JX.RemarkupMetadata._metadataValue[key];
+ }
+ return default_value;
+ },
+
+ setMetadata: function(key, value) {
+ JX.RemarkupMetadata._metadataValue[key] = value;
+ this._writeMetadata();
+ }
+ }
+
+});
diff --git a/webroot/rsrc/js/core/behavior-drag-and-drop-textarea.js b/webroot/rsrc/js/core/behavior-drag-and-drop-textarea.js
--- a/webroot/rsrc/js/core/behavior-drag-and-drop-textarea.js
+++ b/webroot/rsrc/js/core/behavior-drag-and-drop-textarea.js
@@ -2,36 +2,15 @@
* @provides javelin-behavior-aphront-drag-and-drop-textarea
* @requires javelin-behavior
* javelin-dom
- * javelin-json
* phabricator-drag-and-drop-file-upload
* phabricator-textareautils
+ * phabricator-remarkup-metadata
*/
JX.behavior('aphront-drag-and-drop-textarea', function(config) {
var target = JX.$(config.target);
- var metadata_node = JX.$(config.remarkupMetadataID);
- var metadata_value = config.remarkupMetadataValue;
-
- function set_metadata(key, value) {
- metadata_value[key] = value;
- write_metadata();
- }
-
- function get_metadata(key, default_value) {
- if (metadata_value.hasOwnProperty(key)) {
- return metadata_value[key];
- }
- return default_value;
- }
-
- function write_metadata() {
- metadata_node.value = JX.JSON.stringify(metadata_value);
- }
-
- write_metadata();
-
if (JX.PhabricatorDragAndDropFileUpload.isSupported()) {
var drop = new JX.PhabricatorDragAndDropFileUpload(target)
.setURI(config.uri)
@@ -48,9 +27,11 @@
drop.listen('didUpload', function(file) {
JX.TextAreaUtils.insertFileReference(target, file);
- var phids = get_metadata('attachedFilePHIDs', []);
+ var metadata = new JX.RemarkupMetadata(config.remarkupMetadataValue,
+ config.remarkupMetadataID);
+ var phids = metadata.getMetadata('attachedFilePHIDs', []);
phids.push(file.getPHID());
- set_metadata('attachedFilePHIDs', phids);
+ metadata.setMetadata('attachedFilePHIDs', phids);
});
drop.start();
diff --git a/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js b/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js
--- a/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js
+++ b/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js
@@ -5,6 +5,7 @@
* javelin-dom
* phabricator-phtize
* phabricator-textareautils
+ * phabricator-remarkup-metadata
* javelin-workflow
* javelin-vector
* phuix-autocomplete
@@ -255,6 +256,12 @@
.setURI(file.uri);
JX.TextAreaUtils.insertFileReference(area, upload);
+
+ var metadata = new JX.RemarkupMetadata(
+ config.remarkupMetadataValue, config.remarkupMetadataID);
+ var phids = metadata.getMetadata('attachedFilePHIDs', []);
+ phids.push(file.phid);
+ metadata.setMetadata('attachedFilePHIDs', phids);
}
})
.start();

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 16:18 (8 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1015162
Default Alt Text
D25052.1734625102.diff (9 KB)

Event Timeline