zsviczian / obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian
4.08k stars 221 forks source link

BUG: Crash upon Creating Excalidraw File due to Template #1302

Open devinat1 opened 1 year ago

devinat1 commented 1 year ago

Your environment SYSTEM INFO: Obsidian version: v1.3.7 Installer version: v1.3.4 Operating system: Windows 10 Home 10.0.23526 Login status: logged in Catalyst license: none Insider build toggle: off Live preview: on Legacy editor: off Base theme: dark Community theme: Minimal v7.2.0 Snippets enabled: 0 Restricted mode: off Plugins installed: 28 Plugins enabled: 25 1: Readwise Official v2.0.1 2: Dataview v0.5.56 3: Calendar v1.5.10 4: Mousewheel Image zoom v1.0.19 5: Templater v1.16.0 6: Todoist Plugin v1.11.1 7: Periodic Notes v0.0.17 8: Minimal Theme Settings v7.2.2 9: Kanban v1.5.3 10: Commander v0.5.0 11: Recent Files v1.3.8 12: QuickAdd v1.2.1 13: Obsidian42 - Strange New Worlds (SNW) v1.2.2 14: LanguageTool Integration v0.3.4 15: Paste URL into selection v1.7.0 16: Settings Search v1.3.8 17: Admonition v10.0.1 18: Highlightr v1.2.2 19: Taskbone v1.2.3 20: Advanced Tables v0.19.1 21: Homepage v3.5.1 22: Canvas Mindmap v0.1.3 23: Image Toolkit v1.4.0 24: Excalidraw v1.9.18 25: Graph Analysis v0.15.4

RECOMMENDATIONS: Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable the community theme and snippets. Community plugins: for bugs, please first try updating all your plugins to the latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Describe the bug When I create a new Excalidraw file but I am using a template, the creation of the file crashes with the message: image image

To Reproduce Create a template as the following (all I did was change to dark mode and change the stroke width): Excalidraw Stroke Width Template.excalidraw.md

Additional context Note that this does not happen when I do not have a file template. I also tried removing the template and recreating it, but that did not work. This was not happening in versions before Excalidraw 1.9.17, or at least that's the latest version I remember this happening in. Here is the document I get in response:

---

excalidraw-plugin: parsed
tags: [excalidraw]

---
==⚠  Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠==

## Text Elements
%%
## Drawing

```json
{
    "type": "excalidraw",
    "version": 2,
    "source": "https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.9.18",
    "elements": [],
    "appState": {
        "theme": "dark",
        "viewBackgroundColor": "#ffffff",
        "currentItemStrokeColor": "#1e1e1e",
        "currentItemBackgroundColor": "transparent",
        "currentItemFillStyle": "hachure",
        "currentItemStrokeWidth": 0.5,
        "currentItemStrokeStyle": "solid",
        "currentItemRoughness": 1,
        "currentItemOpacity": 100,
        "currentItemFontFamily": 1,
        "currentItemFontSize": 20,
        "currentItemTextAlign": "left",
        "currentItemStartArrowhead": null,
        "currentItemEndArrowhead": "arrow",
        "scrollX": 0,
        "scrollY": 0,
        "zoom": {
            "value": 1
        },
        "currentItemRoundness": "round",
        "gridSize": null,
        "currentStrokeOptions": null,
        "previousGridSize": null,
        "frameRendering": {
            "enabled": true,
            "clip": true,
            "name": true,
            "outline": true
        }
    },
    "files": {}
}
devinat1 commented 1 year ago

When I click on the template file that I created, it gives the following: image Then when I click OK, the file is restored, but closing and opening the file afterward gives the same issue.

zsviczian commented 1 year ago

The file above seems to miss the closing markdown comment sign. I deleted my template and created a new file that I saved as a template following only your changes (dark mode and stroke width setting). I was not able to reproduce the issue. My assumption is, that the reason the restore does not work is because already the first time you saved the template the file was corrupted. Can you reproduce the issue by deleting your template and creating a brand-new template file?

image

devinat1 commented 1 year ago

I am now unable to recreate the issue. Perhaps it has something to do with my file system being corrupted originally or re-syncing my files due to obsidian linter.