提交 f63c75a9 编写于 作者: R rebornix

extract notebook editor widget

上级 3507e2dc
......@@ -407,7 +407,7 @@ registerAction2(class extends Action2 {
export function getActiveNotebookEditor(editorService: IEditorService): INotebookEditor | undefined {
// TODO can `isNotebookEditor` be on INotebookEditor to avoid a circular dependency?
const activeEditorPane = editorService.activeEditorPane as any | undefined;
return activeEditorPane?.isNotebookEditor ? activeEditorPane : undefined;
return activeEditorPane?.isNotebookEditor ? activeEditorPane.editorWidget : undefined;
}
async function runActiveCell(accessor: ServicesAccessor): Promise<ICellViewModel | undefined> {
......
......@@ -14,6 +14,7 @@ TableOfContentsProviderRegistry.register(NotebookEditor.ID, new class implements
return undefined;
}
// return an entry per markdown header
const editorWidget = editor.editorWidget;
const result: ITableOfContentsEntry[] = [];
for (let cell of editor.viewModel.viewCells) {
const content = cell.getText();
......@@ -27,8 +28,8 @@ TableOfContentsProviderRegistry.register(NotebookEditor.ID, new class implements
result.push({
label: matches[j].replace(/^[ \t]*(\#+)/, ''),
reveal: () => {
editor.revealInCenterIfOutsideViewport(cell);
editor.selectElement(cell);
editorWidget.revealInCenterIfOutsideViewport(cell);
editorWidget.selectElement(cell);
// editor.focusNotebookCell(cell, 'container');
}
});
......
......@@ -24,7 +24,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { EditorDescriptor, Extensions as EditorExtensions, IEditorRegistry } from 'vs/workbench/browser/editor';
import { Extensions as WorkbenchExtensions, IWorkbenchContribution, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import { EditorInput, Extensions as EditorInputExtensions, IEditorInput, IEditorInputFactory, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
import { NotebookEditor, NotebookEditorOptions } from 'vs/workbench/contrib/notebook/browser/notebookEditor';
import { NotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookEditor';
import { NotebookEditorInput } from 'vs/workbench/contrib/notebook/browser/notebookEditorInput';
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
import { NotebookService } from 'vs/workbench/contrib/notebook/browser/notebookServiceImpl';
......@@ -51,6 +51,7 @@ import 'vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider';
import 'vs/workbench/contrib/notebook/browser/view/output/transforms/streamTransform';
import 'vs/workbench/contrib/notebook/browser/view/output/transforms/errorTransform';
import 'vs/workbench/contrib/notebook/browser/view/output/transforms/richTransform';
import { NotebookEditorOptions } from 'vs/workbench/contrib/notebook/browser/notebookEditorWidget';
/*--------------------------------------------------------------------------------------------- */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册