mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2026-11-27 06:32:42 +00:00
isBindingEnabled, width fix for SVGImage in MarkdownPostProcessor
This commit is contained in:
1 parent
b3957cc6f8
commit
b786f25745
3 files changed
+21
-9
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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…
|
||||
|
||||
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://storage.ko-fi.com/cdn/kofi6.png?v=6" border="0" alt="Buy Me a Coffee at ko-fi.com" height=45></a></div>
|
||||
`,
|
||||
"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":`
|
||||
<div class="excalidraw-videoWrapper">
|
||||
|
||||
@@ -166,7 +166,7 @@ import { UIModeSettings } from "src/shared/Dialogs/UIModeSettings";
|
||||
import { copyLinkToSelectedElementToClipboard } from "src/shared/Dialogs/copyLinkToSelectedElement";
|
||||
import { getPDFCropRect } from "src/utils/PDFUtils";
|
||||
import { ttdPersistenceAdapter } from "src/shared/TTDDialogPersistanceAdater";
|
||||
import { CaptureUpdateActionType } from "@zsviczian/excalidraw/types/element/src";
|
||||
import { CaptureUpdateActionType, isBindingEnabled } from "@zsviczian/excalidraw/types/element/src";
|
||||
|
||||
const EMBEDDABLE_SEMAPHORE_TIMEOUT = 2000;
|
||||
const PREVENT_RELOAD_TIMEOUT = 2000;
|
||||
@@ -1199,9 +1199,9 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
|
||||
toggleDisableBinding() {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.toggleDisableBinding, "ExcalidrawView.toggleDisableBinding");
|
||||
const newState = !this.excalidrawAPI.getAppState().invertBindingBehaviour;
|
||||
this.updateScene({appState: {invertBindingBehaviour:newState}, captureUpdate: CaptureUpdateAction.NEVER,});
|
||||
new Notice(newState ? t("ARROW_BINDING_INVERSE_MODE") : t("ARROW_BINDING_NORMAL_MODE"));
|
||||
const newState = (this.excalidrawAPI.getAppState().bindingPreference === "enabled") ? "disabled" : "enabled";
|
||||
this.updateScene({appState: {bindingPreference:newState}, captureUpdate: CaptureUpdateAction.NEVER,});
|
||||
new Notice(newState === "disabled" ? t("ARROW_BINDING_INVERSE_MODE") : t("ARROW_BINDING_NORMAL_MODE"));
|
||||
}
|
||||
|
||||
toggleFrameRendering() {
|
||||
@@ -3952,6 +3952,9 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
objectsSnapModeEnabled: st.objectsSnapModeEnabled,
|
||||
activeTool,
|
||||
disableContextMenu: st.disableContextMenu,
|
||||
bindingPreference: st.bindingPreference,
|
||||
isBindingEnabled: st.isBindingEnabled,
|
||||
isMidpointSnappingEnabled: st.isMidpointSnappingEnabled,
|
||||
},
|
||||
prevTextMode: this.prevTextMode,
|
||||
files,
|
||||
|
||||
Reference in new issue
Block a user