zsviczian / obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian
4.17k stars 230 forks source link

BUG: Transclusions not working on Mobile since last update #1995

Closed alkuzman closed 1 month ago

alkuzman commented 1 month ago

Have you searched for existing issues (including closed ones)?

Does this bug persist in a new vault with only Excalidraw installed?

Your environment

SYSTEM INFO: Operating system: android 14 (samsung SM-X610) Obsidian version: 1.6.7 (149) API version: v1.6.7 Login status: logged in Catalyst license: none Live preview: on Base theme: adapt to system Community theme: none Snippets enabled: 0 Restricted mode: off Plugins installed: 40 Plugins enabled: 1 1: Excalidraw v2.4.1

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

Describe the bug

Both as embeddings in markdown and inside the excalidraw the transclusions are not shown. Moreover, when trying to insert a new file the as Image button does nothing.

The issue is:

Screenshot_20240905_000157_Obsidian

Steps to reproduce

Not sure

Expected behavior

No response

Additional context

No response

zsviczian commented 1 month ago

Sorry, I don't understand your description:

1)

The issue is:

  • not present in a new vault.
  • present with only Excalidraw enabled
  • not present on desktop.

Did you create a new Vault? (assuming yes) Did you Install Excalidraw in that new Vault? Was the issue present in the new Vault - i.e. were you able to add an image? and did transclusion work?

2)

What are you trying to transclude where?

3)

On your screenshot: did you switch over to markdown view mode to verify that the image file referenced under ## Embedded Files is actually present on your tablet?

alkuzman commented 1 month ago

I am really sorry, I should have been more specific.

1)

I created a new vault (on my tablet), I installed excalidraw, and everything was working as expected (the issue is not present in the new vault).

I will investigate more and try to reproduce the issue in a new vault.

2)

I was trying to transclude existing excalidraw drawing into another excalidraw drawing. But also ![[xxx.excalidraw]] in markdown does not work.

Note: the as Image button can not be clicked when I try to insert another excalidraw drawing.

However, other images that are already in the vault or I import them from the tablet work fine (only excalidraw drawings are the issue)

3)

Yes, I switched to Markdown View, and all the links are there. Actually, if I click open link on the box, I get redirected to the target excalidraw drawing as expected. This also proves that the files exist, I guess.

I also checked that all files are present locally on my tablet.

4)

I tested, and the same issue is present on my android phone. Only the desktop works as expected.

5)

Before this happened, I was experimenting with only with Excalidraw and Excalibrain, and no new plugins were installed.

I also experienced the bug that was fixed by this release, where several of my drawings were overriden, but I returned to an older version of the files. I hope I did not break anything while doing so, although transclusions don't work even on files that were not touched for some time.

zsviczian commented 1 month ago

This looks very similar to this: #1992 I wonder what is going on. I can imagine there is some weird caching issue....

tjg23 commented 1 month ago

I do not have any embeds within Excalidraw files, but I am experiencing the same issue where Excalidraw drawings will not embed in Markdown files on my iPad. I can also confirm that the issue does not appear in a new vault, but does persist when all plugins, snippets, and themes are disabled (and the app is restarted)

zsviczian commented 1 month ago

In plugin settings under Embedding Excalidraw into your Notes and Exporting can you try Purging the cache?

image
tjg23 commented 1 month ago

I tried it and it had no effect – but I also just remembered that the vConsole plugin lets you access the console on mobile, so I checked that and I found that each time I added an Excalidraw embed link to a note, it threw this error: IMG_0545

alkuzman commented 1 month ago

Clearing the cache also does not work for me

zsviczian commented 1 month ago

this is helpful. found the bug.

zsviczian commented 1 month ago

spoke too soon... haven't found it, but I found the part of the code from the error message. But I still don't understand what leads to this. Can you create a step by step instruction in a new Vault that I can replicate to reproduce this error?

zsviczian commented 1 month ago

Yeah, the problem is definitely not here but somewhere earlier, this is just the symptom of the file not displaying. I haven't touched this part of code for roughly a year, so wouldn't expect this to break just now.

You need to help me reproduce the error, until then we are looking for a needle in the haystack.

alkuzman commented 1 month ago

Not sure if this would help, but this is the error when I click as Image button. Seems a bit more detailed.

Uncaught (in promise)  {"name": "TypeError", "message": "Cannot read properties of null (reading 'querySelectorAll')", "stack": "TypeError: Cannot read properties of null (reading 'querySelectorAll')\n    at EmbeddedFilesLoader.getExcalidrawSVG (plugin:obsidian-excalidraw-plugin:4:2013113)\n    at async EmbeddedFilesLoader._getObsidianImage (plugin:obsidian-excalidraw-plugin:4:2014725)\n    at async EmbeddedFilesLoader.getObsidianImage (plugin:obsidian-excalidraw-plugin:4:2011682)\n    at async ExcalidrawAutomate.addImage (plugin:obsidian-excalidraw-plugin:4:2538307)\n    at async insertImageToView (plugin:obsidian-excalidraw-plugin:4:2303918)\n    at async eval (plugin:obsidian-excalidraw-plugin:4:2734103)"}
alkuzman commented 1 month ago

Ok, seems to be the same issue as https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1997 . Just make the embeded drawing more complex and it is the same in completely new vault. So, a bit more complex drawing with few icons from the stencil library does the job.

Note: excalidraw is the only community plugin installed.

tjg23 commented 1 month ago

I'd been trying to find a way to reproduce

I felt pretty stumped until I saw this update ^ and I can confirm my issue seems to be the same. I began recreating the drawing I was originally trying to embed, in a fresh vault, and it was working until I added the first text element. Further testing suggests any text element at all breaks the embed, but I haven't gotten it to break from just "complexity"

zsviczian commented 1 month ago

This is what I understood... and it all seems to work. What am I missing?

https://github.com/user-attachments/assets/962b3d1f-180f-4720-85a6-7b11e86c01ef

alkuzman commented 1 month ago
  1. Is this recorded on a mobile version? Because on my Linux machine, everything is working perfectly with pretty complex drawings. I have issues only on Android, Samsung Tab to be exact.
  2. For me it is not the text elements, but 5-6 drawings from the stencil library for example.
zsviczian commented 1 month ago

Bingo! EEE does not show the image on my mobile! I can finally reproduce the error!

zsviczian commented 1 month ago

please replace main.js in .obsidian/plugins/obsidian-excalidraw-plugin with the main.js in the attached main.js.zip and let me know if this resolves the issue.

alkuzman commented 1 month ago

Works for me :tada: . Thank you for looking into the issue and for the huge contribution with the whole Excalidraw tool set and the PKM videos. I am still in the process of learning, but it is already very useful.

zsviczian commented 1 month ago

Great! I will publish 2.4.2 today. This is an unfortunate error... due to a last minute merge from Excalidraw.com - I shouldn't have included the change in 2.4.1 in the first place... but it looked harmless (famous last words).

@alkuzman, I would encourage you to give back to the community. As you are learning Excalidraw this might be the best time to contribute to the community wiki that I launched this week... early questions are still fresh in your mind. You can just jot down few ideas / learnings, ask chatGPT to brush it up, and publish it to the wiki. We can refine it later, but you would already help new users a bunch! https://excalidraw-obsidian.online/Hobbies/Excalidraw+Blog/WIKI/Welcome+to+the+WIKI

alkuzman commented 1 month ago

Great! I will publish 2.4.2 today. This is an unfortunate error... due to a last minute merge from Excalidraw.com - I shouldn't have included the change in 2.4.1 in the first place... but it looked harmless (famous last words).

Thank you. It always seems trivial :smile:

@alkuzman, I would encourage you to give back to the community. As you are learning Excalidraw this might be the best time to contribute to the community wiki that I launched this week... early questions are still fresh in your mind. You can just jot down few ideas / learnings, ask chatGPT to brush it up, and publish it to the wiki. We can refine it later, but you would already help new users a bunch! https://excalidraw-obsidian.online/Hobbies/Excalidraw+Blog/WIKI/Welcome+to+the+WIKI

I have already seen the WIKI page. I believe it makes perfect sense to have well-maintained documentation for new users. Although I find your videos quite interesting and informative, it is hard to revisit some specifics when you need them.

I will be happy to contribute to the documentation as I learn. However, I might be a bit slow until the end of this year since I have a project deadline.

zsviczian commented 1 month ago

resolved in 2.4.2