1.4.7 (embed Excalidraw into Excalidraw fixed)

This commit is contained in:
Zsolt Viczian
2021-11-08 19:44:45 +01:00
parent b20c1bed5a
commit b428cb7eed
4 changed files with 9 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "1.4.6",
"version": "1.4.7",
"minAppVersion": "0.12.16",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",

View File

@@ -71,7 +71,7 @@ export interface ExcalidrawAutomate {
}
}
):Promise<string>;
createSVG (templatePath?:string, embedFont?:boolean):Promise<SVGSVGElement>;
createSVG (templatePath?:string, embedFont?:boolean, withTheme?:boolean, withBackgroundColor?:boolean):Promise<SVGSVGElement>;
createPNG (templatePath?:string):Promise<any>;
wrapText (text:string, lineLen:number):string;
addRect (topX:number, topY:number, width:number, height:number):string;
@@ -336,7 +336,7 @@ export async function initExcalidrawAutomate(plugin: ExcalidrawPlugin):Promise<E
: frontmatter + await plugin.exportSceneToMD(JSON.stringify(scene,null,"\t"))
);
},
async createSVG(templatePath?:string,embedFont:boolean = false):Promise<SVGSVGElement> {
async createSVG(templatePath?:string,embedFont:boolean = false,withTheme?:boolean, withBackgroundColor?:boolean):Promise<SVGSVGElement> {
const automateElements = this.getElements();
const template = templatePath ? (await getTemplate(this.plugin,templatePath,true)) : null;
let elements = template ? template.elements : [];
@@ -348,14 +348,14 @@ export async function initExcalidrawAutomate(plugin: ExcalidrawPlugin):Promise<E
source: "https://excalidraw.com",
elements: elements,
appState: {
theme: template?.appState?.theme ?? this.canvas.theme,
theme: template?.appState?.theme ?? this.canvas.theme,
viewBackgroundColor: template?.appState?.viewBackgroundColor ?? this.canvas.viewBackgroundColor,
},
files: template?.files ?? {}
},
{
withBackground: plugin.settings.exportWithBackground,
withTheme: plugin.settings.exportWithTheme
withBackground: (withBackgroundColor === undefined) ? plugin.settings.exportWithBackground : withBackgroundColor,
withTheme: (withTheme === undefined) ? plugin.settings.exportWithTheme : withTheme
}
)
return embedFont ? embedFontsInSVG(svg) : svg;

View File

@@ -208,7 +208,7 @@ export const getObsidianImage = async (plugin: ExcalidrawPlugin, file: TFile)
const getExcalidrawSVG = async () => {
plugin.ea.reset();
return svgToBase64((await plugin.ea.createSVG(file.path,true)).outerHTML) as DataURL;
return svgToBase64((await plugin.ea.createSVG(file.path,true,false,false)).outerHTML) as DataURL;
}
const excalidrawSVG = isExcalidrawFile
@@ -334,7 +334,7 @@ export const generateSVGString = async (scene:any, settings: ExcalidrawSettings)
}
const svg = await getSVG(scene,exportSettings);
if(svg) {
return wrapText(html_beautify(svg.outerHTML,{"indent_with_tabs": true}),4096,true);// html_beautify(svg.outerHTML,{"indent_with_tabs": true});
return wrapText(html_beautify(svg.outerHTML,{"indent_with_tabs": true}),4096,true);
}
return null;
}

View File

@@ -1,4 +1,4 @@
{
"1.4.6": "0.12.16",
"1.4.7": "0.12.16",
"1.4.2": "0.11.13"
}