提交 1ccad27e 编写于 作者: R rebornix

push diff editor relayout to next tick, to avoid height change side effects...

push diff editor relayout to next tick, to avoid height change side effects when updating original editor first.
上级 b3a5f15b
......@@ -769,28 +769,30 @@ export class DeletedCell extends AbstractCellRenderer {
}
}
layout(state: { outerWidth?: boolean, editorHeight?: boolean, metadataEditor?: boolean, outputEditor?: boolean }) {
if (state.editorHeight || state.outerWidth) {
this._editor.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
height: this._layoutInfo.editorHeight
});
}
DOM.scheduleAtNextAnimationFrame(() => {
if (state.editorHeight || state.outerWidth) {
this._editor.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
height: this._layoutInfo.editorHeight
});
}
if (state.metadataEditor || state.outerWidth) {
this._metadataEditor?.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
height: this._layoutInfo.metadataHeight
});
}
if (state.metadataEditor || state.outerWidth) {
this._metadataEditor?.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
height: this._layoutInfo.metadataHeight
});
}
if (state.outputEditor || state.outerWidth) {
this._outputEditor?.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
height: this._layoutInfo.outputHeight
});
}
if (state.outputEditor || state.outerWidth) {
this._outputEditor?.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
height: this._layoutInfo.outputHeight
});
}
this.layoutNotebookCell();
this.layoutNotebookCell();
});
}
}
......@@ -857,28 +859,30 @@ export class InsertCell extends AbstractCellRenderer {
}
layout(state: { outerWidth?: boolean, editorHeight?: boolean, metadataEditor?: boolean, outputEditor?: boolean }) {
if (state.editorHeight || state.outerWidth) {
this._editor.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
height: this._layoutInfo.editorHeight
});
}
DOM.scheduleAtNextAnimationFrame(() => {
if (state.editorHeight || state.outerWidth) {
this._editor.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, false),
height: this._layoutInfo.editorHeight
});
}
if (state.metadataEditor || state.outerWidth) {
this._metadataEditor?.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true),
height: this._layoutInfo.metadataHeight
});
}
if (state.metadataEditor || state.outerWidth) {
this._metadataEditor?.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true),
height: this._layoutInfo.metadataHeight
});
}
if (state.outputEditor || state.outerWidth) {
this._outputEditor?.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true),
height: this._layoutInfo.outputHeight
});
}
if (state.outputEditor || state.outerWidth) {
this._outputEditor?.layout({
width: this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(), false, true),
height: this._layoutInfo.outputHeight
});
}
this.layoutNotebookCell();
this.layoutNotebookCell();
});
}
}
......@@ -963,25 +967,27 @@ export class ModifiedCell extends AbstractCellRenderer {
}
layout(state: { outerWidth?: boolean, editorHeight?: boolean, metadataEditor?: boolean, outputEditor?: boolean }) {
if (state.editorHeight || state.outerWidth) {
this._editorContainer.style.height = `${this._layoutInfo.editorHeight}px`;
this._editor!.layout();
}
DOM.scheduleAtNextAnimationFrame(() => {
if (state.editorHeight || state.outerWidth) {
this._editorContainer.style.height = `${this._layoutInfo.editorHeight}px`;
this._editor!.layout();
}
if (state.metadataEditor || state.outerWidth) {
if (this._metadataEditorContainer) {
this._metadataEditorContainer.style.height = `${this._layoutInfo.metadataHeight}px`;
this._metadataEditor?.layout();
if (state.metadataEditor || state.outerWidth) {
if (this._metadataEditorContainer) {
this._metadataEditorContainer.style.height = `${this._layoutInfo.metadataHeight}px`;
this._metadataEditor?.layout();
}
}
}
if (state.outputEditor || state.outerWidth) {
if (this._outputEditorContainer) {
this._outputEditorContainer.style.height = `${this._layoutInfo.outputHeight}px`;
this._outputEditor?.layout();
if (state.outputEditor || state.outerWidth) {
if (this._outputEditorContainer) {
this._outputEditorContainer.style.height = `${this._layoutInfo.outputHeight}px`;
this._outputEditor?.layout();
}
}
}
this.layoutNotebookCell();
this.layoutNotebookCell();
});
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册