Set folder to current active folder if Excalidraw Folder name starts with "./" and embedUseExcalidrawFolder is true.

This commit is contained in:
Bryan
2024-03-16 15:13:45 -06:00
parent a1071426c0
commit 9b7d828209

View File

@@ -98,7 +98,7 @@ import {
isCallerFromTemplaterPlugin,
decompress,
} from "./utils/Utils";
import { extractSVGPNGFileName, getActivePDFPageNumberFromPDFView, getAttachmentsFolderAndFilePath, getNewOrAdjacentLeaf, getParentOfClass, isObsidianThemeDark, openLeaf } from "./utils/ObsidianUtils";
import { extractSVGPNGFileName, getActivePDFPageNumberFromPDFView, getAttachmentsFolderAndFilePath, getCurrentActiveDirectory, getNewOrAdjacentLeaf, getParentOfClass, isObsidianThemeDark, openLeaf } from "./utils/ObsidianUtils";
import { ExcalidrawElement, ExcalidrawEmbeddableElement, ExcalidrawImageElement, ExcalidrawTextElement, FileId } from "@zsviczian/excalidraw/types/excalidraw/element/types";
import { ScriptEngine } from "./Scripts";
import {
@@ -1093,7 +1093,7 @@ export default class ExcalidrawPlugin extends Plugin {
this.settings,
);
const folder = this.settings.embedUseExcalidrawFolder
? null
? (this.settings.folder && this.settings.folder.startsWith("./")) ? getCurrentActiveDirectory(activeView.file.path, this.settings.folder) : null
: (
await getAttachmentsFolderAndFilePath(
this.app,
@@ -1101,6 +1101,7 @@ export default class ExcalidrawPlugin extends Plugin {
filename,
)
).folder;
const file = await this.createDrawing(filename, folder);
await this.embedDrawing(file);
this.openDrawing(file, location, true, undefined, true);