mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-29 18:09:01 +01:00
fix #104102.
This commit is contained in:
@@ -1497,3 +1497,16 @@ registerAction2(class extends NotebookCellAction {
|
||||
context.notebookEditor.viewModel!.notebookDocument.changeCellMetadata(context.cell.handle, { inputCollapsed: false });
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends NotebookCellAction {
|
||||
constructor() {
|
||||
super({
|
||||
id: 'notebook.inspectLayout',
|
||||
title: localize('notebookActions.inspectLayout', "Inspect Layout")
|
||||
});
|
||||
}
|
||||
|
||||
async runWithContext(accessor: ServicesAccessor, context: INotebookCellActionContext): Promise<void> {
|
||||
context.notebookEditor.viewModel!.inspectLayout();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -344,6 +344,13 @@ export class BackLayerWebView extends Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
const cell = this.insetMapping.get(output)!.cell;
|
||||
|
||||
const currCell = this.notebookEditor.viewModel?.viewCells.find(vc => vc.handle === cell.handle);
|
||||
if (currCell !== cell && currCell !== undefined) {
|
||||
this.insetMapping.get(output)!.cell = currCell as CodeCellViewModel;
|
||||
}
|
||||
|
||||
return { cell: this.insetMapping.get(output)!.cell, output };
|
||||
}
|
||||
|
||||
|
||||
@@ -449,6 +449,15 @@ function webviewPreloads() {
|
||||
if (output) {
|
||||
output.parentElement!.style.display = 'block';
|
||||
output.style.top = top + 'px';
|
||||
|
||||
vscode.postMessage({
|
||||
__vscode_notebook_message: true,
|
||||
type: 'dimension',
|
||||
id: outputId,
|
||||
data: {
|
||||
height: output.clientHeight
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -349,6 +349,16 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
|
||||
});
|
||||
}
|
||||
|
||||
inspectLayout() {
|
||||
console.log('--- notebook ---\n');
|
||||
console.log(this.layoutInfo);
|
||||
console.log('--- cells ---');
|
||||
this.viewCells.forEach(cell => {
|
||||
console.log(`--- cell: ${cell.handle} ---\n`);
|
||||
console.log((cell as (CodeCellViewModel | MarkdownCellViewModel)).layoutInfo);
|
||||
});
|
||||
}
|
||||
|
||||
setFocus(focused: boolean) {
|
||||
this._focused = focused;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user