提交 5817f67b 编写于 作者: B Benjamin Pasero

dnd - make sure to focus window first before handling drop

上级 4ca8eab3
...@@ -156,20 +156,23 @@ export class ResourcesDropHandler { ...@@ -156,20 +156,23 @@ export class ResourcesDropHandler {
return; return;
} }
return this.doHandleDrop(resources).then(isWorkspaceOpening => { // Make the window active to handle the drop properly within
if (isWorkspaceOpening) { return this.windowService.focusWindow().then(() => {
return void 0; // return early if the drop operation resulted in this window changing to a workspace
}
// Add external ones to recently open list unless dropped resource is a workspace // Check for special things being dropped
const externalResources = resources.filter(d => d.isExternal).map(d => d.resource); return this.doHandleDrop(resources).then(isWorkspaceOpening => {
if (externalResources.length) { if (isWorkspaceOpening) {
this.windowsService.addRecentlyOpened(externalResources.map(resource => resource.fsPath)); return void 0; // return early if the drop operation resulted in this window changing to a workspace
} }
// Open in Editor // Add external ones to recently open list unless dropped resource is a workspace
return this.windowService.focusWindow() const externalResources = resources.filter(d => d.isExternal).map(d => d.resource);
.then(() => this.editorService.openEditors(resources.map(r => { if (externalResources.length) {
this.windowsService.addRecentlyOpened(externalResources.map(resource => resource.fsPath));
}
// Open in Editor
return this.editorService.openEditors(resources.map(r => {
return { return {
input: { input: {
resource: r.resource, resource: r.resource,
...@@ -181,11 +184,12 @@ export class ResourcesDropHandler { ...@@ -181,11 +184,12 @@ export class ResourcesDropHandler {
}, },
position: targetPosition position: targetPosition
}; };
}))).then(() => { })).then(() => {
// Finish with provided function // Finish with provided function
afterDrop(); afterDrop();
}); });
});
}).done(null, onUnexpectedError); }).done(null, onUnexpectedError);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册