Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8ddffb5c
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8ddffb5c
编写于
2月 09, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix some dnd issues after getting feedback
上级
ecc90f44
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
11 deletion
+18
-11
src/vs/workbench/browser/dnd.ts
src/vs/workbench/browser/dnd.ts
+11
-6
src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
...ench/parts/files/electron-browser/views/explorerViewer.ts
+5
-3
src/vs/workbench/parts/files/electron-browser/views/openEditorsView.ts
...nch/parts/files/electron-browser/views/openEditorsView.ts
+2
-2
未找到文件。
src/vs/workbench/browser/dnd.ts
浏览文件 @
8ddffb5c
...
...
@@ -373,7 +373,10 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources:
}
// Resource URLs: allows to drop multiple resources to a target in VS Code (not directories)
event
.
dataTransfer
.
setData
(
DataTransfers
.
RESOURCES
,
JSON
.
stringify
(
sources
.
filter
(
s
=>
!
s
.
isDirectory
).
map
(
s
=>
s
.
resource
.
toString
())));
const
files
=
sources
.
filter
(
s
=>
!
s
.
isDirectory
);
if
(
files
.
length
)
{
event
.
dataTransfer
.
setData
(
DataTransfers
.
RESOURCES
,
JSON
.
stringify
(
files
.
map
(
f
=>
f
.
resource
.
toString
())));
}
// Editors: enables cross window DND of tabs into the editor area
const
textFileService
=
accessor
.
get
(
ITextFileService
);
...
...
@@ -381,7 +384,7 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources:
const
editorService
=
accessor
.
get
(
IWorkbenchEditorService
);
const
draggedEditors
:
ISerializedDraggedEditor
[]
=
[];
sources
.
forEach
(
sourc
e
=>
{
files
.
forEach
(
fil
e
=>
{
// Try to find editor view state from the visible editors that match given resource
let
viewState
:
IEditorViewState
;
...
...
@@ -391,7 +394,7 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources:
const
codeEditor
=
getCodeEditor
(
editor
);
if
(
codeEditor
)
{
const
model
=
codeEditor
.
getModel
();
if
(
model
&&
model
.
uri
&&
model
.
uri
.
toString
()
===
sourc
e
.
resource
.
toString
())
{
if
(
model
&&
model
.
uri
&&
model
.
uri
.
toString
()
===
fil
e
.
resource
.
toString
())
{
viewState
=
codeEditor
.
saveViewState
();
break
;
}
...
...
@@ -400,13 +403,15 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources:
// Add as dragged editor
draggedEditors
.
push
({
resource
:
sourc
e
.
resource
.
toString
(),
backupResource
:
textFileService
.
isDirty
(
source
.
resource
)
?
backupFileService
.
toBackupResource
(
sourc
e
.
resource
).
toString
()
:
void
0
,
resource
:
fil
e
.
resource
.
toString
(),
backupResource
:
textFileService
.
isDirty
(
file
.
resource
)
?
backupFileService
.
toBackupResource
(
fil
e
.
resource
).
toString
()
:
void
0
,
viewState
});
});
event
.
dataTransfer
.
setData
(
CodeDataTransfers
.
EDITORS
,
JSON
.
stringify
(
draggedEditors
));
if
(
draggedEditors
.
length
)
{
event
.
dataTransfer
.
setData
(
CodeDataTransfers
.
EDITORS
,
JSON
.
stringify
(
draggedEditors
));
}
}
/**
...
...
src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
浏览文件 @
8ddffb5c
...
...
@@ -50,7 +50,7 @@ import { attachInputBoxStyler } from 'vs/platform/theme/common/styler';
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWorkspaceEditingService
}
from
'
vs/workbench/services/workspace/common/workspaceEditing
'
;
import
{
extractResources
,
SimpleFileResourceDragAndDrop
,
CodeDataTransfers
}
from
'
vs/workbench/browser/dnd
'
;
import
{
extractResources
,
SimpleFileResourceDragAndDrop
,
CodeDataTransfers
,
fillResourceDataTransfers
}
from
'
vs/workbench/browser/dnd
'
;
import
{
relative
}
from
'
path
'
;
import
{
distinctParents
}
from
'
vs/base/common/resources
'
;
import
{
WorkbenchTree
,
WorkbenchTreeController
}
from
'
vs/platform/list/browser/listService
'
;
...
...
@@ -729,12 +729,14 @@ export class FileDragAndDrop extends SimpleFileResourceDragAndDrop {
});
// Apply some datatransfer types to allow for dragging the element outside of the application
super
.
onDragStart
(
tree
,
data
,
originalEvent
);
this
.
instantiationService
.
invokeFunction
(
fillResourceDataTransfers
,
sources
,
originalEvent
);
// The only custom data transfer we set from the explorer is a file transfer
// to be able to DND between multiple code file explorers across windows
const
fileResources
=
sources
.
filter
(
s
=>
!
s
.
isDirectory
&&
s
.
resource
.
scheme
===
Schemas
.
file
).
map
(
r
=>
r
.
resource
.
fsPath
);
originalEvent
.
dataTransfer
.
setData
(
CodeDataTransfers
.
FILES
,
JSON
.
stringify
(
fileResources
));
if
(
fileResources
.
length
)
{
originalEvent
.
dataTransfer
.
setData
(
CodeDataTransfers
.
FILES
,
JSON
.
stringify
(
fileResources
));
}
}
}
...
...
src/vs/workbench/parts/files/electron-browser/views/openEditorsView.ts
浏览文件 @
8ddffb5c
...
...
@@ -544,16 +544,16 @@ class OpenEditorRenderer implements IRenderer<OpenEditor, IOpenEditorTemplateDat
editorTemplate
.
toDispose
=
[];
editorTemplate
.
toDispose
.
push
(
dom
.
addDisposableListener
(
container
,
dom
.
EventType
.
DRAG_START
,
(
e
:
DragEvent
)
=>
{
const
dragged
=
<
OpenEditor
[]
>
this
.
getSelectedElements
().
filter
(
e
=>
e
instanceof
OpenEditor
&&
!!
e
.
getResource
());
const
dragImage
=
document
.
createElement
(
'
div
'
);
e
.
dataTransfer
.
effectAllowed
=
'
copyMove
'
;
dragImage
.
className
=
'
monaco-tree-drag-image
'
;
dragImage
.
textContent
=
editorTemplate
.
openEditor
.
editor
.
getName
(
);
dragImage
.
textContent
=
dragged
.
length
===
1
?
editorTemplate
.
openEditor
.
editor
.
getName
()
:
String
(
dragged
.
length
);
document
.
body
.
appendChild
(
dragImage
);
e
.
dataTransfer
.
setDragImage
(
dragImage
,
-
10
,
-
10
);
setTimeout
(()
=>
document
.
body
.
removeChild
(
dragImage
),
0
);
const
dragged
=
<
OpenEditor
[]
>
this
.
getSelectedElements
().
filter
(
e
=>
e
instanceof
OpenEditor
&&
!!
e
.
getResource
());
this
.
transfer
.
setData
(
dragged
,
OpenEditor
.
prototype
);
if
(
editorTemplate
.
openEditor
&&
editorTemplate
.
openEditor
.
editor
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录