Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Pass additional context in URL #77

Closed
panahi opened this issue Sep 17, 2022 · 7 comments
Closed

[Feature Request] Pass additional context in URL #77

panahi opened this issue Sep 17, 2022 · 7 comments

Comments

@panahi
Copy link

panahi commented Sep 17, 2022

Use Case
I'm starting to build a number of automations that leverage obsidian-advanced-uri to invoke commands (some external to obsidian, like via shortcuts, and some internal from buttons in dataview output).

For something like what I'm trying to do in #76, the flow ends up like:

  • click on button in a dataview table listing out tasks
  • button uses advanced-uri to navigate to the file that contains the task and puts the cursor on the line that contains the task and then executes a quickadd macro
  • the quickadd macro puts the currently active line into my clipboard, and then executes javascript which pulls the content out of my clipboard.

My ultimate goal is to not have to navigate to the other file itself. I think this is possible if advanced-uri were enhanced like:

  • expose an API object or something (like how buttons and metaedit do) that a script can access via app.plugins.plugins['obsidian-advanced-uri]
  • That API object can expose the query parameters of the most recent URI invoked

This way, I could pass extra params like &taskfile=&taskline= and access them without the weird clipboard nonsense. I have both of those values at the time of creating my dataview table.

@Vinzent03
Copy link
Owner

Vinzent03 commented Sep 26, 2022

The plugin is already available like all other plugins via app.plugins.plugins['obsidian-advanced-uri]. How would the api object be different from the current available methods?

Storing the last query parameters is an easy feature.

@panahi
Copy link
Author

panahi commented Sep 29, 2022

@Vinzent03 Sorry, I meant that while the plugin is accessible there isn't any (that I can see) fields exposed from the object that might contain information like the last query parameters. But that's a moot point I guess - adding a way to get the last query parameters is enough for me

@Vinzent03
Copy link
Owner

Does the new version help you? You can access via app.plugins.plugins["obsidian-advanced-uri"].lastParameters

@panahi
Copy link
Author

panahi commented Oct 1, 2022

That's awesome, thanks for the update. I'll try it out this weekend!

@panahi
Copy link
Author

panahi commented Oct 1, 2022

Works great! I was able to change some workflows so that I don't need to change the active file or track state in the clipboard :). And my quick add macro could drop this nonsense and just run the user script

image

@hihihlo
Copy link

hihihlo commented Jan 4, 2023

@Vinzent03 May I suggest to add the info into document ?
app.plugins.plugins["obsidian-advanced-uri"].lastParameters
I had a similar problem today, and found the post accident.
This is a powerful feature !

Vinzent03 added a commit that referenced this issue Jan 6, 2023
@Vinzent03
Copy link
Owner

Good idea! Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants