Fix the file creation path bug: when the Obsidian's attachment folder setting is "Same folder as current file", the new diagram will actually be created in the root vault folder. The reason is that vault.getAvailablePathForAttachments needs the active file (or null if no file has been opened yet) as its third argument to prepend the correct folder.
Add a setting option to allow naming the newly created diagram in the format of ${currentFileName}-${timestamp}, which is a popular way of naming for attachments associated to a note.
This PR does the following things:
vault.getAvailablePathForAttachments
needs the active file (or null if no file has been opened yet) as its third argument to prepend the correct folder.${currentFileName}-${timestamp}
, which is a popular way of naming for attachments associated to a note.Tests
Settings Page
Same folder as current file - default naming
https://user-images.githubusercontent.com/11176415/231243398-6941d20f-3859-4a05-84fe-f127d676e3ba.mov
Same folder as current file - timestamp naming
https://user-images.githubusercontent.com/11176415/231243487-90fc5f27-7be1-40f9-9285-5b8fdaf28562.mov
Resulting files * I'm using folder notes so technically the active file is
testfolder/testfolder.md
.