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
534 stars 42 forks source link

Get position of the pressed button in the inline JS #414

Closed ujikol closed 2 months ago

ujikol commented 2 months ago

Please fill out these Check-boxes

Is your Feature Request related to a Problem or Annoyance?

No response

Describe the Feature you'd like

I need to process the text in the context of the button, e.g. the markdown section below the button. For that I need to know the buttons line or offset. The editors cursor might be somewhere else.

Alternatives

At least get the ID of the button. But would be off much less help because duplicating section with related buttons would lead to non-distinguishable IDs.

Additional Context

No response

mProjectsCode commented 2 months ago

Getting line numbers and positions of inline elements is not possible in reading mode, which is a limitation of the Obsidian API.

ujikol commented 2 months ago

Is it possible to get the rendered output, i.e. the contents of preview/reading mode? This would help with another issue.

Moritz Jung @.***> schrieb am Mo., 16. Sep. 2024, 20:59:

Getting line numbers and positions of inline elements is not possible in reading mode, which is a limitation of the Obsidian API.

— Reply to this email directly, view it on GitHub https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues/414#issuecomment-2353685434, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABL3CWIY2Q4ETKXGI56RLODZW4TA5AVCNFSM6AAAAABOJ3UYEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJTGY4DKNBTGQ . You are receiving this because you authored the thread.Message ID: @.***>

mProjectsCode commented 2 months ago

what exactly do you mean by output? The HTML element of the button? You should never modify that.

ujikol commented 2 months ago

I did not want to modify the rendered html. I want to parse it, actually not the button but the context (section below it).

Moritz Jung @.***> schrieb am Mo., 16. Sep. 2024, 21:43:

what exactly do you mean by output? The HTML element of the button? You should never modify that.

— Reply to this email directly, view it on GitHub https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues/414#issuecomment-2353773076, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABL3CWNJ7D47DNGUUZK42TTZW4YGHAVCNFSM6AAAAABOJ3UYEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJTG43TGMBXGY . You are receiving this because you authored the thread.Message ID: @.***>

ujikol commented 2 months ago

Maybe my question was misleading. With inline I ment inline of the button definition, not in markdown inline code.

The issue is that your plugin provides notePosition to e.g. runReplaceSelfAction but not to runInlineJsAction. In that inline Js code I would need to position.

Am Mo., 16. Sept. 2024 um 20:59 Uhr schrieb Moritz Jung < @.***>:

Getting line numbers and positions of inline elements is not possible in reading mode, which is a limitation of the Obsidian API.

— Reply to this email directly, view it on GitHub https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues/414#issuecomment-2353685434, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABL3CWIY2Q4ETKXGI56RLODZW4TA5AVCNFSM6AAAAABOJ3UYEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJTGY4DKNBTGQ . You are receiving this because you authored the thread.Message ID: @.***>

mProjectsCode commented 2 months ago

In the next version of the plugin you can access some extra information about the button including its location (if known) via context.buttonContext

ujikol commented 2 months ago

Great, thanks. Any planned release date?

Am Sa., 21. Sept. 2024 um 14:02 Uhr schrieb Moritz Jung < @.***>:

In the next version of the plugin you can access some extra information about the button including its location (if known) via context.buttonContext

— Reply to this email directly, view it on GitHub https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues/414#issuecomment-2365161697, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABL3CWN2UTCYITIQ6LZEFTDZXVN5RAVCNFSM6AAAAABOJ3UYEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRVGE3DCNRZG4 . You are receiving this because you authored the thread.Message ID: @.***>

mProjectsCode commented 2 months ago

No. When it's ready. A canary release will come tomorrow, if you can't wait.