提交 2acd4eb7 编写于 作者: R Rob Lourens

Don't render markdown cell in the background while typing

Fix #99253
上级 d6d6fb2c
......@@ -138,6 +138,14 @@ export class StatefullMarkdownCell extends Disposable {
hide(this.editorPart);
show(this.markdownContainer);
renderedEditors.delete(this.viewCell);
this.markdownContainer.innerHTML = '';
let markdownRenderer = viewCell.getMarkdownRenderer();
let renderedHTML = viewCell.getHTML();
if (renderedHTML) {
this.markdownContainer.appendChild(renderedHTML);
}
if (this.editor) {
// switch from editing mode
const clientHeight = templateData.container.clientHeight;
......@@ -145,31 +153,12 @@ export class StatefullMarkdownCell extends Disposable {
notebookEditor.layoutNotebookCell(viewCell, clientHeight);
} else {
// first time, readonly mode
this.markdownContainer.innerHTML = '';
let markdownRenderer = viewCell.getMarkdownRenderer();
let renderedHTML = viewCell.getHTML();
if (renderedHTML) {
this.markdownContainer.appendChild(renderedHTML);
}
this.localDisposables.add(markdownRenderer.onDidUpdateRender(() => {
const clientHeight = templateData.container.clientHeight;
this.viewCell.totalHeight = clientHeight;
notebookEditor.layoutNotebookCell(viewCell, clientHeight);
}));
this.localDisposables.add(viewCell.onDidChangeState((e) => {
if (!e.contentChanged) {
return;
}
this.markdownContainer.innerHTML = '';
let renderedHTML = viewCell.getHTML();
if (renderedHTML) {
this.markdownContainer.appendChild(renderedHTML);
}
}));
this.localDisposables.add(viewCell.textBuffer.onDidChangeContent(() => {
this.markdownContainer.innerHTML = '';
viewCell.clearHTML();
......@@ -295,22 +284,7 @@ export class StatefullMarkdownCell extends Disposable {
}
}
bindEditorListeners(model: ITextModel, dimension?: IDimension) {
this.localDisposables.add(model.onDidChangeContent(() => {
// we don't need to update view cell text anymore as the textbuffer is shared
this.viewCell.clearHTML();
let clientHeight = this.markdownContainer.clientHeight;
this.markdownContainer.innerHTML = '';
let renderedHTML = this.viewCell.getHTML();
if (renderedHTML) {
this.markdownContainer.appendChild(renderedHTML);
clientHeight = this.markdownContainer.clientHeight;
}
this.viewCell.totalHeight = this.editor!.getContentHeight() + 32 + clientHeight + CELL_STATUSBAR_HEIGHT;
this.notebookEditor.layoutNotebookCell(this.viewCell, this.viewCell.layoutInfo.totalHeight);
}));
private bindEditorListeners(model: ITextModel, dimension?: IDimension) {
this.localDisposables.add(this.editor!.onDidContentSizeChange(e => {
let viewLayout = this.editor!.getLayoutInfo();
......@@ -340,18 +314,6 @@ export class StatefullMarkdownCell extends Disposable {
}
}));
let markdownRenderer = this.viewCell.getMarkdownRenderer();
this.markdownContainer.innerHTML = '';
let renderedHTML = this.viewCell.getHTML();
if (renderedHTML) {
this.markdownContainer.appendChild(renderedHTML);
this.localDisposables.add(markdownRenderer.onDidUpdateRender(() => {
const clientHeight = this.markdownContainer.clientHeight;
this.viewCell.totalHeight = clientHeight;
this.notebookEditor.layoutNotebookCell(this.viewCell, this.viewCell.layoutInfo.totalHeight);
}));
}
const updateFocusMode = () => this.viewCell.focusMode = this.editor!.hasWidgetFocus() ? CellFocusMode.Editor : CellFocusMode.Container;
this.localDisposables.add(this.editor!.onDidFocusEditorWidget(() => {
updateFocusMode();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册