joplin-plugin-drawio
joplin-plugin-drawio copied to clipboard
Feature Request: judge the picture type by the extension name
Currently only the 
style is treated as an editable drawio file, which makes it impossible to give it a clear title at the same time.
However, I notice await joplin.data.resourcePath(request.diagramId)
can get the file path with extension like /Users/septemberhx/.config/joplin-desktop/resources/dcd0a67dc3fe493b8d36ae87212e7aa7.svg
.
So I believe we can mime.lookup(await joplin.data.resourcePath(request.diagramId))
and get image/svg+xml
Seems we cannot think all svg files are drawio files.
I also notice the drawio has to check a file before importing it: https://github.com/jgraph/drawio/blob/96f0e69647a1efc5b1b50b55d6f0fde39f8826c3/src/main/webapp/js/diagramly/DrawioFile.js
at line 381.
I think it is not worth spending time on this since this plugin works fine now.
I decided to force the image title to drawio for performance reason in order to not check every image in the notes. But it is something that could be changed.
Can we change the rule to 'drawio-' prefix or '-drawio' suffix ?
'drawio' makes me confused when writing markdown with multiple images.
I also use a plugin that can render the image with the title, and all the drawio images are with drawio image title after rendered.
This is something I can do. If for you the title is important, I can change the plugin to look for a shorter suffix.

👍 It looks nice ! But I am concerned about the compatibility to the images created by old versions for other users.
Don't worry, I was planning to support both