inset -> output.

This commit is contained in:
Peng Lyu 2021-03-09 01:13:24 +00:00 committed by GitHub
parent 9878ccfbd7
commit 11a84a6e8a
8 changed files with 11 additions and 11 deletions

View file

@ -109,7 +109,7 @@ export class OutputElement extends Disposable {
if (result.type !== RenderOutputType.Mainframe) { if (result.type !== RenderOutputType.Mainframe) {
// this.viewCell.selfSizeMonitoring = true; // this.viewCell.selfSizeMonitoring = true;
this._notebookEditor.createInset( this._notebookEditor.createOutput(
this._diffElementViewModel, this._diffElementViewModel,
this._nestedCell, this._nestedCell,
result, result,

View file

@ -33,7 +33,7 @@ export interface INotebookTextDiffEditor extends ICommonNotebookEditor {
getLayoutInfo(): NotebookLayoutInfo; getLayoutInfo(): NotebookLayoutInfo;
layoutNotebookCell(cell: DiffElementViewModelBase, height: number): void; layoutNotebookCell(cell: DiffElementViewModelBase, height: number): void;
getOutputRenderer(): OutputRenderer; getOutputRenderer(): OutputRenderer;
createInset(cellDiffViewModel: DiffElementViewModelBase, cellViewModel: IDiffNestedCellViewModel, output: IInsetRenderOutput, getOffset: () => number, diffSide: DiffSide): void; createOutput(cellDiffViewModel: DiffElementViewModelBase, cellViewModel: IDiffNestedCellViewModel, output: IInsetRenderOutput, getOffset: () => number, diffSide: DiffSide): void;
showInset(cellDiffViewModel: DiffElementViewModelBase, cellViewModel: IDiffNestedCellViewModel, displayOutput: ICellOutputViewModel, diffSide: DiffSide): void; showInset(cellDiffViewModel: DiffElementViewModelBase, cellViewModel: IDiffNestedCellViewModel, displayOutput: ICellOutputViewModel, diffSide: DiffSide): void;
removeInset(cellDiffViewModel: DiffElementViewModelBase, cellViewModel: IDiffNestedCellViewModel, output: ICellOutputViewModel, diffSide: DiffSide): void; removeInset(cellDiffViewModel: DiffElementViewModelBase, cellViewModel: IDiffNestedCellViewModel, output: ICellOutputViewModel, diffSide: DiffSide): void;
hideInset(cellDiffViewModel: DiffElementViewModelBase, cellViewModel: IDiffNestedCellViewModel, output: ICellOutputViewModel): void; hideInset(cellDiffViewModel: DiffElementViewModelBase, cellViewModel: IDiffNestedCellViewModel, output: ICellOutputViewModel): void;

View file

@ -590,7 +590,7 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
this._list.triggerScrollFromMouseWheelEvent(event); this._list.triggerScrollFromMouseWheelEvent(event);
} }
createInset(cellDiffViewModel: DiffElementViewModelBase, cellViewModel: DiffNestedCellViewModel, output: IInsetRenderOutput, getOffset: () => number, diffSide: DiffSide): void { createOutput(cellDiffViewModel: DiffElementViewModelBase, cellViewModel: DiffNestedCellViewModel, output: IInsetRenderOutput, getOffset: () => number, diffSide: DiffSide): void {
this._insetModifyQueueByOutputId.queue(output.source.model.outputId + (diffSide === DiffSide.Modified ? '-right' : 'left'), async () => { this._insetModifyQueueByOutputId.queue(output.source.model.outputId + (diffSide === DiffSide.Modified ? '-right' : 'left'), async () => {
const activeWebview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview; const activeWebview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview;
if (!activeWebview) { if (!activeWebview) {
@ -599,7 +599,7 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
if (!activeWebview.insetMapping.has(output.source)) { if (!activeWebview.insetMapping.has(output.source)) {
const cellTop = this._list.getAbsoluteTopOfElement(cellDiffViewModel); const cellTop = this._list.getAbsoluteTopOfElement(cellDiffViewModel);
await activeWebview.createInset({ diffElement: cellDiffViewModel, cellHandle: cellViewModel.handle, cellId: cellViewModel.id, cellUri: cellViewModel.uri }, output, cellTop, getOffset()); await activeWebview.createOutput({ diffElement: cellDiffViewModel, cellHandle: cellViewModel.handle, cellId: cellViewModel.id, cellUri: cellViewModel.uri }, output, cellTop, getOffset());
} else { } else {
const cellTop = this._list.getAbsoluteTopOfElement(cellDiffViewModel); const cellTop = this._list.getAbsoluteTopOfElement(cellDiffViewModel);
const scrollTop = this._list.scrollTop; const scrollTop = this._list.scrollTop;

View file

@ -479,7 +479,7 @@ export interface INotebookEditor extends ICommonNotebookEditor {
/** /**
* Render the output in webview layer * Render the output in webview layer
*/ */
createInset(cell: ICellViewModel, output: IInsetRenderOutput, offset: number): Promise<void>; createOutput(cell: ICellViewModel, output: IInsetRenderOutput, offset: number): Promise<void>;
/** /**
* Remove the output from the webview layer * Remove the output from the webview layer

View file

@ -1693,7 +1693,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
await this._webview?.updateMarkdownPreviewSelectionState(cell.id, isSelected); await this._webview?.updateMarkdownPreviewSelectionState(cell.id, isSelected);
} }
async createInset(cell: CodeCellViewModel, output: IInsetRenderOutput, offset: number): Promise<void> { async createOutput(cell: CodeCellViewModel, output: IInsetRenderOutput, offset: number): Promise<void> {
this._insetModifyQueueByOutputId.queue(output.source.model.outputId, async () => { this._insetModifyQueueByOutputId.queue(output.source.model.outputId, async () => {
if (!this._webview) { if (!this._webview) {
return; return;
@ -1703,7 +1703,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
if (!this._webview!.insetMapping.has(output.source)) { if (!this._webview!.insetMapping.has(output.source)) {
const cellTop = this._list.getAbsoluteTopOfElement(cell); const cellTop = this._list.getAbsoluteTopOfElement(cell);
await this._webview!.createInset({ cellId: cell.id, cellHandle: cell.handle, cellUri: cell.uri }, output, cellTop, offset); await this._webview!.createOutput({ cellId: cell.id, cellHandle: cell.handle, cellUri: cell.uri }, output, cellTop, offset);
} else { } else {
const cellTop = this._list.getAbsoluteTopOfElement(cell); const cellTop = this._list.getAbsoluteTopOfElement(cell);
const scrollTop = this._list.scrollTop; const scrollTop = this._list.scrollTop;

View file

@ -1163,7 +1163,7 @@ var requirejs = (function() {
await p; await p;
} }
async createInset(cellInfo: T, content: IInsetRenderOutput, cellTop: number, offset: number) { async createOutput(cellInfo: T, content: IInsetRenderOutput, cellTop: number, offset: number) {
if (this._disposed) { if (this._disposed) {
return; return;
} }

View file

@ -150,7 +150,7 @@ export class CellOutputElement extends Disposable {
} }
if (renderResult.type !== RenderOutputType.Mainframe) { if (renderResult.type !== RenderOutputType.Mainframe) {
this.notebookEditor.createInset(this.viewCell, renderResult, this.viewCell.getOutputOffset(index)); this.notebookEditor.createOutput(this.viewCell, renderResult, this.viewCell.getOutputOffset(index));
this.domNode.classList.add('background'); this.domNode.classList.add('background');
} else { } else {
this.domNode.classList.add('foreground', 'output-element'); this.domNode.classList.add('foreground', 'output-element');
@ -388,7 +388,7 @@ export class CellOutputContainer extends Disposable {
const renderedOutput = this.outputEntries.get(currOutput); const renderedOutput = this.outputEntries.get(currOutput);
if (renderedOutput && renderedOutput.renderResult) { if (renderedOutput && renderedOutput.renderResult) {
if (renderedOutput.renderResult.type !== RenderOutputType.Mainframe) { if (renderedOutput.renderResult.type !== RenderOutputType.Mainframe) {
this.notebookEditor.createInset(this.viewCell, renderedOutput.renderResult as IInsetRenderOutput, this.viewCell.getOutputOffset(index)); this.notebookEditor.createOutput(this.viewCell, renderedOutput.renderResult as IInsetRenderOutput, this.viewCell.getOutputOffset(index));
} else { } else {
this.viewCell.updateOutputHeight(index, renderedOutput.domClientHeight); this.viewCell.updateOutputHeight(index, renderedOutput.domClientHeight);
} }

View file

@ -309,7 +309,7 @@ export class TestNotebookEditor implements INotebookEditor {
// throw new Error('Method not implemented.'); // throw new Error('Method not implemented.');
return; return;
} }
createInset(cell: CellViewModel, output: IInsetRenderOutput, offset: number): Promise<void> { createOutput(cell: CellViewModel, output: IInsetRenderOutput, offset: number): Promise<void> {
return Promise.resolve(); return Promise.resolve();
} }
createMarkdownPreview(cell: ICellViewModel): Promise<void> { createMarkdownPreview(cell: ICellViewModel): Promise<void> {