This commit is contained in:
Zsolt Viczian
2021-09-21 19:12:55 +02:00
parent 1bba254eaf
commit 472b58a417
6 changed files with 12 additions and 19 deletions

View File

@@ -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));
```

View File

@@ -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));
```

View File

@@ -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",

View File

@@ -316,7 +316,7 @@ export async function initExcalidrawAutomate(plugin: ExcalidrawPlugin) {
async createSVG(templatePath?:string):Promise<SVGSVGElement> {
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",

View File

@@ -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;
},

View File

@@ -1,3 +1,3 @@
{
"1.3.10": "0.11.13"
"1.3.11": "0.11.13"
}