jensmtg / obsidian-diagrams-net

This repository contains a plugin for Obsidian for inserting and editing diagrams.net (previously draw.io) diagrams.
MIT License
97 stars 14 forks source link

Add setting options on the naming format and location of the newly created diagrams #14

Closed SPiCaRiA closed 1 year ago

SPiCaRiA commented 1 year ago

Hi, thank you for making this great plug-in!

This PR basically provides setting options and implementations of:

  1. Allow creating diagrams in the attachment folder specified in the Obsidian Settings (Files & Links > Default location for new attachments).
  2. Allow naming new diagrams in the format of ${activeFileName}-${timestamp}.svg.

Demos & Tests

Testing Directory Structure

- Vault
    - testfolder
        - testfolder.md
    - ZOB_assets

Settings page

Screen Shot 2023-04-09 at 23 08 37

Default location: "Same folder as current file", timestamp naming on, wikilink: relative path

Obsidian settings

Screen Shot 2023-04-09 at 23 19 48

Demo

https://user-images.githubusercontent.com/11176415/230839195-d1f35ce7-2977-49ab-8e87-45136f72e5e6.mov

In File Explorer

Screen Shot 2023-04-09 at 23 10 13

Default location: specified global attachments folder, wikilink: relative path

Screen Shot 2023-04-09 at 23 12 04

Screen Shot 2023-04-09 at 23 12 22

Default location: specified global attachments folder, wikilink: absolute path

Screen Shot 2023-04-09 at 23 12 04

Screen Shot 2023-04-09 at 23 13 09

SPiCaRiA commented 1 year ago

Update: just fixed a bug that may not generate available attachment path correctly when the options are "Same folder as current file" and uses the default naming of "Diagram".

Test

Correctly renaming the new file to "Diagram 1" to avoid collision.

Screen Shot 2023-04-10 at 23 08 23

SPiCaRiA commented 1 year ago

Will open a new PR for the same feature. The implementation in this PR is terrible lol