Probably after D25052: Add and use new RemarkupMetadata class, sometime I get this JavaScript error in the console:
Error: Empty ID passed to JX.$()! $E core.pkg.js:27 $ core.pkg.js:3201 construct RemarkupMetadata.js:18
The problem seems caused by RemarkupMetadata.js on line 18:
I report it here for historical reasons:
/** * @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 = {}; } if (!JX.RemarkupMetadata._metadataValue.hasOwnProperty(metadataID)) { JX.RemarkupMetadata._metadataValue[metadataID] = metadataValue; } this._metadataNode = JX.$(metadataID); // ← problematic line this._metadataID = metadataID; },
That is called from behavior-drag-and-drop-textarea.js line 30:
JX.behavior('aphront-drag-and-drop-textarea', function(config) { var target = JX.$(config.target); if (JX.PhabricatorDragAndDropFileUpload.isSupported()) { var drop = new JX.PhabricatorDragAndDropFileUpload(target) .setURI(config.uri) .setChunkThreshold(config.chunkThreshold); drop.listen('didBeginDrag', function() { JX.DOM.alterClass(target, config.activatedClass, true); }); drop.listen('didEndDrag', function() { JX.DOM.alterClass(target, config.activatedClass, false); }); drop.listen('didUpload', function(file) { JX.TextAreaUtils.insertFileReference(target, file); // TODO: ↓ probably this line needs a NULL check on config.remarkupMetadataID var metadata = new JX.RemarkupMetadata(config.remarkupMetadataValue, config.remarkupMetadataID);
Steps to reproduce
- Open the Persistent Chat
- Drag & Drop a file there