holxsam / tldraw-in-obsidian

A plugin to integrate Tldraw into Obsidian.
Apache License 2.0
166 stars 8 forks source link

Assets override not working when the drawing is embedded #47

Open Hugo-COLLIN opened 1 week ago

Hugo-COLLIN commented 1 week ago

This issue is the continuation of #19 and #44.

My vault is isolated from the internet. So, I downloaded and specified custom fonts and icons to avoid TLdraw loading error and see icons.

It works perfectly in the main editor (thank you @jon-dez for making this possible). But when I try to embed the drawing in a regular note, I get the same error mentioned in #19 : "Could not load assets"

Main editor: image

Same drawing but embedded in a note: image

Settings: image

jon-dez commented 1 week ago

Does this occur in interactive mode as well? (Right click embed and toggle interactive mode)

Hugo-COLLIN commented 1 week ago

Does this occur in interactive mode as well? (Right click embed and toggle interactive mode)

@jon-dez No, embed is working in interactive mode: image

jon-dez commented 1 week ago

I think I know what is happening. The code that creates the embed preview uses a component provided by the tldraw package (TldrawImage), but that component doesn't allow overrides for static assets. I will file an issue on their repository.

jon-dez commented 1 week ago

Ok, I've simulated offline mode by turning off network requests in the dev console. Then I cloned tldraw's repo and made some changes. I created a patch for it so it should work now (at least for me)! https://github.com/jon-dez/tldraw-in-obsidian/releases/tag/1.5.3

jon-dez commented 1 week ago

https://github.com/user-attachments/assets/28c3392e-c697-46e9-9b2a-f44a265cc6c7