zsviczian / obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian
3.67k stars 202 forks source link

BUG: Excalidraw removing text after ## Drawing section #1835

Closed tnschmid closed 1 week ago

tnschmid commented 2 weeks ago

This is related to the feature request #1820, where I was asking about a possibility to retain text after the excalidraw data section.


Your environment SYSTEM INFO: Obsidian version: v1.6.3 Installer version: v1.6.3 Operating system: #104~20.04.1-Ubuntu SMP Tue Jan 16 13:34:09 UTC 2024 5.15.0-94-generic Login status: logged in Catalyst license: none Insider build toggle: off Live preview: on Base theme: dark Community theme: none Snippets enabled: 0 Restricted mode: off Plugins installed: 63 Plugins enabled: 28 1: Dataview v0.5.66 2: Copy Block Link v1.0.4 3: Excalidraw v2.2.6 4: External Links v1.0.10 5: Hover Editor v0.11.20 6: Image2LaTEX v1.1.2 7: Journals v1.3.0 8: Metadata Menu v0.8.7 9: Plugin Update Tracker v1.5.2 10: Reminder v1.1.15 11: Settings Search v1.3.10 12: Toggl Track v0.11.0 13: Templater v2.3.3 14: Tasks v7.4.0 15: Paste URL into selection v1.7.0 16: Zotero Integration v3.1.8 17: Code Styler v1.1.7 18: Admonition v10.3.2 19: Callout Manager v1.1.0 20: Reference Map v1.8.1 21: Strange New Worlds v2.1.4 22: Remember cursor position v1.0.9 23: Quick Switcher++ v4.2.2 24: File Cleaner Redux v0.9.1 25: PDF++ v0.40.8 26: Global Search and Replace v0.5.0 27: Habit Tracker 21 v1.4.2 28: Vault Explorer v1.8.0

Describe the bug Zotero compatibility is turned on Excalidraw removes the added text after ## Drawing in different cases.

To Reproduce Add any text after the excalidraw Data section and add elements on the drawing side will usually (I'm not sure what event actually triggers excalidraw to remove the text after its data) remove the added text

Expected behavior Excalidraw should not remove text after Excalidraw Data.

Screenshots Before adding elements to the drawing image Added element: image When saving # Test section is removed.

zsviczian commented 1 week ago

This is a very strange bug. I think I solved it now 🤞... but I don't understand why the previous setup was not working for section headings, but was working for just text after the ## drawing section.. 🤷

All I did was to change

const RE_TAIL = /^## Drawing\n.*```\n%%$(.*)/gms;

to

const RE_TAIL = /^## Drawing\n.*```\n%%$(.*)/ms;