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

Extended button features #194

Closed
XandaPanda42 opened this issue Jan 19, 2024 · 5 comments
Closed

Extended button features #194

XandaPanda42 opened this issue Jan 19, 2024 · 5 comments
Labels
feature request New feature or request

Comments

@XandaPanda42
Copy link

XandaPanda42 commented Jan 19, 2024

Is your Feature Request Related to a Problem?

No response

Describe the Feature you'd Like

Hey,

Love the Plugin, it's helped heaps. I thought I'd put in a feature request for some things I think might be cool, or could be useful.

Relative Text Entry

I think it'd be useful for a button to be able to insert text into the current document, but especially using a position relative to itself. For example, it inserts a string (any) 5 characters before the button prompt itself, followed by a newline.

Use Case

This would allow the user to add a new line to a markdown table for example, or allow greater control over templater code. You could have a button that inserts a template, followed by a few newlines, followed by a second command to apply it. You can already chain commands together.

The current functionality is either apply a template to a new note, or add a string to the cursor position, but buttons aren't shown in edit mode, and the cursor isn't shown in reading mode, which limits you to using a different note in the sidebar to add text this way.

Destructible buttons OR a way to bind the "Hidden:" state to a Note's frontmatter field or property.

A feature to allow a button to switch itself off, or even delete itself on command.

EDIT: Sorry, I just had a look through previous FR's again and saw this had been mentioned already as WONTFIX. All good.

Use Case

On my landing page, I've got two buttons, One switches Obsidian into Dark Mode. The other switches it into Light Mode. When I'm in dark mode, the dark mode button is useless and just taking up space and the same with light mode.

But if the button was able to hide itself after being clicked, only one button would be visible at a time. Like a toggle, but with the command input functionality of a button, and the possibility for more than two options.

Variables or custom fields for buttons?

If there was a way to have a button copy a bit of the frontmatter and send it along with a template.
On a daily note page for example. I need to write down that I've an important call coming in a few days. I make a dataview field with a button below it. I use the button to create a new Note using a template I've provided, but there's no (non "hacky") way to send the date field of the current page along with it.

Use Case

If I enter the note page for my daily note for 7 days from now, I can click a button and it will automatically create and template a note for a deadline using the "Date:" field of the page it came from.

This could also be used within the same page. If I'm writing notes on an appointment I'm currently in, and learn there's a new one coming up in two weeks time, I can click a button, and It'll automatically fill out the business name for me.

If you want any clarification on what I mean for any of these or any other use cases, let me know. I think they could add some really useful functionality, especially to people who aren't really familiar with JS yet, myself included.

Thanks for reading :-) Wish I knew enough Javascript to contribute in other ways.

Additional Context

No response

@XandaPanda42 XandaPanda42 added the feature request New feature or request label Jan 19, 2024
@mProjectsCode
Copy link
Owner

  1. I am still thinking about if I want to add this or not.
  2. This would be part of 1
  3. If you want variables you should use a JS action and run whatever you want to do from JS. If I add variables to button action, I would end up creating a scripting language and there is already the option of using a better scripting language (JavaScript) ;).

btw you can call button actions from JS with meta binds API.

@XandaPanda42
Copy link
Author

Ah thats perfect. Exactly what I needed. Between this and JSEngine I'm sorted. Thanks :-)

@johnpearman
Copy link

johnpearman commented Feb 4, 2024

first use case of being able to append text within a document is currently broken in the obsidian buttons plugin. if this gets added i'll definitely move over. so that's one vote from me :)

@tonytamps
Copy link

@XandaPanda42 would you be able to post your solution here as an example for us who are also looking to do something similar?

@mProjectsCode
Copy link
Owner

I am closing this in favor of #206

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

No branches or pull requests

4 participants