Skip to content

Replace Self for inline buttons #505

@fredrik-hammar

Description

@fredrik-hammar

Please fill out these Check-boxes

  • I checked for existing similar feature requests
  • I have read the docs and checked that the feature I am requesting is not already implemented
  • My feature request consists of only one feature

Is your Feature Request related to a Problem or Annoyance?

My real problem is that I want to have a button to add rows to a table following a template.

| Time  | Note          |
| ----- | ------------- |
| 10:00 | [[Breakfast]] |
| 13:25 | [[Meditate]]  |
`BUTTON[add]`

But the only way I have figured out to do this is to replace the button with a template that itself contains a copy of the button:

| <% tp.date.now("HH:mm") %> |  |
```meta-bind-button
label: Add
style: default
id: add
actions:
  - type: replaceSelf
    replacement: "templater/Log Entry.md"
    templater: true
```

But now I have to maintain the two copies. I was frustrated to find out that this does not work with inline buttons that would make this an almost elegant solution.

I'm open to better solutions, but I still feel that inline button replacement would be nice.

Describe the Feature you'd like

Make Replace Self work with inline buttons so that the inline button is replaced.

Example

| Time  | Note          |
| ----- | ------------- |
| 10:00 | [[Breakfast]] |
| 13:25 | [[Meditate]]  |
`BUTTON[add]`

```meta-bind-button
label: Add
style: default
id: add
hidden: true
actions:
  - type: replaceSelf
    replacement: "templater/Log Entry.md"
    templater: true
```
Template
| <% tp.date.now("HH:mm") %> |  |
`BUTTON[add]`

Alternatives

Additional Context

This is mentioned in docs of Replace Self.

This only works with buttons in blocks, so this action will not work with inline buttons which are not inside a meta-bind block.

A bonus is that you would no longer need to document this limitation :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedThis issue is depends on another issue that needs to be resolved first.feature requestNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions