Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3d53af15
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,发现更多精彩内容 >>
提交
3d53af15
编写于
2月 20, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move more notebook list logic out
上级
33f008e3
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
78 addition
and
26 deletion
+78
-26
src/vs/base/browser/ui/list/listWidget.ts
src/vs/base/browser/ui/list/listWidget.ts
+1
-14
src/vs/workbench/contrib/notebook/browser/notebookCellList.ts
...vs/workbench/contrib/notebook/browser/notebookCellList.ts
+65
-0
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+12
-12
未找到文件。
src/vs/base/browser/ui/list/listWidget.ts
浏览文件 @
3d53af15
...
...
@@ -572,10 +572,6 @@ export class MouseController<T> implements IDisposable {
}
private
onMouseDown
(
e
:
IListMouseEvent
<
T
>
|
IListTouchEvent
<
T
>
):
void
{
if
(
e
.
browserEvent
.
target
&&
this
.
list
.
view
.
domNode
.
contains
(
e
.
browserEvent
.
target
as
HTMLElement
))
{
return
;
}
if
(
document
.
activeElement
!==
e
.
browserEvent
.
target
)
{
this
.
list
.
domFocus
();
}
...
...
@@ -1120,7 +1116,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
private
focus
:
Trait
<
T
>
;
private
selection
:
Trait
<
T
>
;
private
eventBufferer
=
new
EventBufferer
();
p
ublic
view
:
ListView
<
T
>
;
p
rotected
view
:
ListView
<
T
>
;
private
spliceable
:
ISpliceable
<
T
>
;
private
styleController
:
IStyleController
;
private
typeLabelController
?:
TypeLabelController
<
T
>
;
...
...
@@ -1144,7 +1140,6 @@ export class List<T> implements ISpliceable<T>, IDisposable {
get
domId
():
string
{
return
this
.
view
.
domId
;
}
get
onDidScroll
():
Event
<
ScrollEvent
>
{
return
this
.
view
.
onDidScroll
;
}
get
onWillScroll
():
Event
<
ScrollEvent
>
{
return
this
.
view
.
onWillScroll
;
}
get
onMouseClick
():
Event
<
IListMouseEvent
<
T
>>
{
return
this
.
view
.
onMouseClick
;
}
get
onMouseDblClick
():
Event
<
IListMouseEvent
<
T
>>
{
return
this
.
view
.
onMouseDblClick
;
}
get
onMouseMiddleClick
():
Event
<
IListMouseEvent
<
T
>>
{
return
this
.
view
.
onMouseMiddleClick
;
}
...
...
@@ -1588,14 +1583,6 @@ export class List<T> implements ISpliceable<T>, IDisposable {
}
}
getAbsoluteTop
(
index
:
number
):
number
{
if
(
index
<
0
||
index
>=
this
.
length
)
{
throw
new
ListError
(
this
.
user
,
`Invalid index
${
index
}
`
);
}
return
this
.
view
.
elementTop
(
index
);
}
/**
* Returns the relative position of an element rendered in the list.
* Returns `null` if the element isn't *entirely* in the visible viewport.
...
...
src/vs/workbench/contrib/notebook/browser/notebookCellList.ts
0 → 100644
浏览文件 @
3d53af15
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IListRenderer
,
IListVirtualDelegate
,
ListError
}
from
'
vs/base/browser/ui/list/list
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IListService
,
IWorkbenchListOptions
,
WorkbenchList
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
export
class
NotebookCellList
<
T
>
extends
WorkbenchList
<
T
>
{
get
onWillScroll
():
Event
<
ScrollEvent
>
{
return
this
.
view
.
onWillScroll
;
}
get
rowsContainer
():
HTMLElement
{
return
this
.
view
.
rowsContainer
;
}
get
isRendering
():
boolean
{
return
this
.
view
.
isRendering
;
}
constructor
(
private
listUser
:
string
,
container
:
HTMLElement
,
delegate
:
IListVirtualDelegate
<
T
>
,
renderers
:
IListRenderer
<
T
,
any
>
[],
options
:
IWorkbenchListOptions
<
T
>
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IListService
listService
:
IListService
,
@
IThemeService
themeService
:
IThemeService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
)
{
super
(
listUser
,
container
,
delegate
,
renderers
,
options
,
contextKeyService
,
listService
,
themeService
,
configurationService
,
keybindingService
);
}
domElementAtIndex
(
index
:
number
):
HTMLElement
|
null
{
return
this
.
view
.
domElement
(
index
);
}
focusView
()
{
this
.
view
.
domNode
.
focus
();
}
domFocus
()
{
if
(
document
.
activeElement
&&
this
.
view
.
domNode
.
contains
(
document
.
activeElement
))
{
return
;
}
super
.
domFocus
();
}
getAbsoluteTop
(
index
:
number
):
number
{
if
(
index
<
0
||
index
>=
this
.
length
)
{
throw
new
ListError
(
this
.
listUser
,
`Invalid index
${
index
}
`
);
}
return
this
.
view
.
elementTop
(
index
);
}
}
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
3d53af15
...
...
@@ -15,7 +15,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
IContextKey
,
IContextKeyService
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
WorkbenchList
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
contrastBorder
,
editorBackground
,
focusBorder
,
foreground
,
textBlockQuoteBackground
,
textBlockQuoteBorder
,
textLinkActiveForeground
,
textLinkForeground
,
textPreformatForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
...
...
@@ -37,6 +36,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import
{
IEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
NotebookCellList
}
from
'
vs/workbench/contrib/notebook/browser/notebookCellList
'
;
const
$
=
DOM
.
$
;
const
NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY
=
'
NotebookEditorViewState
'
;
...
...
@@ -54,7 +54,7 @@ class NotebookCodeEditors implements ICompositeCodeEditor {
readonly
onDidChangeActiveEditor
:
Event
<
this
>
=
this
.
_onDidChangeActiveEditor
.
event
;
constructor
(
private
_list
:
Workbench
List
<
CellViewModel
>
,
private
_list
:
NotebookCell
List
<
CellViewModel
>
,
private
_renderedEditors
:
Map
<
CellViewModel
,
ICodeEditor
|
undefined
>
)
{
_list
.
onFocusChange
(
e
=>
this
.
_onDidChangeActiveEditor
.
fire
(
this
),
undefined
,
this
.
_disposables
);
...
...
@@ -114,7 +114,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
private
contentWidgets
!
:
HTMLElement
;
private
webview
:
BackLayerWebView
|
null
=
null
;
private
list
:
Workbench
List
<
CellViewModel
>
|
undefined
;
private
list
:
NotebookCell
List
<
CellViewModel
>
|
undefined
;
private
control
:
ICompositeCodeEditor
|
undefined
;
private
renderedEditors
:
Map
<
CellViewModel
,
ICodeEditor
|
undefined
>
=
new
Map
();
private
model
:
NotebookEditorModel
|
undefined
;
...
...
@@ -196,8 +196,8 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
this
.
instantiationService
.
createInstance
(
MarkdownCellRenderer
,
this
),
];
this
.
list
=
<
Workbench
List
<
CellViewModel
>>
this
.
instantiationService
.
createInstance
(
Workbench
List
,
this
.
list
=
<
NotebookCell
List
<
CellViewModel
>>
this
.
instantiationService
.
createInstance
(
NotebookCell
List
,
'
NotebookCellList
'
,
this
.
body
,
this
.
instantiationService
.
createInstance
(
NotebookCellListDelegate
),
...
...
@@ -233,7 +233,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
this
.
control
=
new
NotebookCodeEditors
(
this
.
list
,
this
.
renderedEditors
);
this
.
webview
=
new
BackLayerWebView
(
this
.
webviewService
,
this
.
notebookService
,
this
,
this
.
environmentSerice
);
this
.
list
.
view
.
rowsContainer
.
appendChild
(
this
.
webview
.
element
);
this
.
list
.
rowsContainer
.
appendChild
(
this
.
webview
.
element
);
this
.
_register
(
this
.
list
);
}
...
...
@@ -250,7 +250,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
if
(
this
.
webview
)
{
this
.
localStore
.
clear
();
this
.
list
?.
view
.
rowsContainer
.
removeChild
(
this
.
webview
?.
element
);
this
.
list
?.
rowsContainer
.
removeChild
(
this
.
webview
?.
element
);
this
.
webview
?.
dispose
();
this
.
webview
=
null
;
}
...
...
@@ -302,7 +302,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
this
.
webview
?.
clearPreloadsCache
();
}
else
{
this
.
webview
=
new
BackLayerWebView
(
this
.
webviewService
,
this
.
notebookService
,
this
,
this
.
environmentSerice
);
this
.
list
?.
view
.
rowsContainer
.
insertAdjacentElement
(
'
afterbegin
'
,
this
.
webview
!
.
element
);
this
.
list
?.
rowsContainer
.
insertAdjacentElement
(
'
afterbegin
'
,
this
.
webview
!
.
element
);
}
this
.
model
=
model
;
...
...
@@ -407,7 +407,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
}
};
if
(
this
.
list
?.
view
.
isRendering
)
{
if
(
this
.
list
?.
isRendering
)
{
// if (this.relayoutDisposable) {
// this.relayoutDisposable.dispose();
// this.relayoutDisposable = null;
...
...
@@ -428,7 +428,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
}));
});
if
(
this
.
list
?.
view
.
isRendering
)
{
if
(
this
.
list
?.
isRendering
)
{
// if (this.relayoutDisposable) {
// this.relayoutDisposable.dispose();
// this.relayoutDisposable = null;
...
...
@@ -493,7 +493,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
if
(
focusEditor
)
{
}
else
{
let
itemDOM
=
this
.
list
?.
view
.
domElement
(
index
);
let
itemDOM
=
this
.
list
?.
domElementAtIndex
(
index
);
if
(
document
.
activeElement
&&
itemDOM
&&
itemDOM
.
contains
(
document
.
activeElement
))
{
(
document
.
activeElement
as
HTMLElement
).
blur
();
}
...
...
@@ -502,7 +502,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
}
this
.
list
?.
setFocus
([
index
]);
this
.
list
?.
view
.
domNode
.
focus
();
this
.
list
?.
focusView
();
}
async
deleteNotebookCell
(
listIndex
:
number
|
undefined
,
cell
:
CellViewModel
):
Promise
<
void
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录