Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat Excalidraw files as attachments #68

Open
ms3056 opened this issue Sep 5, 2024 · 8 comments
Open

Treat Excalidraw files as attachments #68

ms3056 opened this issue Sep 5, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@ms3056
Copy link

ms3056 commented Sep 5, 2024

I have a lot of empty Excalidraw drawings embedded in my notes. I do this in case I want to draw a picture in a note, so every meeting note contains an empty Excalidraw drawing.

When I ran this plugin today, ANY file - even if it has other content like text or images - was flagged for deletion because they contain empty Excalidraw files.

REQUEST: please allow a setting to TURN THIS OFF!!!!

Here is an example - all of these were flagged for deletion - but - they all have content (and have empty Excalidraw content).

SP-01-2024-09-05 09h19_16

@husjon
Copy link
Owner

husjon commented Sep 5, 2024

Having a lot of empty drawings feels counter-intuitive to me, however I can also see why one would need it.
I'll add an option to the settings to toggle it later today.

@husjon husjon added the enhancement New feature or request label Sep 5, 2024
@husjon husjon changed the title Latest update: BE CAREFUL! Make Excalidraw cleanup optional Sep 5, 2024
@husjon husjon added bug Something isn't working and removed enhancement New feature or request labels Sep 5, 2024
@husjon
Copy link
Owner

husjon commented Sep 5, 2024

Sorry, I kinda misread your initial isuse.
The notes in in the picture, you're saying these file have content and one of which is a link / embed to an Excalidraw file, or are these files actual Excalidraw files?

Could you provide a working example so that I can try to replicate it on my end?
Thanks.

@husjon
Copy link
Owner

husjon commented Sep 5, 2024

Just a heads up that I've pushed a patch to disable cleanup of Excalidraw file for now (v1.1.1).

@Iphinis
Copy link

Iphinis commented Sep 5, 2024

Hi!
I'm here to track the advancement of this feature and the one to handle excalidraw files like attachments :)

@ms3056
Copy link
Author

ms3056 commented Sep 6, 2024

I have attached a typical note. This has embedded Excalidraw drawings that are 'blank' to start. In case someone is like "why?" - I have a hotkey to "swap" between the Obsidian text entry view and the Excalidraw "drawing" view - its kinda like Obsidian is one side of the "paper" where I type notes, and Excalidraw is the back side of the paper where you can draw images. Then hot-key back and forth at will.

I hope this helps. This attached files is one of the files and the content that the previous version tried to delete.

20240906101539.md

@husjon
Copy link
Owner

husjon commented Sep 6, 2024

Aha that is actually a really nice way of using it :)

I will spend some more time looking into the implementation for cleaning up Excalidraw files.
It will take a bit longer to implement but the end result will be so that Excalidraw files are handled more like pictures etc in that if they are ignored if in use by any other file.

@husjon husjon changed the title Make Excalidraw cleanup optional Treat Excalidraw files as attachments Sep 6, 2024
@husjon
Copy link
Owner

husjon commented Sep 8, 2024

Hi, I've now made a pre-release version with a fixed version of the original implementation (v1.1.2-0).

It now does a pre-check to see if it has any backlinks / references (this was the part that was missing from the original implementation) and if so, skips the cleanup for that particular Excalidraw file.

On my end it seem to work as intended, but I would like for you to give it a shot to if possible, either in a test vault or your main.
The pre-release can be tested by using the BRAT plugin.

Once BRAT has been installed and enabled, go to the settings tab for the plugin and click Add Beta plugin with frozen version, then fill in the following:
Repository: https://github.com/husjon/obsidian-file-cleaner-redux
Release Version: 1.1.2-0 (notice the lack of v prefix)

You'll see it in BRAT shortly after adding it, like this.
image

You can confim the version in the community plugin tab
image

Once installed, see if it works as you expect.
If it works as expected I will make it public otherwise I'll make a few adjustments according you what you find. :)

Finally: To remove the beta version, disable / uninstall BRAT, then re-install File Cleaner Redux through the community plugin listing.

Thanks in advance

@husjon
Copy link
Owner

husjon commented Sep 10, 2024

I found a bug which cause a rather big slowdown since it was trying to parse markdown files twice, this has now been pushed to 1.1.2-1, the procedure above is still correct except for the version to test is now 1.1.2-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants