Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
旅途_2012
vscode
提交
3490cfe9
V
vscode
项目概览
旅途_2012
/
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,发现更多精彩内容 >>
提交
3490cfe9
编写于
6月 21, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make sure we dismiss the zoom status bar entry when switching editors
上级
2155c063
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
26 deletion
+25
-26
src/vs/workbench/browser/parts/editor/binaryEditor.ts
src/vs/workbench/browser/parts/editor/binaryEditor.ts
+3
-5
src/vs/workbench/browser/parts/editor/resourceViewer.ts
src/vs/workbench/browser/parts/editor/resourceViewer.ts
+19
-15
src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts
...rkbench/contrib/files/browser/editors/binaryFileEditor.ts
+3
-6
未找到文件。
src/vs/workbench/browser/parts/editor/binaryEditor.ts
浏览文件 @
3490cfe9
...
...
@@ -20,8 +20,7 @@ import { dispose } from 'vs/base/common/lifecycle';
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IStatusbarService
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
interface
IOpenCallbacks
{
openInternal
:
(
input
:
EditorInput
,
options
:
EditorOptions
)
=>
Promise
<
void
>
;
...
...
@@ -53,8 +52,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
@
IFileService
private
readonly
fileService
:
IFileService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
@
IStorageService
storageService
:
IStorageService
,
@
IStatusbarService
private
readonly
statusbarService
:
IStatusbarService
,
@
IContextMenuService
private
readonly
contextMenuService
:
IContextMenuService
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
)
{
super
(
id
,
telemetryService
,
themeService
,
storageService
);
...
...
@@ -101,7 +99,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
openInternalClb
:
()
=>
this
.
handleOpenInternalCallback
(
input
,
options
),
openExternalClb
:
this
.
environmentService
.
configuration
.
remoteAuthority
?
undefined
:
resource
=>
this
.
callbacks
.
openExternal
(
resource
),
metadataClb
:
meta
=>
this
.
handleMetadataChanged
(
meta
)
},
this
.
statusbarService
,
this
.
contextMenu
Service
);
},
this
.
instantiation
Service
);
}
private
async
handleOpenInternalCallback
(
input
:
EditorInput
,
options
:
EditorOptions
):
Promise
<
void
>
{
...
...
src/vs/workbench/browser/parts/editor/resourceViewer.ts
浏览文件 @
3490cfe9
...
...
@@ -19,6 +19,8 @@ import { memoize } from 'vs/base/common/decorators';
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IStatusbarEntry
,
IStatusbarEntryAccessor
,
IStatusbarService
,
StatusbarAlignment
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
interface
IResourceDescriptor
{
readonly
resource
:
URI
;
...
...
@@ -79,8 +81,7 @@ export class ResourceViewer {
container
:
HTMLElement
,
scrollbar
:
DomScrollableElement
,
delegate
:
ResourceViewerDelegate
,
statusbarService
:
IStatusbarService
,
contextMenuService
:
IContextMenuService
instantiationService
:
IInstantiationService
,
):
ResourceViewerContext
{
// Ensure CSS class
...
...
@@ -88,7 +89,7 @@ export class ResourceViewer {
// Images
if
(
ResourceViewer
.
isImageResource
(
descriptor
))
{
return
ImageView
.
create
(
container
,
descriptor
,
fileService
,
scrollbar
,
delegate
,
statusbarService
,
contextMenu
Service
);
return
ImageView
.
create
(
container
,
descriptor
,
fileService
,
scrollbar
,
delegate
,
instantiation
Service
);
}
// Large Files
...
...
@@ -120,11 +121,10 @@ class ImageView {
fileService
:
IFileService
,
scrollbar
:
DomScrollableElement
,
delegate
:
ResourceViewerDelegate
,
statusbarService
:
IStatusbarService
,
contextMenuService
:
IContextMenuService
instantiationService
:
IInstantiationService
,
):
ResourceViewerContext
{
if
(
ImageView
.
shouldShowImageInline
(
descriptor
))
{
return
InlineImageView
.
create
(
container
,
descriptor
,
fileService
,
scrollbar
,
delegate
,
statusbarService
,
contextMenu
Service
);
return
InlineImageView
.
create
(
container
,
descriptor
,
fileService
,
scrollbar
,
delegate
,
instantiation
Service
);
}
return
LargeImageView
.
create
(
container
,
descriptor
,
delegate
);
...
...
@@ -237,15 +237,22 @@ type Scale = number | 'fit';
export
class
ZoomStatusbarItem
extends
Disposable
{
private
statusbarItem
:
IStatusbarEntryAccessor
;
private
statusbarItem
?
:
IStatusbarEntryAccessor
;
onSelectScale
?:
(
scale
:
Scale
)
=>
void
;
constructor
(
private
readonly
contextMenuService
:
IContextMenuService
,
private
readonly
statusbarService
:
IStatusbarService
@
IEditorService
editorService
:
IEditorService
,
@
IContextMenuService
private
readonly
contextMenuService
:
IContextMenuService
,
@
IStatusbarService
private
readonly
statusbarService
:
IStatusbarService
,
)
{
super
();
this
.
_register
(
editorService
.
onDidActiveEditorChange
(()
=>
{
if
(
this
.
statusbarItem
)
{
this
.
statusbarItem
.
dispose
();
this
.
statusbarItem
=
undefined
;
}
}));
}
updateStatusbar
(
scale
:
Scale
,
onSelectScale
?:
(
scale
:
Scale
)
=>
void
):
void
{
...
...
@@ -263,7 +270,6 @@ export class ZoomStatusbarItem extends Disposable {
this
.
_register
(
this
.
statusbarItem
);
const
element
=
document
.
getElementById
(
'
status.imageZoom
'
)
!
;
this
.
_register
(
DOM
.
addDisposableListener
(
element
,
DOM
.
EventType
.
CLICK
,
(
e
:
MouseEvent
)
=>
{
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
element
,
...
...
@@ -344,13 +350,11 @@ class InlineImageView {
fileService
:
IFileService
,
scrollbar
:
DomScrollableElement
,
delegate
:
ResourceViewerDelegate
,
statusbarService
:
IStatusbarService
,
contextMenuService
:
IContextMenuService
@
IInstantiationService
instantiationService
:
IInstantiationService
,
)
{
const
disposables
=
new
DisposableStore
();
const
zoomStatusbarItem
=
new
ZoomStatusbarItem
(
contextMenuService
,
statusbarService
);
disposables
.
add
(
zoomStatusbarItem
);
const
zoomStatusbarItem
=
disposables
.
add
(
instantiationService
.
createInstance
(
ZoomStatusbarItem
));
const
context
:
ResourceViewerContext
=
{
layout
(
dimension
:
DOM
.
Dimension
)
{
},
...
...
@@ -408,8 +412,8 @@ class InlineImageView {
});
InlineImageView
.
imageStateCache
.
set
(
cacheKey
,
{
scale
:
scale
,
offsetX
:
newScrollLeft
,
offsetY
:
newScrollTop
});
}
zoomStatusbarItem
.
updateStatusbar
(
scale
,
updateScale
);
scrollbar
.
scanDomNode
();
}
...
...
src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts
浏览文件 @
3490cfe9
...
...
@@ -16,8 +16,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IStatusbarService
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
/**
* An implementation of editor for binary files like images.
...
...
@@ -34,8 +33,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
@
IStorageService
storageService
:
IStorageService
,
@
IFileService
fileService
:
IFileService
,
@
IWorkbenchEnvironmentService
environmentService
:
IWorkbenchEnvironmentService
,
@
IStatusbarService
statusbarService
:
IStatusbarService
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
@
IInstantiationService
instantiationService
:
IInstantiationService
,
)
{
super
(
BinaryFileEditor
.
ID
,
...
...
@@ -48,8 +46,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
fileService
,
environmentService
,
storageService
,
statusbarService
,
contextMenuService
instantiationService
,
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录