Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3b1dad55
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,发现更多精彩内容 >>
提交
3b1dad55
编写于
1月 19, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use absolute paths for webview core resources
Fixes #41887
上级
d3e2fe7c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
22 deletion
+17
-22
src/vs/workbench/parts/extensions/browser/extensionEditor.ts
src/vs/workbench/parts/extensions/browser/extensionEditor.ts
+3
-7
src/vs/workbench/parts/html/browser/webview.ts
src/vs/workbench/parts/html/browser/webview.ts
+11
-10
src/vs/workbench/parts/update/electron-browser/releaseNotesEditor.ts
...bench/parts/update/electron-browser/releaseNotesEditor.ts
+3
-5
未找到文件。
src/vs/workbench/parts/extensions/browser/extensionEditor.ts
浏览文件 @
3b1dad55
...
...
@@ -53,7 +53,6 @@ import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRe
import
{
Color
}
from
'
vs/base/common/color
'
;
import
{
WorkbenchTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
URI
from
'
vs/base/common/uri
'
;
/** A context key that is set when an extension editor webview has focus. */
export
const
KEYBINDING_CONTEXT_EXTENSIONEDITOR_WEBVIEW_FOCUS
=
new
RawContextKey
<
boolean
>
(
'
extensionEditorWebviewFocus
'
,
undefined
);
...
...
@@ -64,11 +63,8 @@ export const KEYBINDING_CONTEXT_EXTENSIONEDITOR_FIND_WIDGET_INPUT_FOCUSED = new
/** A context key that is set when the find widget find input in extension editor webview is not focused. */
export
const
KEYBINDING_CONTEXT_EXTENSIONEDITOR_FIND_WIDGET_INPUT_NOT_FOCUSED
:
ContextKeyExpr
=
KEYBINDING_CONTEXT_EXTENSIONEDITOR_FIND_WIDGET_INPUT_FOCUSED
.
toNegated
();
function
renderBody
(
body
:
string
,
environmentService
:
IEnvironmentService
):
string
{
const
styleSheetPath
=
require
.
toUrl
(
'
./media/markdown.css
'
).
replace
(
URI
.
file
(
environmentService
.
appRoot
).
toString
(
true
),
'
vscode-core-resource://
'
);
function
renderBody
(
body
:
string
):
string
{
const
styleSheetPath
=
require
.
toUrl
(
'
./media/markdown.css
'
).
replace
(
'
file://
'
,
'
vscode-core-resource://
'
);
return
`<!DOCTYPE html>
<html>
<head>
...
...
@@ -415,7 +411,7 @@ export class ExtensionEditor extends BaseEditor {
private
openMarkdown
(
content
:
TPromise
<
string
>
,
noContentCopy
:
string
)
{
return
this
.
loadContents
(()
=>
content
.
then
(
marked
.
parse
)
.
then
(
content
=>
renderBody
(
content
,
this
.
environmentService
)
)
.
then
(
renderBody
)
.
then
(
removeEmbeddedSVGs
)
.
then
<
void
>
(
body
=>
{
const
allowedBadgeProviders
=
this
.
extensionsWorkbenchService
.
allowedBadgeProviders
;
...
...
src/vs/workbench/parts/html/browser/webview.ts
浏览文件 @
3b1dad55
...
...
@@ -15,7 +15,7 @@ import { WebviewFindWidget } from './webviewFindWidget';
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
normalize
,
join
,
nativeSep
}
from
'
vs/base/common/paths
'
;
import
{
normalize
,
nativeSep
}
from
'
vs/base/common/paths
'
;
import
{
startsWith
}
from
'
vs/base/common/strings
'
;
export
interface
WebviewElementFindInPageOptions
{
...
...
@@ -102,7 +102,7 @@ export default class Webview {
const
contents
=
this
.
_webview
.
getWebContents
();
if
(
contents
&&
!
contents
.
isDestroyed
())
{
registerFileProtocol
(
contents
,
'
vscode-core-resource
'
,
this
.
_environmentService
.
appRoot
+
nativeSep
);
registerFileProtocol
(
contents
,
'
vscode-core-resource
'
,
[
this
.
_environmentService
.
appRoot
]
);
}
}));
}
...
...
@@ -417,20 +417,21 @@ export default class Webview {
function
registerFileProtocol
(
contents
:
Electron
.
WebContents
,
protocol
:
string
,
root
:
string
root
s
:
string
[]
)
{
contents
.
session
.
protocol
.
registerFileProtocol
(
protocol
,
(
request
,
callback
:
any
)
=>
{
const
requestPath
=
URI
.
parse
(
request
.
url
).
path
;
const
normalizedPath
=
normalize
(
join
(
root
,
requestPath
),
true
);
if
(
startsWith
(
normalizedPath
,
root
))
{
callback
({
path
:
normalizedPath
});
}
else
{
callback
({
error
:
'
Cannot load resource outside of protocol root
'
});
for
(
const
root
of
roots
)
{
const
normalizedPath
=
normalize
(
requestPath
,
true
);
if
(
startsWith
(
normalizedPath
,
root
+
nativeSep
))
{
callback
({
path
:
normalizedPath
});
return
;
}
}
callback
({
error
:
'
Cannot load resource outside of protocol root
'
});
},
(
error
)
=>
{
if
(
error
)
{
console
.
error
(
'
Failed to register protocol
'
+
protocol
);
}
});
}
}
\ No newline at end of file
src/vs/workbench/parts/update/electron-browser/releaseNotesEditor.ts
浏览文件 @
3b1dad55
...
...
@@ -28,14 +28,12 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
addGAParameters
}
from
'
vs/platform/telemetry/node/telemetryNodeUtils
'
;
import
{
generateTokensCSSForColorMap
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
import
URI
from
'
vs/base/common/uri
'
;
function
renderBody
(
body
:
string
,
css
:
string
,
environmentService
:
IEnvironmentService
css
:
string
):
string
{
const
styleSheetPath
=
require
.
toUrl
(
'
./media/markdown.css
'
).
replace
(
URI
.
file
(
environmentService
.
appRoot
).
toString
(
true
)
,
'
vscode-core-resource://
'
);
const
styleSheetPath
=
require
.
toUrl
(
'
./media/markdown.css
'
).
replace
(
'
file://
'
,
'
vscode-core-resource://
'
);
return
`<!DOCTYPE html>
<html>
<head>
...
...
@@ -105,7 +103,7 @@ export class ReleaseNotesEditor extends WebviewEditor {
const
colorMap
=
TokenizationRegistry
.
getColorMap
();
const
css
=
generateTokensCSSForColorMap
(
colorMap
);
const
body
=
renderBody
(
marked
(
text
,
{
renderer
}),
css
,
this
.
environmentService
);
const
body
=
renderBody
(
marked
(
text
,
{
renderer
}),
css
);
this
.
_webview
=
new
WebView
(
this
.
content
,
this
.
partService
.
getContainer
(
Parts
.
EDITOR_PART
),
this
.
environmentService
,
this
.
_contextViewService
,
this
.
contextKey
,
this
.
findInputFocusContextKey
,
{},
false
);
if
(
this
.
input
&&
this
.
input
instanceof
ReleaseNotesInput
)
{
const
state
=
this
.
loadViewState
(
this
.
input
.
version
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录