mProjectsCode / obsidian-meta-bind-plugin

A plugin for Obsidian to make your notes interactive with inline input fields, metadata displays, and buttons.
https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/
GNU General Public License v3.0
473 stars 38 forks source link

Button updateMetadata bindTarget should default to the active file, not the button file #342

Closed tim-barnes closed 4 months ago

tim-barnes commented 4 months ago

Please fill out these Check-boxes

This Issue Occurs on

Plugin Version

1.1.0

Describe the Issue

Run a 2 step button:

  1. Create a new file
  2. updateMetadata to add a new tag to the frontmatter

Steps to Reproduce

Example button (uses unique note creator core plugin) - similar behaviour with new note or templater:

label: New Example Note
hidden: false
tooltip: Create a new example note
id: newExampleTest
style: default
actions:
  - type: command
    command: zk-prefixer
  - type: updateMetadata
    bindTarget: tags
    evaluate: false
    value: "#example"

When run, the note containing the button gets the #example tag

Expected Behavior

The new note created at step 1 gets the updatedMetadata, ie the default bindTarget is the new file created.

mProjectsCode commented 4 months ago

This is intended behavior. If no file is specified, it will default to the file that the button is in.

mProjectsCode commented 4 months ago

It is true that the docs use the wording "current file" which is not optimal.

tim-barnes commented 4 months ago

So just to be clear. Action one replaces the current file in the current tab, and then action 2 acts on a file that is now closed. And this is intended behaviour.

Shame, this would have been so powerful had it work the way intuition suggested.