Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
67a3b0af
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
67a3b0af
编写于
10月 30, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dnd - disable desktop drop in certain cases (fixes #83578)
上级
a5837a8e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
20 deletion
+36
-20
src/vs/workbench/browser/dnd.ts
src/vs/workbench/browser/dnd.ts
+20
-0
src/vs/workbench/browser/parts/editor/editorDropTarget.ts
src/vs/workbench/browser/parts/editor/editorDropTarget.ts
+7
-2
src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
...s/workbench/contrib/files/browser/views/explorerViewer.ts
+3
-9
src/vs/workbench/contrib/files/browser/views/openEditorsView.ts
.../workbench/contrib/files/browser/views/openEditorsView.ts
+6
-9
未找到文件。
src/vs/workbench/browser/dnd.ts
浏览文件 @
67a3b0af
...
...
@@ -476,3 +476,23 @@ export class DragAndDropObserver extends Disposable {
}));
}
}
export
function
containsDragType
(
event
:
DragEvent
,
...
dragTypesToFind
:
string
[]):
boolean
{
if
(
!
event
.
dataTransfer
)
{
return
false
;
}
const
dragTypes
=
event
.
dataTransfer
.
types
;
const
lowercaseDragTypes
:
string
[]
=
[];
for
(
let
i
=
0
;
i
<
dragTypes
.
length
;
i
++
)
{
lowercaseDragTypes
.
push
(
dragTypes
[
i
].
toLowerCase
());
// somehow the types are lowercase
}
for
(
const
dragType
of
dragTypesToFind
)
{
if
(
lowercaseDragTypes
.
indexOf
(
dragType
.
toLowerCase
())
>=
0
)
{
return
true
;
}
}
return
false
;
}
src/vs/workbench/browser/parts/editor/editorDropTarget.ts
浏览文件 @
67a3b0af
...
...
@@ -4,19 +4,20 @@
*--------------------------------------------------------------------------------------------*/
import
'
vs/css!./media/editordroptarget
'
;
import
{
LocalSelectionTransfer
,
DraggedEditorIdentifier
,
ResourcesDropHandler
,
DraggedEditorGroupIdentifier
,
DragAndDropObserver
}
from
'
vs/workbench/browser/dnd
'
;
import
{
LocalSelectionTransfer
,
DraggedEditorIdentifier
,
ResourcesDropHandler
,
DraggedEditorGroupIdentifier
,
DragAndDropObserver
,
containsDragType
}
from
'
vs/workbench/browser/dnd
'
;
import
{
addDisposableListener
,
EventType
,
EventHelper
,
isAncestor
,
toggleClass
,
addClass
,
removeClass
}
from
'
vs/base/browser/dom
'
;
import
{
IEditorGroupsAccessor
,
EDITOR_TITLE_HEIGHT
,
IEditorGroupView
,
getActiveTextEditorOptions
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
EDITOR_DRAG_AND_DROP_BACKGROUND
,
Themable
}
from
'
vs/workbench/common/theme
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
activeContrastBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
IEditorIdentifier
,
EditorInput
,
EditorOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
isMacintosh
,
isWeb
}
from
'
vs/base/common/platform
'
;
import
{
GroupDirection
,
MergeGroupMode
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
find
}
from
'
vs/base/common/arrays
'
;
import
{
DataTransfers
}
from
'
vs/base/browser/dnd
'
;
interface
IDropOperation
{
splitDirection
?:
GroupDirection
;
...
...
@@ -99,6 +100,10 @@ class DropOverlay extends Themable {
this
.
_register
(
new
DragAndDropObserver
(
this
.
container
,
{
onDragEnter
:
e
=>
undefined
,
onDragOver
:
e
=>
{
if
(
isWeb
&&
containsDragType
(
e
,
DataTransfers
.
FILES
))
{
return
;
// dropping files into editor is unsupported on web
}
const
isDraggingGroup
=
this
.
groupTransfer
.
hasData
(
DraggedEditorGroupIdentifier
.
prototype
);
const
isDraggingEditor
=
this
.
editorTransfer
.
hasData
(
DraggedEditorIdentifier
.
prototype
);
...
...
src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
浏览文件 @
67a3b0af
...
...
@@ -30,7 +30,7 @@ import { equals, deepClone } from 'vs/base/common/objects';
import
*
as
path
from
'
vs/base/common/path
'
;
import
{
ExplorerItem
}
from
'
vs/workbench/contrib/files/common/explorerModel
'
;
import
{
compareFileExtensions
,
compareFileNames
}
from
'
vs/base/common/comparers
'
;
import
{
fillResourceDataTransfers
,
CodeDataTransfers
,
extractResources
}
from
'
vs/workbench/browser/dnd
'
;
import
{
fillResourceDataTransfers
,
CodeDataTransfers
,
extractResources
,
containsDragType
}
from
'
vs/workbench/browser/dnd
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IDragAndDropData
,
DataTransfers
}
from
'
vs/base/browser/dnd
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
...
...
@@ -473,14 +473,8 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
const
effect
=
(
fromDesktop
||
isCopy
)
?
ListDragOverEffect
.
Copy
:
ListDragOverEffect
.
Move
;
// Desktop DND
if
(
fromDesktop
&&
originalEvent
.
dataTransfer
)
{
const
types
=
originalEvent
.
dataTransfer
.
types
;
const
typesArray
:
string
[]
=
[];
for
(
let
i
=
0
;
i
<
types
.
length
;
i
++
)
{
typesArray
.
push
(
types
[
i
].
toLowerCase
());
// somehow the types are lowercase
}
if
(
typesArray
.
indexOf
(
DataTransfers
.
FILES
.
toLowerCase
())
===
-
1
&&
typesArray
.
indexOf
(
CodeDataTransfers
.
FILES
.
toLowerCase
())
===
-
1
)
{
if
(
fromDesktop
)
{
if
(
!
containsDragType
(
originalEvent
,
DataTransfers
.
FILES
,
CodeDataTransfers
.
FILES
))
{
return
false
;
}
}
...
...
src/vs/workbench/contrib/files/browser/views/openEditorsView.ts
浏览文件 @
67a3b0af
...
...
@@ -34,7 +34,7 @@ import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/m
import
{
IMenuService
,
MenuId
,
IMenu
}
from
'
vs/platform/actions/common/actions
'
;
import
{
DirtyEditorContext
,
OpenEditorsGroupContext
}
from
'
vs/workbench/contrib/files/browser/fileCommands
'
;
import
{
ResourceContextKey
}
from
'
vs/workbench/common/resources
'
;
import
{
ResourcesDropHandler
,
fillResourceDataTransfers
,
CodeDataTransfers
}
from
'
vs/workbench/browser/dnd
'
;
import
{
ResourcesDropHandler
,
fillResourceDataTransfers
,
CodeDataTransfers
,
containsDragType
}
from
'
vs/workbench/browser/dnd
'
;
import
{
ViewletPanel
,
IViewletPanelOptions
}
from
'
vs/workbench/browser/parts/views/panelViewlet
'
;
import
{
IViewletViewOptions
}
from
'
vs/workbench/browser/parts/views/viewsViewlet
'
;
import
{
IDragAndDropData
,
DataTransfers
}
from
'
vs/base/browser/dnd
'
;
...
...
@@ -42,6 +42,7 @@ import { memoize } from 'vs/base/common/decorators';
import
{
ElementsDragAndDropData
,
DesktopDragAndDropData
}
from
'
vs/base/browser/ui/list/listView
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
withNullAsUndefined
,
withUndefinedAsNull
}
from
'
vs/base/common/types
'
;
import
{
isWeb
}
from
'
vs/base/common/platform
'
;
const
$
=
dom
.
$
;
...
...
@@ -644,16 +645,12 @@ class OpenEditorsDragAndDrop implements IListDragAndDrop<OpenEditor | IEditorGro
}
onDragOver
(
data
:
IDragAndDropData
,
targetElement
:
OpenEditor
|
IEditorGroup
,
targetIndex
:
number
,
originalEvent
:
DragEvent
):
boolean
|
IListDragOverReaction
{
if
(
data
instanceof
DesktopDragAndDropData
&&
originalEvent
.
dataTransfer
)
{
const
types
=
originalEvent
.
dataTransfer
.
types
;
const
typesArray
:
string
[]
=
[];
for
(
let
i
=
0
;
i
<
types
.
length
;
i
++
)
{
typesArray
.
push
(
types
[
i
].
toLowerCase
());
// somehow the types are lowercase
if
(
data
instanceof
DesktopDragAndDropData
)
{
if
(
isWeb
)
{
return
false
;
// dropping files into editor is unsupported on web
}
if
(
typesArray
.
indexOf
(
DataTransfers
.
FILES
.
toLowerCase
())
===
-
1
&&
typesArray
.
indexOf
(
CodeDataTransfers
.
FILES
.
toLowerCase
())
===
-
1
)
{
return
false
;
}
return
containsDragType
(
originalEvent
,
DataTransfers
.
FILES
,
CodeDataTransfers
.
FILES
);
}
return
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录