mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 17:23:29 -05:00
Add image as attachment on copy/paste into cell (#15602)
* add pasted image as attachment * handle duplicate image logic * replace with regex * address PR comments
This commit is contained in:
@@ -272,7 +272,11 @@ export class MarkdownToolbarComponent extends AngularDisposable {
|
||||
if (imageCalloutResult.embedImage) {
|
||||
let base64String = await this.getFileContentBase64(URI.file(imageCalloutResult.imagePath));
|
||||
let mimeType = await this.getFileMimeType(URI.file(imageCalloutResult.imagePath));
|
||||
this.cellModel.addAttachment(mimeType, base64String, path.basename(imageCalloutResult.imagePath).replace(' ', ''));
|
||||
const originalImageName: string = path.basename(imageCalloutResult.imagePath).replace(/\s/g, '');
|
||||
let attachmentName = this.cellModel.addAttachment(mimeType, base64String, originalImageName);
|
||||
if (originalImageName !== attachmentName) {
|
||||
imageCalloutResult.insertEscapedMarkdown = `})`;
|
||||
}
|
||||
await insertFormattedMarkdown(imageCalloutResult.insertEscapedMarkdown, this.getCellEditorControl());
|
||||
}
|
||||
await insertFormattedMarkdown(imageCalloutResult.insertEscapedMarkdown, this.getCellEditorControl());
|
||||
|
||||
Reference in New Issue
Block a user