Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/core/behavior-drag-and-drop-textarea.js
Show All 21 Lines | if (JX.PhabricatorDragAndDropFileUpload.isSupported()) { | ||||
drop.listen('didEndDrag', function() { | drop.listen('didEndDrag', function() { | ||||
JX.DOM.alterClass(target, config.activatedClass, false); | JX.DOM.alterClass(target, config.activatedClass, false); | ||||
}); | }); | ||||
drop.listen('didUpload', function(file) { | drop.listen('didUpload', function(file) { | ||||
JX.TextAreaUtils.insertFileReference(target, file); | JX.TextAreaUtils.insertFileReference(target, file); | ||||
if(config.remarkupMetadataID) { | |||||
// Try to auto-attach files by default | |||||
// https://we.phorge.it/T15106 | |||||
var metadata = new JX.RemarkupMetadata(config.remarkupMetadataValue, | var metadata = new JX.RemarkupMetadata(config.remarkupMetadataValue, | ||||
config.remarkupMetadataID); | config.remarkupMetadataID); | ||||
var phids = metadata.getMetadata('attachedFilePHIDs', []); | var phids = metadata.getMetadata('attachedFilePHIDs', []); | ||||
phids.push(file.getPHID()); | phids.push(file.getPHID()); | ||||
metadata.setMetadata('attachedFilePHIDs', phids); | metadata.setMetadata('attachedFilePHIDs', phids); | ||||
} | |||||
}); | }); | ||||
drop.start(); | drop.start(); | ||||
} | } | ||||
}); | }); |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0