zsviczian / obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian
4.24k stars 233 forks source link

BUG: Something is adding "## Text Elements" to text blocks in existing drawings #1808

Closed themensch closed 5 months ago

themensch commented 5 months ago

Your environment Please run Command Palette/Show Debug info in Obsidian and paste the result here. SYSTEM INFO: Operating system: ios 17.5.1 (Apple iPad13,16) Obsidian version: 1.5.12 (134) API version: v1.5.12 Login status: not logged in Live preview: off Base theme: adapt to system Community theme: Prism v3.5.0 Snippets enabled: 3 Restricted mode: off Plugins installed: 9 Plugins enabled: 9 1: Advanced Tables v0.21.0 2: Linter v1.24.0 3: Style Settings v1.0.8 4: File Color v1.1.0 5: Mind Map v1.1.0 6: Settings Search v1.3.10 7: Outliner v4.8.1 8: Dice Roller v11.0.4 9: Excalidraw v2.2.3

Describe the bug

Drawings in my obsidian vault that were previously okay now have the string "## Text Elements" added to text blocks in drawings. Removing the text from the text block and saving does not actually fix the problem, it returns when I click away and then back to the document. In some text blocks, it happens twice.

To Reproduce Steps to reproduce the behavior:

  1. Open an excalidraw document with text in obsidian
  2. look at text blocks - often it is at the top, but not always.
  3. Remove "##Text Elements" string from text block
  4. Save, click away, then back. Observe.

Expected behavior

Text should not change when a drawing is loaded or reloaded.

Screenshots It is important to note that these drawings have existed for a month or longer without this issue.
bug_shot_2 bug_shot_3 bug_shot_1

themensch commented 5 months ago

I looked at the raw data this morning and it looks like the very first text block is the one that receives the additional "## Text Element" string(s). By keeping the text file open in my IDE I can see the text being added when I click away from the drawing in Obsidian.

zsviczian commented 5 months ago

Can you send me a file before conversion so I can try to reproduce this in my own environment?

themensch commented 5 months ago

@zsviczian I am able to reliably reproduce the bug with the following process:

  1. create a new excalidraw document
  2. add a text box
  3. click to another file within Obsidian
  4. click to return to the drawing document

I've attached the documents both before and after I click away. examples.zip

themensch commented 5 months ago

Oh, and I replicated the behavior on my iPhone and my Mac, which all share the same vault shared via iCloud.

zsviczian commented 5 months ago

hm... can't reproduce in my vault. My guess is, this is caused by linter. Disable linter and see if you can reproduce the issue. If not, then try turning on this feature in settings:

image
themensch commented 5 months ago

Eureka!

Disabling the linter did fix the problem; weird, I've had that linter installed for a long time now.

Toggling that setting fixed the problem, thanks! I checked the linter for the ability to exclude certain filetypes, but unfortunately, it can only exclude folders. It does have a "lint on document change" function which I have enabled.

Thanks for all your help, I think this issue is solved.

themensch commented 5 months ago

verified across iPad, iPhone, mac.

NatureK88 commented 5 months ago

I have the same issue before, it comes from linter-Heading blank lines, it add some blank lines after ## Text Element. Disable it will fix the problem.