Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
831800d6
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,发现更多精彩内容 >>
提交
831800d6
编写于
10月 04, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make sure we also change webview theme data when editor config changes
上级
b9693027
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
31 addition
and
9 deletion
+31
-9
src/vs/workbench/contrib/webview/browser/webviewElement.ts
src/vs/workbench/contrib/webview/browser/webviewElement.ts
+1
-3
src/vs/workbench/contrib/webview/common/themeing.ts
src/vs/workbench/contrib/webview/common/themeing.ts
+25
-1
src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts
...kbench/contrib/webview/electron-browser/webviewElement.ts
+5
-5
未找到文件。
src/vs/workbench/contrib/webview/browser/webviewElement.ts
浏览文件 @
831800d6
...
@@ -12,7 +12,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
...
@@ -12,7 +12,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
ITunnelService
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
ITunnelService
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
Webview
,
WebviewContentOptions
,
WebviewOptions
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
Webview
,
WebviewContentOptions
,
WebviewOptions
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
areWebviewInputOptionsEqual
}
from
'
vs/workbench/contrib/webview/browser/webviewEditorService
'
;
import
{
areWebviewInputOptionsEqual
}
from
'
vs/workbench/contrib/webview/browser/webviewEditorService
'
;
import
{
WebviewPortMappingManager
}
from
'
vs/workbench/contrib/webview/common/portMapping
'
;
import
{
WebviewPortMappingManager
}
from
'
vs/workbench/contrib/webview/common/portMapping
'
;
...
@@ -46,7 +45,6 @@ export class IFrameWebview extends Disposable implements Webview {
...
@@ -46,7 +45,6 @@ export class IFrameWebview extends Disposable implements Webview {
options
:
WebviewOptions
,
options
:
WebviewOptions
,
contentOptions
:
WebviewContentOptions
,
contentOptions
:
WebviewContentOptions
,
private
readonly
webviewThemeDataProvider
:
WebviewThemeDataProvider
,
private
readonly
webviewThemeDataProvider
:
WebviewThemeDataProvider
,
@
IThemeService
themeService
:
IThemeService
,
@
ITunnelService
tunnelService
:
ITunnelService
,
@
ITunnelService
tunnelService
:
ITunnelService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
@
IFileService
private
readonly
fileService
:
IFileService
,
@
IFileService
private
readonly
fileService
:
IFileService
,
...
@@ -148,7 +146,7 @@ export class IFrameWebview extends Disposable implements Webview {
...
@@ -148,7 +146,7 @@ export class IFrameWebview extends Disposable implements Webview {
});
});
this
.
style
();
this
.
style
();
this
.
_register
(
themeService
.
onThemeChange
(
this
.
style
,
this
));
this
.
_register
(
webviewThemeDataProvider
.
onThemeDataChanged
(
this
.
style
,
this
));
}
}
private
get
externalEndpoint
():
string
{
private
get
externalEndpoint
():
string
{
...
...
src/vs/workbench/contrib/webview/common/themeing.ts
浏览文件 @
831800d6
...
@@ -9,6 +9,7 @@ import { EDITOR_FONT_DEFAULTS, IEditorOptions } from 'vs/editor/common/config/ed
...
@@ -9,6 +9,7 @@ import { EDITOR_FONT_DEFAULTS, IEditorOptions } from 'vs/editor/common/config/ed
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
*
as
colorRegistry
from
'
vs/platform/theme/common/colorRegistry
'
;
import
*
as
colorRegistry
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
DARK
,
ITheme
,
IThemeService
,
LIGHT
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
DARK
,
ITheme
,
IThemeService
,
LIGHT
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
interface
WebviewThemeData
{
interface
WebviewThemeData
{
readonly
activeTheme
:
string
;
readonly
activeTheme
:
string
;
...
@@ -17,14 +18,32 @@ interface WebviewThemeData {
...
@@ -17,14 +18,32 @@ interface WebviewThemeData {
export
class
WebviewThemeDataProvider
extends
Disposable
{
export
class
WebviewThemeDataProvider
extends
Disposable
{
private
static
readonly
MEMOIZER
=
createMemoizer
();
private
static
readonly
MEMOIZER
=
createMemoizer
();
private
readonly
_onThemeDataChanged
=
this
.
_register
(
new
Emitter
<
void
>
());
public
readonly
onThemeDataChanged
=
this
.
_onThemeDataChanged
.
event
;
constructor
(
constructor
(
@
IThemeService
private
readonly
_themeService
:
IThemeService
,
@
IThemeService
private
readonly
_themeService
:
IThemeService
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
,
)
{
)
{
super
();
super
();
this
.
_register
(
_themeService
.
onThemeChange
(()
=>
WebviewThemeDataProvider
.
MEMOIZER
.
clear
()));
this
.
_register
(
this
.
_themeService
.
onThemeChange
(()
=>
{
this
.
reset
();
}));
const
webviewConfigurationKeys
=
[
'
editor.fontFamily
'
,
'
editor.fontWeight
'
,
'
editor.fontSize
'
];
this
.
_register
(
this
.
_configurationService
.
onDidChangeConfiguration
(
e
=>
{
if
(
webviewConfigurationKeys
.
some
(
key
=>
e
.
affectsConfiguration
(
key
)))
{
this
.
reset
();
}
}));
}
public
getTheme
():
ITheme
{
return
this
.
_themeService
.
getTheme
();
}
}
@
WebviewThemeDataProvider
.
MEMOIZER
@
WebviewThemeDataProvider
.
MEMOIZER
...
@@ -56,6 +75,11 @@ export class WebviewThemeDataProvider extends Disposable {
...
@@ -56,6 +75,11 @@ export class WebviewThemeDataProvider extends Disposable {
const
activeTheme
=
ApiThemeClassName
.
fromTheme
(
theme
);
const
activeTheme
=
ApiThemeClassName
.
fromTheme
(
theme
);
return
{
styles
,
activeTheme
};
return
{
styles
,
activeTheme
};
}
}
private
reset
()
{
WebviewThemeDataProvider
.
MEMOIZER
.
clear
();
this
.
_onThemeDataChanged
.
fire
();
}
}
}
enum
ApiThemeClassName
{
enum
ApiThemeClassName
{
...
...
src/vs/workbench/contrib/webview/electron-browser/webviewElement.ts
浏览文件 @
831800d6
...
@@ -17,7 +17,7 @@ import { IFileService } from 'vs/platform/files/common/files';
...
@@ -17,7 +17,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ITunnelService
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
ITunnelService
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITheme
,
ITheme
Service
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
Webview
,
WebviewContentOptions
,
WebviewOptions
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
Webview
,
WebviewContentOptions
,
WebviewOptions
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
WebviewPortMappingManager
}
from
'
vs/workbench/contrib/webview/common/portMapping
'
;
import
{
WebviewPortMappingManager
}
from
'
vs/workbench/contrib/webview/common/portMapping
'
;
import
{
WebviewResourceScheme
}
from
'
vs/workbench/contrib/webview/common/resourceLoader
'
;
import
{
WebviewResourceScheme
}
from
'
vs/workbench/contrib/webview/common/resourceLoader
'
;
...
@@ -396,8 +396,8 @@ export class ElectronWebviewBasedWebview extends Disposable implements Webview,
...
@@ -396,8 +396,8 @@ export class ElectronWebviewBasedWebview extends Disposable implements Webview,
}));
}));
}
}
this
.
style
(
themeService
.
getTheme
()
);
this
.
style
();
this
.
_register
(
themeService
.
onThemeChange
(
this
.
style
,
this
));
this
.
_register
(
webviewThemeDataProvider
.
onThemeDataChanged
(
this
.
style
,
this
));
}
}
public
mountTo
(
parent
:
HTMLElement
)
{
public
mountTo
(
parent
:
HTMLElement
)
{
...
@@ -557,12 +557,12 @@ export class ElectronWebviewBasedWebview extends Disposable implements Webview,
...
@@ -557,12 +557,12 @@ export class ElectronWebviewBasedWebview extends Disposable implements Webview,
this
.
_send
(
'
message
'
,
data
);
this
.
_send
(
'
message
'
,
data
);
}
}
private
style
(
theme
:
ITheme
):
void
{
private
style
():
void
{
const
{
styles
,
activeTheme
}
=
this
.
webviewThemeDataProvider
.
getWebviewThemeData
();
const
{
styles
,
activeTheme
}
=
this
.
webviewThemeDataProvider
.
getWebviewThemeData
();
this
.
_send
(
'
styles
'
,
{
styles
,
activeTheme
});
this
.
_send
(
'
styles
'
,
{
styles
,
activeTheme
});
if
(
this
.
_webviewFindWidget
)
{
if
(
this
.
_webviewFindWidget
)
{
this
.
_webviewFindWidget
.
updateTheme
(
th
eme
);
this
.
_webviewFindWidget
.
updateTheme
(
th
is
.
webviewThemeDataProvider
.
getTheme
()
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录