chhoumann / quickadd

QuickAdd for Obsidian
https://quickadd.obsidian.guide
MIT License
1.54k stars 137 forks source link

[FEATURE REQUEST] Expose template API function #402

Closed cdloh closed 1 year ago

cdloh commented 1 year ago

Is your feature request related to a problem? Please describe. I'd like to use the Template API within my user scripts. Currently this isn't possible so I have to chain user scripts if I want to create templates in the middle of macros and split user scripts up

Describe the solution you'd like Add it to the already exposed QuickAdd API

Additional context

I'm happy to give this a shot as an MR just want to check it's something that we'd be happy to add / support.

In my mind it would be a slightly simplified API as to what is exposed in the UI.

Ie template choice, template action (append / overwrite etc), destination & variables that are to be passed to the engine.

cdloh commented 1 year ago

If there is a better way of doing this I'm all ears! Maybe create many macros & choices that just output templates?

My issue with that is my QuickAdd menu quickly becomes over whelming. Maybe a way to execute macros directly without having to create choices? Or be able to executeChoices that are part of Multis directly? Or hide choices?

chhoumann commented 1 year ago

Have been thinking about this for a bit now, but haven't reached any great solutions yet.

Can you give an example of a problem it would solve for you? A specific use case. Just want to make sure I'm understanding the underlying problem.

From what I understand, the menu has become bloated for you, and you'd like to make it simpler.

My menu looks like this: image

All in all, it has a bunch of choices... way more than shown in this image: image

But most are hidden in multis. It's possible to assign a hotkey to a multi, which opens just that multi.

Additionally, executeChoice is able to any choice (even those nested in multis), similarly to if you had activated the choice through the menu. That has helped me alleviate the large-menu problem.

cdloh commented 1 year ago

Hey thanks for this. Turns out I was completely barking up the wrong tree and you were 100% right on all the above.