提交 804d5cbf 编写于 作者: R Rob Lourens

Run one inset modification at a time so they don't trample each other

Fix #105320
上级 0f22246a
......@@ -32,6 +32,9 @@ interface IRenderedOutput {
export class CodeCell extends Disposable {
private outputResizeListeners = new Map<IProcessedOutput, DisposableStore>();
private outputElements = new Map<IProcessedOutput, IRenderedOutput>();
private modifyInsetQueue = Promise.resolve();
constructor(
private notebookEditor: INotebookEditor,
private viewCell: CodeCellViewModel,
......@@ -170,7 +173,7 @@ export class CodeCell extends Disposable {
removedKeys.push(key);
// remove element from DOM
this.templateData?.outputContainer?.removeChild(value.element);
this.notebookEditor.removeInset(key);
this.modifyInsetQueue = this.modifyInsetQueue.finally(() => this.notebookEditor.removeInset(key));
}
});
......@@ -503,7 +506,7 @@ export class CodeCell extends Disposable {
if (result.type !== RenderOutputType.None) {
this.viewCell.selfSizeMonitoring = true;
this.notebookEditor.createInset(this.viewCell, result, this.viewCell.getOutputOffset(index));
this.modifyInsetQueue = this.modifyInsetQueue.finally(() => this.notebookEditor.createInset(this.viewCell, result as any, this.viewCell.getOutputOffset(index)));
} else {
DOM.addClass(outputItemDiv, 'foreground');
DOM.addClass(outputItemDiv, 'output-element');
......@@ -598,7 +601,7 @@ export class CodeCell extends Disposable {
const element = this.outputElements.get(output)?.element;
if (element) {
this.templateData?.outputContainer?.removeChild(element);
this.notebookEditor.removeInset(output);
await (this.modifyInsetQueue = this.modifyInsetQueue.finally(() => this.notebookEditor.removeInset(output)));
}
output.pickedMimeTypeIndex = pick;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册