mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
remove images from metadata on source update (#15640)
* remove images from metadata on update * update comment * reset only on html update * add comment * fixes Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -272,6 +272,8 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
|
|||||||
private updateCellSource(): void {
|
private updateCellSource(): void {
|
||||||
let textOutputElement = <HTMLElement>this.output.nativeElement;
|
let textOutputElement = <HTMLElement>this.output.nativeElement;
|
||||||
let newCellSource: string = this._htmlMarkdownConverter.convert(textOutputElement.innerHTML);
|
let newCellSource: string = this._htmlMarkdownConverter.convert(textOutputElement.innerHTML);
|
||||||
|
// reset cell attachments to remove unused image data since we're going to go through each of them again
|
||||||
|
this.cellModel.attachments = {};
|
||||||
this.cellModel.source = newCellSource;
|
this.cellModel.source = newCellSource;
|
||||||
this._changeRef.detectChanges();
|
this._changeRef.detectChanges();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export class CellModel extends Disposable implements ICellModel {
|
|||||||
private _isInjectedParameter: boolean;
|
private _isInjectedParameter: boolean;
|
||||||
private _previousChartState: IInsightOptions[] = [];
|
private _previousChartState: IInsightOptions[] = [];
|
||||||
private _outputCounter = 0; // When re-executing the same cell, ensure that we apply chart options in the same order
|
private _outputCounter = 0; // When re-executing the same cell, ensure that we apply chart options in the same order
|
||||||
private _attachments: nb.ICellAttachments;
|
private _attachments: nb.ICellAttachments | undefined;
|
||||||
private _preventNextChartCache: boolean = false;
|
private _preventNextChartCache: boolean = false;
|
||||||
|
|
||||||
constructor(cellData: nb.ICellContents,
|
constructor(cellData: nb.ICellContents,
|
||||||
@@ -149,6 +149,10 @@ export class CellModel extends Disposable implements ICellModel {
|
|||||||
return this._attachments;
|
return this._attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public set attachments(attachments: nb.ICellAttachments | undefined) {
|
||||||
|
this._attachments = attachments ?? {};
|
||||||
|
}
|
||||||
|
|
||||||
addAttachment(mimeType: string, base64Encoding: string, name: string): string {
|
addAttachment(mimeType: string, base64Encoding: string, name: string): string {
|
||||||
// base64Encoded value looks like: data:application/octet-stream;base64,<base64Value>
|
// base64Encoded value looks like: data:application/octet-stream;base64,<base64Value>
|
||||||
// get the <base64Value> from the string
|
// get the <base64Value> from the string
|
||||||
|
|||||||
@@ -533,7 +533,7 @@ export interface ICellModel {
|
|||||||
sendChangeToNotebook(change: NotebookChangeType): void;
|
sendChangeToNotebook(change: NotebookChangeType): void;
|
||||||
cellSourceChanged: boolean;
|
cellSourceChanged: boolean;
|
||||||
readonly savedConnectionName: string | undefined;
|
readonly savedConnectionName: string | undefined;
|
||||||
readonly attachments: nb.ICellAttachments;
|
attachments: nb.ICellAttachments | undefined;
|
||||||
readonly currentMode: CellEditModes;
|
readonly currentMode: CellEditModes;
|
||||||
/**
|
/**
|
||||||
* Adds image as an attachment to cell metadata
|
* Adds image as an attachment to cell metadata
|
||||||
|
|||||||
Reference in New Issue
Block a user