mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 06:17:18 +00:00
fix #146397. Clear container for html and plain text renderer.
This commit is contained in:
parent
5cc4bc671b
commit
0a2707bbf0
|
@ -10,6 +10,11 @@ interface IDisposable {
|
|||
dispose(): void;
|
||||
}
|
||||
|
||||
function clearContainer(container: HTMLElement) {
|
||||
while (container.firstChild) {
|
||||
container.removeChild(container.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function renderImage(outputInfo: OutputItem, element: HTMLElement): IDisposable {
|
||||
|
@ -60,6 +65,7 @@ const domEval = (container: Element) => {
|
|||
};
|
||||
|
||||
function renderHTML(outputInfo: OutputItem, container: HTMLElement): void {
|
||||
clearContainer(container);
|
||||
const htmlContent = outputInfo.text();
|
||||
const element = document.createElement('div');
|
||||
const trustedHtml = ttPolicy?.createHTML(htmlContent) ?? htmlContent;
|
||||
|
@ -150,6 +156,7 @@ function renderStream(outputInfo: OutputItem, container: HTMLElement, error: boo
|
|||
}
|
||||
|
||||
function renderText(outputInfo: OutputItem, container: HTMLElement, ctx: RendererContext<void> & { readonly settings: { readonly lineLimit: number } }): void {
|
||||
clearContainer(container);
|
||||
const contentNode = document.createElement('div');
|
||||
contentNode.classList.add('output-plaintext');
|
||||
const text = outputInfo.text();
|
||||
|
|
Loading…
Reference in a new issue