diff --git a/src/core/managers/MarkdownPostProcessor.ts b/src/core/managers/MarkdownPostProcessor.ts index 588000c4..1c70e3e7 100644 --- a/src/core/managers/MarkdownPostProcessor.ts +++ b/src/core/managers/MarkdownPostProcessor.ts @@ -150,16 +150,17 @@ const _getPNG = async ({imgAttributes,filenameParts,theme,cacheReady,img,file,ex return img; } -const setStyle = ({element,imgAttributes,onCanvas}:{ +const setStyle = ({element,imgAttributes,onCanvas, isNativeSVG}:{ element: HTMLElement, imgAttributes: imgElementAttributes, onCanvas: boolean, + isNativeSVG: boolean, } ) => { (process.env.NODE_ENV === 'development') && DEBUGGING && debug(setStyle, `MarkdownPostProcessor.ts > setStyle`); let style = ""; if(imgAttributes.fwidth) { - style = `max-width:${imgAttributes.fwidth}${imgAttributes.fwidth.match(/\d$/) ? "px":""}; `; //width:100%;`; //removed !important https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/886 + style = `${isNativeSVG ? "max-width:" : "max-width:100%; width:"}${imgAttributes.fwidth}${imgAttributes.fwidth.match(/\d$/) ? "px":""}; `; //width:100%;`; //removed !important https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/886 } else { style = "width: fit-content;" } @@ -372,17 +373,17 @@ const getIMG = async ( switch (plugin.settings.previewImageType) { case PreviewImageType.PNG: { const img = createEl("img"); - setStyle({element:img,imgAttributes,onCanvas}); + setStyle({element:img,imgAttributes,onCanvas, isNativeSVG: false}); return await _getPNG({imgAttributes,filenameParts,theme,cacheReady,img,file,exportSettings,loader}); } case PreviewImageType.SVGIMG: { const img = createEl("img"); - setStyle({element:img,imgAttributes,onCanvas}); + setStyle({element:img,imgAttributes,onCanvas, isNativeSVG: false}); return await _getSVGIMG({filenameParts,theme,cacheReady,img,file,exportSettings,loader}); } case PreviewImageType.SVG: { const img = createEl("div"); - setStyle({element:img,imgAttributes,onCanvas}); + setStyle({element:img,imgAttributes,onCanvas, isNativeSVG: true}); return await _getSVGNative({ filenameParts, theme, diff --git a/src/shared/Dialogs/Messages.ts b/src/shared/Dialogs/Messages.ts index 3e8c1a42..caf42c49 100644 --- a/src/shared/Dialogs/Messages.ts +++ b/src/shared/Dialogs/Messages.ts @@ -16,6 +16,14 @@ export const RELEASE_NOTES: { [k: string]: string } = { I build this plugin in my free time, as a labor of love. Curious about the philosophy behind it? Check out [π Sketch Your Mind](https://sketch-your-mind.com). If you find it valuable, say THANK YOU orβ¦
+`, +"2.21.0":` +## Fixed +- Sizing of embedded images in Markdown when image type is set to SVG. [#2685](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2685) + +## New +- LaTeX editor is now floating [#2684](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2684) π[@TravisLEBLANC1](https://github.com/TravisLEBLANC1) + `, "2.20.6":`