Merge from vscode 2a36b7d0d527bf408bae4f96b8386db9d9455113 (#10237)

This commit is contained in:
Anthony Dresser
2020-04-30 23:41:35 -07:00
committed by GitHub
parent d7a425239b
commit cebbd04d10
60 changed files with 361 additions and 240 deletions

View File

@@ -576,6 +576,15 @@ export class CompositeDragAndDropObserver extends Disposable {
private constructor() {
super();
this.transferData = LocalSelectionTransfer.getInstance<DraggedCompositeIdentifier | DraggedViewIdentifier>();
this._register(this._onDragEnd.event(e => {
const id = e.dragAndDropData.getData().id;
const type = e.dragAndDropData.getData().type;
const data = this.readDragData(type);
if (data && data.getData().id === id) {
this.transferData.clearData(type === 'view' ? DraggedViewIdentifier.prototype : DraggedCompositeIdentifier.prototype);
}
}));
}
private readDragData(type: ViewType): CompositeDragAndDropData | undefined {
if (this.transferData.hasData(type === 'view' ? DraggedViewIdentifier.prototype : DraggedCompositeIdentifier.prototype)) {
@@ -658,12 +667,8 @@ export class CompositeDragAndDropObserver extends Disposable {
}));
disposableStore.add(new DragAndDropObserver(element, {
onDragEnd: e => {
const { id, type } = draggedItemProvider();
const { type } = draggedItemProvider();
const data = this.readDragData(type);
if (data && data.getData().id === id) {
this.transferData.clearData(type === 'view' ? DraggedViewIdentifier.prototype : DraggedCompositeIdentifier.prototype);
}
if (!data) {
return;