diff --git a/docs/Examples/dataviewjs_familytree.md b/docs/Examples/dataviewjs_familytree.md index 0a60689..7e19d88 100644 --- a/docs/Examples/dataviewjs_familytree.md +++ b/docs/Examples/dataviewjs_familytree.md @@ -59,9 +59,5 @@ function buildMindmap(subtasks, depth, offset, parentObjectID) { tasks["objectID"] = ea.addText(width*1.5,width,tasks.text,{box:true, textAlign:"center"}); buildMindmap(tasks.subtasks, 2, 0, tasks.objectID); -(async ()=> { - const svg = await ea.createSVG(); - const el=document.querySelector("div.block-language-dataviewjs"); - el.appendChild(svg); -})(); +ea.createSVG().then((svg)=>dv.span(svg.outerHTML)); ``` \ No newline at end of file diff --git a/docs/Examples/dataviewjs_mindmap.md b/docs/Examples/dataviewjs_mindmap.md index 370aa27..c4b6d7b 100644 --- a/docs/Examples/dataviewjs_mindmap.md +++ b/docs/Examples/dataviewjs_mindmap.md @@ -52,9 +52,5 @@ function buildMindmap(subtasks, depth, offset, parentObjectID) { tasks["objectID"] = ea.addText(0,(tasks.size/2)*height,tasks.text,{box:true}); buildMindmap(tasks.subtasks, 1, 0, tasks.objectID); -(async ()=> { - const svg = await ea.createSVG(); - const el=document.querySelector("div.block-language-dataviewjs"); - el.appendChild(svg); -})(); +ea.createSVG().then((svg)=>dv.span(svg.outerHTML)); ``` \ No newline at end of file diff --git a/manifest.json b/manifest.json index 7098312..e0e8027 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "1.3.10", + "version": "1.3.11", "minAppVersion": "0.12.0", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/src/ExcalidrawAutomate.ts b/src/ExcalidrawAutomate.ts index 1b30008..cfa6766 100644 --- a/src/ExcalidrawAutomate.ts +++ b/src/ExcalidrawAutomate.ts @@ -316,7 +316,7 @@ export async function initExcalidrawAutomate(plugin: ExcalidrawPlugin) { async createSVG(templatePath?:string):Promise { const template = templatePath ? (await getTemplate(templatePath)) : null; let elements = template ? template.elements : []; - elements.concat(this.getElements()); + elements = elements.concat(this.getElements()); return await ExcalidrawView.getSVG( {//createDrawing "type": "excalidraw", diff --git a/src/ExcalidrawView.ts b/src/ExcalidrawView.ts index b701594..de07786 100644 --- a/src/ExcalidrawView.ts +++ b/src/ExcalidrawView.ts @@ -112,7 +112,8 @@ export default class ExcalidrawView extends TextFileView { } const svg = await ExcalidrawView.getSVG(scene,exportSettings); if(!svg) return; - const svgString = ExcalidrawView.embedFontsInSVG(svg).outerHTML; + let serializer =new XMLSerializer(); + const svgString = serializer.serializeToString(ExcalidrawView.embedFontsInSVG(svg)); if(file && file instanceof TFile) await this.app.vault.modify(file,svgString); else await this.app.vault.create(filepath,svgString); } @@ -168,7 +169,7 @@ export default class ExcalidrawView extends TextFileView { if(!this.getScene) return this.data; if(!this.compatibilityMode) { let trimLocation = this.data.search("# Text Elements\n"); - if(trimLocation == -1) trimLocation = this.data.search("# Drawing\n"); + if(trimLocation == -1) trimLocation = this.data.search(/(%%\n)?# Drawing\n/); if(trimLocation == -1) return this.data; const scene = this.excalidrawData.scene; @@ -732,11 +733,11 @@ export default class ExcalidrawView extends TextFileView { document.exitFullscreen(); this.zoomToFit(); } - this.ctrlKeyDown = e.ctrlKey; + this.ctrlKeyDown = e.ctrlKey || e.metaKey; this.shiftKeyDown = e.shiftKey; this.altKeyDown = e.altKey; - - if(e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey) { + + if(e.ctrlKey && !e.shiftKey && !e.altKey) { // && !e.metaKey) { const selectedElement = getTextElementAtPointer(currentPosition); if(!selectedElement) return; @@ -775,7 +776,7 @@ export default class ExcalidrawView extends TextFileView { } }, onKeyUp: (e:any) => { - this.ctrlKeyDown = e.ctrlKey; + this.ctrlKeyDown = e.ctrlKey || e.metaKey; this.shiftKeyDown = e.shiftKey; this.altKeyDown = e.altKey; }, diff --git a/versions.json b/versions.json index 6eb5dcf..a0f1213 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ { - "1.3.10": "0.11.13" + "1.3.11": "0.11.13" }