Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
095b208f
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,发现更多精彩内容 >>
提交
095b208f
编写于
6月 24, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use webview in extension editor
fixes #7977 fixes #7970
上级
51f2d539
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
196 addition
and
17 deletion
+196
-17
src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts
...ench/parts/extensions/electron-browser/extensionEditor.ts
+31
-7
src/vs/workbench/parts/extensions/electron-browser/media/extensionEditor.css
...rts/extensions/electron-browser/media/extensionEditor.css
+2
-10
src/vs/workbench/parts/extensions/electron-browser/media/markdown.css
...ench/parts/extensions/electron-browser/media/markdown.css
+163
-0
未找到文件。
src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts
浏览文件 @
095b208f
...
...
@@ -18,6 +18,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IRequestService
}
from
'
vs/platform/request/common/request
'
;
import
{
IExtensionGalleryService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IThemeService
}
from
'
vs/workbench/services/themes/common/themeService
'
;
import
{
ExtensionsInput
}
from
'
./extensionsInput
'
;
import
{
IExtensionsWorkbenchService
,
IExtensionsViewlet
,
VIEWLET_ID
}
from
'
./extensions
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
...
...
@@ -28,8 +29,18 @@ import { shell } from 'electron';
import
product
from
'
vs/platform/product
'
;
import
{
ActionBar
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
CombinedInstallAction
,
UpdateAction
}
from
'
./extensionsActions
'
;
const
actionOptions
=
{
icon
:
true
,
label
:
true
};
import
WebView
from
'
vs/workbench/parts/html/browser/webview
'
;
function
renderBody
(
body
:
string
):
string
{
return
`<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<link rel="stylesheet" type="text/css" href="
${
require
.
toUrl
(
'
./media/markdown.css
'
)
}
" >
</head>
<body>
${
body
}
</body>
</html>`
;
}
export
class
ExtensionEditor
extends
BaseEditor
{
...
...
@@ -58,7 +69,8 @@ export class ExtensionEditor extends BaseEditor {
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IRequestService
private
requestService
:
IRequestService
,
@
IViewletService
private
viewletService
:
IViewletService
,
@
IExtensionsWorkbenchService
private
extensionsWorkbenchService
:
IExtensionsWorkbenchService
@
IExtensionsWorkbenchService
private
extensionsWorkbenchService
:
IExtensionsWorkbenchService
,
@
IThemeService
private
themeService
:
IThemeService
)
{
super
(
ExtensionEditor
.
ID
,
telemetryService
);
this
.
_highlight
=
null
;
...
...
@@ -96,6 +108,7 @@ export class ExtensionEditor extends BaseEditor {
const
actions
=
append
(
details
,
$
(
'
.actions
'
));
this
.
actionBar
=
new
ActionBar
(
actions
,
{
animated
:
false
});
this
.
disposables
.
push
(
this
.
actionBar
);
this
.
body
=
append
(
root
,
$
(
'
.body
'
));
}
...
...
@@ -103,8 +116,6 @@ export class ExtensionEditor extends BaseEditor {
setInput
(
input
:
ExtensionsInput
,
options
:
EditorOptions
):
TPromise
<
void
>
{
this
.
transientDisposables
=
dispose
(
this
.
transientDisposables
);
this
.
body
.
innerHTML
=
''
;
let
promise
=
TPromise
.
as
(
null
);
const
extension
=
input
.
extension
;
...
...
@@ -136,9 +147,10 @@ export class ExtensionEditor extends BaseEditor {
const
installAction
=
this
.
instantiationService
.
createInstance
(
CombinedInstallAction
,
extension
);
const
updateAction
=
this
.
instantiationService
.
createInstance
(
UpdateAction
,
extension
);
this
.
actionBar
.
clear
();
this
.
actionBar
.
push
([
updateAction
,
installAction
],
actionOptions
);
this
.
actionBar
.
push
([
updateAction
,
installAction
],
{
icon
:
true
,
label
:
true
}
);
this
.
transientDisposables
.
push
(
updateAction
,
installAction
);
this
.
body
.
innerHTML
=
''
;
addClass
(
this
.
body
,
'
loading
'
);
if
(
extension
.
readmeUrl
)
{
...
...
@@ -146,7 +158,19 @@ export class ExtensionEditor extends BaseEditor {
.
then
(()
=>
this
.
requestService
.
makeRequest
({
url
:
extension
.
readmeUrl
}))
.
then
(
response
=>
response
.
responseText
)
.
then
(
marked
.
parse
)
.
then
<
void
>
(
html
=>
this
.
body
.
innerHTML
=
html
)
.
then
<
void
>
(
body
=>
{
const
webview
=
new
WebView
(
this
.
body
,
document
.
querySelector
(
'
.monaco-editor-background
'
),
link
=>
shell
.
openExternal
(
link
.
toString
())
);
webview
.
style
(
this
.
themeService
.
getTheme
());
webview
.
contents
=
[
renderBody
(
body
)];
const
listener
=
this
.
themeService
.
onDidThemeChange
(
themeId
=>
webview
.
style
(
themeId
));
this
.
transientDisposables
.
push
(
webview
,
listener
);
})
.
then
(
null
,
()
=>
null
)
.
then
(()
=>
removeClass
(
this
.
body
,
'
loading
'
));
}
...
...
src/vs/workbench/parts/extensions/electron-browser/media/extensionEditor.css
浏览文件 @
095b208f
...
...
@@ -6,8 +6,6 @@
.extension-editor
{
height
:
100%
;
overflow
:
hidden
;
display
:
flex
;
flex-direction
:
column
;
}
.extension-editor
a
{
...
...
@@ -104,14 +102,8 @@
}
.extension-editor
>
.body
{
flex
:
1
;
overflow-y
:
scroll
;
overflow-x
:
hidden
;
padding
:
20px
;
}
.extension-editor
>
.body
img
{
max-width
:
100%
;
height
:
calc
(
100%
-
168px
);
overflow
:
hidden
;
}
.extension-editor
>
.body.loading
{
...
...
src/vs/workbench/parts/extensions/electron-browser/media/markdown.css
0 → 100644
浏览文件 @
095b208f
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
body
{
font-family
:
"Segoe WPC"
,
"Segoe UI"
,
"SFUIText-Light"
,
"HelveticaNeue-Light"
,
sans-serif
,
"Droid Sans Fallback"
;
font-size
:
14px
;
padding
:
10px
20px
;
line-height
:
22px
;
}
img
{
max-width
:
100%
;
max-height
:
100%
;
}
a
{
color
:
#4080D0
;
text-decoration
:
none
;
}
a
:focus
,
input
:focus
,
select
:focus
,
textarea
:focus
{
outline
:
1px
solid
-webkit-focus-ring-color
;
outline-offset
:
-1px
;
}
hr
{
border
:
0
;
height
:
2px
;
border-bottom
:
2px
solid
;
}
h1
{
padding-bottom
:
0.3em
;
line-height
:
1.2
;
border-bottom-width
:
1px
;
border-bottom-style
:
solid
;
}
h1
,
h2
,
h3
{
font-weight
:
normal
;
}
a
:hover
{
color
:
#4080D0
;
text-decoration
:
underline
;
}
table
{
border-collapse
:
collapse
;
}
table
>
thead
>
tr
>
th
{
text-align
:
left
;
border-bottom
:
1px
solid
;
}
table
>
thead
>
tr
>
th
,
table
>
thead
>
tr
>
td
,
table
>
tbody
>
tr
>
th
,
table
>
tbody
>
tr
>
td
{
padding
:
5px
10px
;
}
table
>
tbody
>
tr
+
tr
>
td
{
border-top
:
1px
solid
;
}
blockquote
{
margin
:
0
7px
0
5px
;
padding
:
0
16px
0
10px
;
border-left
:
5px
solid
;
}
code
{
font-family
:
Menlo
,
Monaco
,
Consolas
,
"Droid Sans Mono"
,
"Courier New"
,
monospace
,
"Droid Sans Fallback"
;
font-size
:
14px
;
line-height
:
19px
;
}
.mac
code
{
font-size
:
12px
;
line-height
:
18px
;
}
code
>
div
{
padding
:
16px
;
border-radius
:
3px
;
overflow
:
auto
;
}
/** Theming */
.vscode-light
{
color
:
rgb
(
30
,
30
,
30
);
}
.vscode-dark
{
color
:
#DDD
;
}
.vscode-high-contrast
{
color
:
white
;
}
.vscode-light
code
{
color
:
#A31515
;
}
.vscode-dark
code
{
color
:
#D7BA7D
;
}
.vscode-light
code
>
div
{
background-color
:
rgba
(
220
,
220
,
220
,
0.4
);
}
.vscode-dark
code
>
div
{
background-color
:
rgba
(
10
,
10
,
10
,
0.4
);
}
.vscode-high-contrast
code
>
div
{
background-color
:
rgb
(
0
,
0
,
0
);
}
.vscode-high-contrast
h1
{
border-color
:
rgb
(
0
,
0
,
0
);
}
.vscode-light
table
>
thead
>
tr
>
th
{
border-color
:
rgba
(
0
,
0
,
0
,
0.69
);
}
.vscode-dark
table
>
thead
>
tr
>
th
{
border-color
:
rgba
(
255
,
255
,
255
,
0.69
);
}
.vscode-light
h1
,
.vscode-light
hr
,
.vscode-light
table
>
tbody
>
tr
+
tr
>
td
{
border-color
:
rgba
(
0
,
0
,
0
,
0.18
);
}
.vscode-dark
h1
,
.vscode-dark
hr
,
.vscode-dark
table
>
tbody
>
tr
+
tr
>
td
{
border-color
:
rgba
(
255
,
255
,
255
,
0.18
);
}
.vscode-light
blockquote
,
.vscode-dark
blockquote
{
background
:
rgba
(
127
,
127
,
127
,
0.1
);
border-color
:
rgba
(
0
,
122
,
204
,
0.5
);
}
.vscode-high-contrast
blockquote
{
background
:
transparent
;
border-color
:
#fff
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录