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
543 stars 44 forks source link

Inline button with hidden YML block renders an error in reading mode #207

Closed AmmarCodes closed 10 months ago

AmmarCodes commented 10 months ago

Please fill out these Check-boxes

This Issue Occurs on

Plugin Version

0.12.0

Describe the Issue

When adding an inline button and add its YAML definition with hidden: true property, it will render an error in the place of the YAML definition, clicking that definition will show the attached modal about having duplicated ID that already exists.

image

Steps to Reproduce

Meta Bind has an in plugin help page. `BUTTON[help-button]` Isn't that cool?

```meta-bind-button
style: primary
label: Meta Bind Help
id: help-button
hidden: true
action:
  type: command
  command: obsidian-meta-bind-plugin:open-faq


Open the page in **reading mode** and observe the error.

### Expected Behavior

The expected behavior is to not render the error instead of the YAML definition but render nothing if there's no real issue.

P.S. Thanks for the great plugin!
mProjectsCode commented 10 months ago

I can reproduce the issue, though I don't have a good idea how to fit this without compromising the button id check yet.

the1gofer commented 10 months ago

more context

Code being used:

label: Activate Suit
hidden: true
class: ""
tooltip: ""
id: setup-suit
style: primary
actions:
  - type: command
    command: quickadd:choice:e3718048-291b-49c5-a923-df60a0c36ae6
  - type: updateMetadata
    bindTarget: fileClass
    evaluate: false
    value: "Active Case"
label: New Task
hidden: true
class: ""
tooltip: ""
id: insert-task
style: primary
actions:
  - type: command
    command: quickadd:choice:7049710b-931d-4005-a898-6dc10ca3bd85
label: Send Waivers
hidden: true
class: ""
tooltip: ""
id: waiver-tasks
style: primary
actions:
  - type: command
    command: quickadd:choice:24917018-e7cf-42a3-a7d6-a5016cc2eb8e
label: New Note
hidden: true
class: ""
tooltip: ""
id: new-note
style: primary
actions:
  - type: templaterCreateNote
    templateFile: Templates/2024/Insert Note In Active File.md
    folderPath: TCPA/Notes
    fileName: ""
    openNote: true
label: Subpoena
hidden: true
class: ""
tooltip: ""
id: new-subpoena
style: primary
actions:
  - type: templaterCreateNote
    templateFile: Templates/2024/Insert Subpoena In Active File.md
    folderPath: "TCPA/Subpoenas"
    fileName: ""
    openNote: true
Screenshot 2024-02-04 at 5 32 49 PM

I didn't not see this prior to today's update.

Outi-s commented 9 months ago
command: quickadd:choice:24917018-e7cf-42a3-a7d6-a5016cc2eb8e

How are you getting these quickadd:choice ids?

the1gofer commented 9 months ago

assign the quick add to a keyboard shortcut, then use the button builder to run the command and select it from the command list.

On Thu, Feb 29, 2024 at 9:36 AM Outis @.***> wrote:

command: quickadd:choice:24917018-e7cf-42a3-a7d6-a5016cc2eb8e

How are you getting these quickadd:choice ids?

— Reply to this email directly, view it on GitHub https://bitli.pro/260Gy_38dd0dfa, or unsubscribe https://bitli.pro/260Gz_70e1b884. You are receiving this because you commented.Message ID: @.***>

Outi-s commented 9 months ago

@the1gofer, thank you.