Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
cdc37119
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,发现更多精彩内容 >>
未验证
提交
cdc37119
编写于
5月 08, 2020
作者:
C
Connor Peet
提交者:
GitHub
5月 08, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
notebooks: rerender output if the webview reloads (#97282)
上级
11f2cb77
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
40 addition
and
6 deletion
+40
-6
src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts
...ntrib/notebook/browser/view/renderers/backLayerWebView.ts
+24
-5
src/vs/workbench/contrib/webview/browser/baseWebviewElement.ts
...s/workbench/contrib/webview/browser/baseWebviewElement.ts
+8
-0
src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts
...ch/contrib/webview/browser/dynamicWebviewEditorOverlay.ts
+4
-0
src/vs/workbench/contrib/webview/browser/pre/main.js
src/vs/workbench/contrib/webview/browser/pre/main.js
+2
-0
src/vs/workbench/contrib/webview/browser/webview.ts
src/vs/workbench/contrib/webview/browser/webview.ts
+1
-0
src/vs/workbench/contrib/webview/electron-browser/pre/electron-index.js
...ch/contrib/webview/electron-browser/pre/electron-index.js
+1
-1
未找到文件。
src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts
浏览文件 @
cdc37119
...
...
@@ -77,6 +77,7 @@ export interface ICreationRequestMessage {
outputId
:
string
;
top
:
number
;
left
:
number
;
initiallyHidden
?:
boolean
;
}
export
interface
IContentWidgetTopRequest
{
...
...
@@ -105,6 +106,13 @@ export interface IUpdatePreloadResourceMessage {
resources
:
string
[];
}
interface
ICachedInset
{
outputId
:
string
;
cell
:
CodeCellViewModel
;
preloads
:
ReadonlySet
<
number
>
;
cachedCreation
:
ICreationRequestMessage
;
}
function
html
(
strings
:
TemplateStringsArray
,
...
values
:
any
[]):
string
{
let
str
=
''
;
strings
.
forEach
((
string
,
i
)
=>
{
...
...
@@ -119,7 +127,7 @@ let version = 0;
export
class
BackLayerWebView
extends
Disposable
{
element
:
HTMLElement
;
webview
!
:
WebviewElement
;
insetMapping
:
Map
<
IOutput
,
{
outputId
:
string
,
cell
:
CodeCellViewModel
,
cacheOffset
:
number
|
undefined
}
>
=
new
Map
();
insetMapping
:
Map
<
IOutput
,
ICachedInset
>
=
new
Map
();
hiddenInsetMapping
:
Set
<
IOutput
>
=
new
Set
();
reversedInsetMapping
:
Map
<
string
,
IOutput
>
=
new
Map
();
preloadsCache
:
Map
<
string
,
boolean
>
=
new
Map
();
...
...
@@ -378,6 +386,9 @@ ${loaderJs}
height: outputNode.clientHeight
}
});
// don't hide until after this step so that the height is right
cellOutputContainer.style.display = event.data.initiallyHidden ? 'none' : 'block';
}
break;
case 'view-scroll':
...
...
@@ -461,6 +472,14 @@ ${loaderJs}
this
.
openerService
.
open
(
link
,
{
fromUserGesture
:
true
});
}));
this
.
_register
(
this
.
webview
.
onDidReload
(()
=>
{
this
.
preloadsCache
.
clear
();
for
(
const
[
output
,
inset
]
of
this
.
insetMapping
.
entries
())
{
this
.
updateRendererPreloads
(
inset
.
preloads
);
this
.
webview
.
sendMessage
({
...
inset
.
cachedCreation
,
initiallyHidden
:
this
.
hiddenInsetMapping
.
has
(
output
)
});
}
}));
this
.
_register
(
this
.
webview
.
onMessage
((
data
:
IMessage
)
=>
{
if
(
data
.
__vscode_notebook_message
)
{
if
(
data
.
type
===
'
dimension
'
)
{
...
...
@@ -550,7 +569,7 @@ ${loaderJs}
return
true
;
}
if
(
outputOffset
===
outputCache
.
cache
Offset
)
{
if
(
outputOffset
===
outputCache
.
cache
dCreation
.
top
)
{
return
false
;
}
...
...
@@ -564,7 +583,7 @@ ${loaderJs}
let
outputIndex
=
item
.
cell
.
outputs
.
indexOf
(
item
.
output
);
let
outputOffset
=
item
.
cellTop
+
item
.
cell
.
getOutputOffset
(
outputIndex
);
outputCache
.
cache
Offset
=
outputOffset
;
outputCache
.
cache
dCreation
.
top
=
outputOffset
;
this
.
hiddenInsetMapping
.
delete
(
item
.
output
);
return
{
...
...
@@ -614,7 +633,7 @@ ${loaderJs}
};
this
.
webview
.
sendMessage
(
message
);
this
.
insetMapping
.
set
(
output
,
{
outputId
:
outputId
,
cell
:
cell
,
cacheOffset
:
initialTop
});
this
.
insetMapping
.
set
(
output
,
{
outputId
:
outputId
,
cell
:
cell
,
preloads
,
cachedCreation
:
message
});
this
.
hiddenInsetMapping
.
delete
(
output
);
this
.
reversedInsetMapping
.
set
(
outputId
,
output
);
}
...
...
@@ -669,7 +688,7 @@ ${loaderJs}
},
50
);
}
updateRendererPreloads
(
preloads
:
Set
<
number
>
)
{
updateRendererPreloads
(
preloads
:
Readonly
Set
<
number
>
)
{
let
resources
:
string
[]
=
[];
let
extensionLocations
:
URI
[]
=
[];
preloads
.
forEach
(
preload
=>
{
...
...
src/vs/workbench/contrib/webview/browser/baseWebviewElement.ts
浏览文件 @
cdc37119
...
...
@@ -21,6 +21,7 @@ export const enum WebviewMessageChannels {
didScroll
=
'
did-scroll
'
,
didFocus
=
'
did-focus
'
,
didBlur
=
'
did-blur
'
,
didLoad
=
'
did-load
'
,
doUpdateState
=
'
do-update-state
'
,
doReload
=
'
do-reload
'
,
loadResource
=
'
load-resource
'
,
...
...
@@ -153,6 +154,9 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
private
readonly
_onDidClickLink
=
this
.
_register
(
new
Emitter
<
string
>
());
public
readonly
onDidClickLink
=
this
.
_onDidClickLink
.
event
;
private
readonly
_onDidReload
=
this
.
_register
(
new
Emitter
<
void
>
());
public
readonly
onDidReload
=
this
.
_onDidReload
.
event
;
private
readonly
_onMessage
=
this
.
_register
(
new
Emitter
<
any
>
());
public
readonly
onMessage
=
this
.
_onMessage
.
event
;
...
...
@@ -216,6 +220,10 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
public
reload
():
void
{
this
.
doUpdateContent
();
const
subscription
=
this
.
_register
(
this
.
on
(
WebviewMessageChannels
.
didLoad
,
()
=>
{
this
.
_onDidReload
.
fire
();
subscription
.
dispose
();
}));
}
public
set
html
(
value
:
string
)
{
...
...
src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts
浏览文件 @
cdc37119
...
...
@@ -130,6 +130,7 @@ export class DynamicWebviewEditorOverlay extends Disposable implements WebviewOv
this
.
_webviewEvents
.
add
(
webview
.
onMessage
(
x
=>
{
this
.
_onMessage
.
fire
(
x
);
}));
this
.
_webviewEvents
.
add
(
webview
.
onMissingCsp
(
x
=>
{
this
.
_onMissingCsp
.
fire
(
x
);
}));
this
.
_webviewEvents
.
add
(
webview
.
onDidWheel
(
x
=>
{
this
.
_onDidWheel
.
fire
(
x
);
}));
this
.
_webviewEvents
.
add
(
webview
.
onDidReload
(()
=>
{
this
.
_onDidReload
.
fire
();
}));
this
.
_webviewEvents
.
add
(
webview
.
onDidScroll
(
x
=>
{
this
.
_initialScrollProgress
=
x
.
scrollYPercentage
;
...
...
@@ -189,6 +190,9 @@ export class DynamicWebviewEditorOverlay extends Disposable implements WebviewOv
private
readonly
_onDidClickLink
=
this
.
_register
(
new
Emitter
<
string
>
());
public
readonly
onDidClickLink
:
Event
<
string
>
=
this
.
_onDidClickLink
.
event
;
private
readonly
_onDidReload
=
this
.
_register
(
new
Emitter
<
void
>
());
public
readonly
onDidReload
=
this
.
_onDidReload
.
event
;
private
readonly
_onDidScroll
=
this
.
_register
(
new
Emitter
<
{
scrollYPercentage
:
number
;
}
>
());
public
readonly
onDidScroll
:
Event
<
{
scrollYPercentage
:
number
;
}
>
=
this
.
_onDidScroll
.
event
;
...
...
src/vs/workbench/contrib/webview/browser/pre/main.js
浏览文件 @
cdc37119
...
...
@@ -517,6 +517,8 @@
});
pendingMessages
=
[];
}
host
.
postMessage
(
'
did-load
'
);
};
/**
...
...
src/vs/workbench/contrib/webview/browser/webview.ts
浏览文件 @
cdc37119
...
...
@@ -84,6 +84,7 @@ export interface Webview extends IDisposable {
readonly
onDidScroll
:
Event
<
{
scrollYPercentage
:
number
}
>
;
readonly
onDidWheel
:
Event
<
IMouseWheelEvent
>
;
readonly
onDidUpdateState
:
Event
<
string
|
undefined
>
;
readonly
onDidReload
:
Event
<
void
>
;
readonly
onMessage
:
Event
<
any
>
;
readonly
onMissingCsp
:
Event
<
ExtensionIdentifier
>
;
...
...
src/vs/workbench/contrib/webview/electron-browser/pre/electron-index.js
浏览文件 @
cdc37119
...
...
@@ -79,4 +79,4 @@
});
require
(
'
../../browser/pre/main
'
)(
host
);
}());
\ No newline at end of file
}());
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录