zsviczian / obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian
4.02k stars 217 forks source link

BUG: SVG Autoexport creates empty file (Workaround found) #1927

Open JulianSilberbauer opened 1 month ago

JulianSilberbauer commented 1 month ago

Your environment SYSTEM INFO: Obsidian version: v1.6.7 Installer version: v1.6.7 Operating system: #1 SMP PREEMPT_DYNAMIC Sun, 04 Aug 2024 05:11:32 +0000 6.10.3-arch1-1 Login status: not logged in Insider build toggle: off Live preview: off Base theme: dark Community theme: Minimal v7.7.10 Snippets enabled: 0 Restricted mode: off Plugins installed: 9 Plugins enabled: 6 1: Advanced Tables v0.21.0 2: Kanban v2.0.51 3: Excalidraw v2.3.0 4: Vault Size History v1.0.5 5: Minimal Theme Settings v8.0.2 6: Style Settings v1.0.8

Describe the bug When using the autoexport feature, the created svg is empty (File size of 0B), and the embed only shows the svg icon. When manually exporting, everything works perfectly fine.

To Reproduce Steps to reproduce the behavior:

  1. Create a new ExcaliDrawing, draw something, save the file.
  2. Open a .md file / note in obsidian
  3. Use the command palett -> Excalidraw: Embed a drawing
  4. Select the excalidrawing created earlier => the autoexport feature does create a new svg file, but its completely empty.

Expected behavior Autoexport creates a proper SVG file that can be used.

Screenshots grafik

the SVG on the top was created by autoexport, the SVG in the bottom was manually exported.

JulianSilberbauer commented 1 month ago

Additional Info: After some more testing, i discovered that when i switch to the default Obsidian Theme, everything works as expected. I assume it has to do with autoexport trying to match the theme? Will investigate further

JulianSilberbauer commented 1 month ago

TLDR: Workaround found, not a high priority bug

Another Update after more Testing: Using the minimal Theme instead of the default obsidian theme, somehow seems to cause the auto export to be a lot slower. My theory is, sometimes the embed link for the SVG is created, before the SVG is fully exported, and interferes with the process of saving the contents of the File somehow. Waiting a few seconds (5 to 10 s) after saving the Excalidraw image until the svg is properly exported, and then manually embedding it into a note, seems to work every time. However, commands from the palett like "Excalidraw: Create new drawing - IN XXX - and embed into active document" dont work, since they probably insert the link to the SVG file right away, before its properly exported.

ABgitObs commented 1 week ago

Hi, just to confirm I got the exact same problem : auto-exported SVGs are empty

JulianSilberbauer commented 2 days ago

Hi, just to confirm I got the exact same problem : auto-exported SVGs are empty

are you also using a theme? did my workaround work for you aswell?