Vinzent03 / obsidian-advanced-uri

Advanced modes for Obsidian URI
MIT License
766 stars 44 forks source link

[Bug?] [Question] Append command to heading #147

Open Boonthrall opened 1 year ago

Boonthrall commented 1 year ago

Okay so i'm kind of at my wits end.

Resources

Scenario / What i want

I'd like to add a button/shortcut inside of obsidian to quickly add tasks to my daily note under a certain heading. To add a task I'd like to execute the Task Command that opens a Modal and inserts the created task at the current line. Preferably directly under the heading but it's also fine if it appends to the end of that heading section.

URI Versions

According to Command URI documentation

obsidian://advanced-uri?vault=Regular%20planning&commandid=obsidian-tasks-plugin%253Aedit-task&daily=true&heading=ToDo&mode=append

Other attempts

obsidian://advanced-uri?vault=Regular%20planning&commandid=obsidian-tasks-plugin%253Aedit-task&mode=append&daily=true&heading=ToDo
obsidian://advanced-uri?vault=Regular%20planning&daily=true&heading=ToDo&commandid=obsidian-tasks-plugin%253Aedit-task&mode=append

I have tried several other combinations but don't plan on posting them all.

Expected behaviour

Current behaviour

If a heading is specified AND a mode is specified (append/prepend) the heading parametee gets ignored and the cursor moved to the end/beginning of the file But everything else works as expected/intended

Other notes

I'm most likely just doing something wrong, but I can't for the life of me figure out what. So sorry for that.

Vinzent03 commented 1 year ago

So when you omit the mode, but keep the heading parameter, the task gets inserted at the beginning of the heading, right?

Boonthrall commented 1 year ago

Okay, seems like i got my notes fumbled, sorry!

Also sorry for the late reply, the week suddenly got very busy.

With further testing, this is the current behaviour of different parts of the URI.

1)Remove mode

URI

obsidian://advanced-uri?vault=Regular%20planning&commandid=obsidian-tasks-plugin%253Aedit-task&daily=true&heading=ToDo

Expectation

2)Move Note and Heading parameters

URI

Variant 1

obsidian://advanced-uri?vault=Regular%20planning&daily=true&heading=ToDo&commandid=obsidian-tasks-plugin%253Aedit-task

Variant 2 (with mode=append)

obsidian://advanced-uri?vault=Regular%20planning&daily=true&heading=ToDo&mode=append&commandid=obsidian-tasks-plugin%253Aedit-task

Expectation

Result ❌

Doesn't work as expected

3)Remove command parameter

URI

obsidian://advanced-uri?vault=Regular%20planning&daily=true&heading=ToDo

Expectation

4)Use a different command

URI

obsidian://advanced-uri?vault=Regular%20planning&daily=true&heading=ToDo&commandid=editor%253Aset-heading-2

Expectation

5)Use a different command that also opens a modal/dialog

URI

obsidian://advanced-uri?vault=Regular%20planning&commandid=buttons%253Abutton-maker&daily=true&heading=ToDo

Expectation

Result ❌

Doesn't work as expected