Add exclude list for internal only dnd mime types

Fixes #145657
This commit is contained in:
Alex Ross 2022-03-22 15:56:47 +01:00
parent c4370d1887
commit 8e35e11e0e
No known key found for this signature in database
GPG key ID: 89DDDBA66CBA7840

View file

@ -1263,6 +1263,7 @@ interface TreeDragSourceInfo {
}
const TREE_DRAG_UUID_MIME = 'tree-dnd';
const INTERNAL_MIME_TYPES = ['codeeditors'];
export class CustomTreeViewDragAndDrop implements ITreeDragAndDrop<ITreeItem> {
private readonly treeMimeType: string;
@ -1338,8 +1339,8 @@ export class CustomTreeViewDragAndDrop implements ITreeDragAndDrop<ITreeItem> {
}
private debugLog(originalEvent: DragEvent) {
const types = originalEvent.dataTransfer?.types.filter((_value, index) => {
return (originalEvent.dataTransfer?.items[index].kind === 'string');
const types = originalEvent.dataTransfer?.types.filter((value, index) => {
return (originalEvent.dataTransfer?.items[index].kind === 'string') && (INTERNAL_MIME_TYPES.indexOf(value) < 0);
});
if (types?.length) {
this.logService.debug(`TreeView dragged mime types: ${types.join(', ')}`);
@ -1421,7 +1422,10 @@ export class CustomTreeViewDragAndDrop implements ITreeDragAndDrop<ITreeItem> {
} else if (type === TREE_DRAG_UUID_MIME) {
willDropUuid = dataValue;
}
if (dataValue && (type !== TREE_DRAG_UUID_MIME) && ((type === this.treeMimeType) || (dndController.dropMimeTypes.indexOf(type) >= 0))) {
if (dataValue
&& (type !== TREE_DRAG_UUID_MIME)
&& (INTERNAL_MIME_TYPES.indexOf(type) < 0)
&& ((type === this.treeMimeType) || (dndController.dropMimeTypes.indexOf(type) >= 0))) {
treeDataTransfer.set(type, {
asString: () => Promise.resolve(dataValue),
value: undefined