updated deconstruct script

This commit is contained in:
zsviczian
2024-03-17 17:47:30 +01:00
parent fa03968508
commit 232f0c38fa
3 changed files with 7 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ Select some elements in the scene. The script will take these elements and move
```javascript
*/
if(!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("1.9.19")) {
if(!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.0.25")) {
new Notice("This script requires a newer version of Excalidraw. Please install the latest version.");
return;
}
@@ -17,11 +17,11 @@ if(!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("1.9.19")) {
// -------------------------------
// Utility variables and functions
// -------------------------------
const excalidrawTemplate = app.metadataCache.getFirstLinkpathDest(ea.plugin.settings.templateFilePath,"");
const excalidrawTemplates = ea.getListOfTemplateFiles();
if(typeof window.ExcalidrawDeconstructElements === "undefined") {
window.ExcalidrawDeconstructElements = {
openDeconstructedImage: true,
templatePath: excalidrawTemplate?.path??""
templatePath: excalidrawTemplates?.[0].path??""
};
}
@@ -49,7 +49,7 @@ const templates = settings["Templates"]
.value
.split(",")
.map(p=>app.metadataCache.getFirstLinkpathDest(p.trim(),""))
.concat(excalidrawTemplate)
.concat(excalidrawTemplates)
.filter(f=>Boolean(f))
.sort((a,b) => a.basename.localeCompare(b.basename));

File diff suppressed because one or more lines are too long

View File

@@ -749,11 +749,10 @@ export const linkPrompt = async (linkText:string, app: App, view?: ExcalidrawVie
export const templatePromt = async (files: TFile[], app: App): Promise<TFile> => {
if(files.length === 1) return files[0];
const [f,_,__] = await linkPrompt(
return ((await linkPrompt(
files.map(f=>`[[${f.path}|${f.name}]]`).join(" "),
app,
undefined,
t("PROMPT_SELECT_TEMPLATE")
);
return f;
))??[null, null, null])[0];
}