Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c7da9389
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,发现更多精彩内容 >>
提交
c7da9389
编写于
2月 20, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move theme change logic into webview itself
上级
cc3f1aad
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
10 addition
and
24 deletion
+10
-24
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
+1
-9
src/vs/workbench/parts/extensions/browser/extensionEditor.ts
src/vs/workbench/parts/extensions/browser/extensionEditor.ts
+1
-4
src/vs/workbench/parts/html/browser/htmlPreviewPart.ts
src/vs/workbench/parts/html/browser/htmlPreviewPart.ts
+1
-1
src/vs/workbench/parts/html/browser/webview.ts
src/vs/workbench/parts/html/browser/webview.ts
+6
-2
src/vs/workbench/parts/html/browser/webviewEditor.ts
src/vs/workbench/parts/html/browser/webviewEditor.ts
+0
-7
src/vs/workbench/parts/update/electron-browser/releaseNotesEditor.ts
...bench/parts/update/electron-browser/releaseNotesEditor.ts
+1
-1
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
浏览文件 @
c7da9389
...
...
@@ -204,7 +204,6 @@ class WebviewEditor extends BaseWebviewEditor {
enableWrappedPostMessage
:
true
};
this
.
webview
.
contents
=
input
.
html
;
this
.
webview
.
style
(
this
.
themeService
.
getTheme
());
}
private
get
webview
():
Webview
{
...
...
@@ -214,6 +213,7 @@ class WebviewEditor extends BaseWebviewEditor {
this
.
_webview
=
new
Webview
(
this
.
webviewContent
,
this
.
_partService
.
getContainer
(
Parts
.
EDITOR_PART
),
this
.
themeService
,
this
.
_environmentService
,
this
.
_contextService
,
this
.
_contextViewService
,
...
...
@@ -223,17 +223,9 @@ class WebviewEditor extends BaseWebviewEditor {
enableWrappedPostMessage
:
true
},
false
);
this
.
webview
.
style
(
this
.
themeService
.
getTheme
());
this
.
_webview
.
onDidClickLink
(
this
.
onDidClickLink
,
this
,
this
.
_contentDisposables
);
this
.
themeService
.
onThemeChange
(
theme
=>
{
if
(
this
.
_webview
)
{
this
.
_webview
.
style
(
theme
);
}
},
null
,
this
.
_contentDisposables
);
this
.
_webview
.
onMessage
(
message
=>
{
if
(
this
.
input
)
{
(
this
.
input
as
WebviewInput
).
events
.
onMessage
(
message
);
...
...
src/vs/workbench/parts/extensions/browser/extensionEditor.ts
浏览文件 @
c7da9389
...
...
@@ -421,11 +421,9 @@ export class ExtensionEditor extends BaseEditor {
.
then
<
void
>
(
body
=>
{
const
allowedBadgeProviders
=
this
.
extensionsWorkbenchService
.
allowedBadgeProviders
;
const
webViewOptions
=
allowedBadgeProviders
.
length
>
0
?
{
allowScripts
:
false
,
allowSvgs
:
false
,
svgWhiteList
:
allowedBadgeProviders
}
:
{};
this
.
activeWebview
=
new
Webview
(
this
.
content
,
this
.
partService
.
getContainer
(
Parts
.
EDITOR_PART
),
this
.
environmentService
,
this
.
contextService
,
this
.
contextViewService
,
this
.
contextKey
,
this
.
findInputFocusContextKey
,
webViewOptions
,
false
);
this
.
activeWebview
=
new
Webview
(
this
.
content
,
this
.
partService
.
getContainer
(
Parts
.
EDITOR_PART
),
this
.
themeService
,
this
.
environmentService
,
this
.
contextService
,
this
.
contextViewService
,
this
.
contextKey
,
this
.
findInputFocusContextKey
,
webViewOptions
,
false
);
const
removeLayoutParticipant
=
arrays
.
insert
(
this
.
layoutParticipants
,
this
.
activeWebview
);
this
.
contentDisposables
.
push
(
toDisposable
(
removeLayoutParticipant
));
this
.
activeWebview
.
style
(
this
.
themeService
.
getTheme
());
this
.
activeWebview
.
contents
=
body
;
this
.
activeWebview
.
onDidClickLink
(
link
=>
{
...
...
@@ -434,7 +432,6 @@ export class ExtensionEditor extends BaseEditor {
this
.
openerService
.
open
(
link
);
}
},
null
,
this
.
contentDisposables
);
this
.
themeService
.
onThemeChange
(
theme
=>
this
.
activeWebview
.
style
(
theme
),
null
,
this
.
contentDisposables
);
this
.
contentDisposables
.
push
(
this
.
activeWebview
);
})
.
then
(
null
,
()
=>
{
...
...
src/vs/workbench/parts/html/browser/htmlPreviewPart.ts
浏览文件 @
c7da9389
...
...
@@ -91,6 +91,7 @@ export class HtmlPreviewPart extends WebviewEditor {
this
.
_webview
=
new
Webview
(
this
.
content
,
this
.
partService
.
getContainer
(
Parts
.
EDITOR_PART
),
this
.
themeService
,
this
.
_environmentService
,
this
.
_contextService
,
this
.
_contextViewService
,
...
...
@@ -107,7 +108,6 @@ export class HtmlPreviewPart extends WebviewEditor {
const
resourceUri
=
this
.
input
.
getResource
();
this
.
webview
.
baseUrl
=
resourceUri
.
toString
(
true
);
}
this
.
_webview
.
style
(
this
.
themeService
.
getTheme
());
this
.
_webviewDisposables
=
[
this
.
_webview
,
this
.
_webview
.
onDidClickLink
(
uri
=>
this
.
openerService
.
open
(
uri
)),
...
...
src/vs/workbench/parts/html/browser/webview.ts
浏览文件 @
c7da9389
...
...
@@ -10,7 +10,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
addDisposableListener
,
addClass
}
from
'
vs/base/browser/dom
'
;
import
{
editorBackground
,
editorForeground
,
textLinkForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
ITheme
,
LIGHT
,
DARK
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
ITheme
,
LIGHT
,
DARK
,
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
WebviewFindWidget
}
from
'
./webviewFindWidget
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -38,6 +38,7 @@ export class Webview {
constructor
(
private
readonly
parent
:
HTMLElement
,
private
readonly
_styleElement
:
Element
,
private
readonly
_themeService
:
IThemeService
,
private
readonly
_environmentService
:
IEnvironmentService
,
private
readonly
_contextService
:
IWorkspaceContextService
,
private
readonly
_contextViewService
:
IContextViewService
,
...
...
@@ -178,6 +179,9 @@ export class Webview {
this
.
_webviewFindWidget
=
new
WebviewFindWidget
(
this
.
_contextViewService
,
this
);
this
.
_disposables
.
push
(
this
.
_webviewFindWidget
);
this
.
style
(
this
.
_themeService
.
getTheme
());
this
.
_themeService
.
onThemeChange
(
this
.
style
,
this
,
this
.
_disposables
);
if
(
parent
)
{
parent
.
appendChild
(
this
.
_webviewFindWidget
.
getDomNode
());
parent
.
appendChild
(
this
.
_webview
);
...
...
@@ -257,7 +261,7 @@ export class Webview {
});
}
style
(
theme
:
ITheme
):
void
{
private
style
(
theme
:
ITheme
):
void
{
const
{
fontFamily
,
fontWeight
,
fontSize
}
=
window
.
getComputedStyle
(
this
.
_styleElement
);
// TODO@theme avoid styleElement
const
styles
=
{
...
...
src/vs/workbench/parts/html/browser/webviewEditor.ts
浏览文件 @
c7da9389
...
...
@@ -74,13 +74,6 @@ export abstract class WebviewEditor extends BaseWebviewEditor {
}
}
public
updateStyles
()
{
super
.
updateStyles
();
if
(
this
.
_webview
)
{
this
.
_webview
.
style
(
this
.
themeService
.
getTheme
());
}
}
public
get
isWebviewEditor
()
{
return
true
;
}
...
...
src/vs/workbench/parts/update/electron-browser/releaseNotesEditor.ts
浏览文件 @
c7da9389
...
...
@@ -91,6 +91,7 @@ export class ReleaseNotesEditor extends WebviewEditor {
this
.
_webview
=
new
Webview
(
this
.
content
,
this
.
partService
.
getContainer
(
Parts
.
EDITOR_PART
),
this
.
themeService
,
this
.
environmentService
,
this
.
_contextService
,
this
.
_contextViewService
,
...
...
@@ -105,7 +106,6 @@ export class ReleaseNotesEditor extends WebviewEditor {
this
.
_webview
.
initialScrollProgress
=
state
.
scrollYPercentage
;
}
}
this
.
_webview
.
style
(
this
.
themeService
.
getTheme
());
this
.
_webview
.
contents
=
body
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录