Ensure drag/drop from the treeview works as expected on Firefox. Fixes #4429

This commit is contained in:
Aditya Toshniwal
2019-07-04 14:49:09 +01:00
committed by Dave Page
parent 15427334af
commit 0aa18fd466
3 changed files with 12 additions and 1 deletions

View File

@@ -366,13 +366,19 @@ define('tools.querytool', [
if(self.handler.is_query_tool) {
self.query_tool_obj.setOption('dragDrop', true);
self.query_tool_obj.on('drop', (editor, e) => {
/* Stop firefox from redirecting */
if(e.preventDefault) {
e.preventDefault();
}
if (e.stopPropagation) {
e.stopPropagation();
}
var cursor = editor.coordsChar({
left: e.x,
top: e.y,
});
var dropDetails = JSON.parse(e.dataTransfer.getData('text'));
e.codemirrorIgnore = true;
e.dataTransfer.clearData('text');
editor.replaceRange(dropDetails.text, cursor);
editor.focus();
editor.setSelection({