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

Refer to current note clone in render node script #4896

Open
Aurel300 opened this issue Jan 15, 2025 · 0 comments
Open

Refer to current note clone in render node script #4896

Aurel300 opened this issue Jan 15, 2025 · 0 comments

Comments

@Aurel300
Copy link

I can create a render note template:

  • template (render note) with #template and some label definitions
    • implementation (HTML)
      • JS code (JS frontend)

I can create clones of the template. What I would like to happen is: for each clone of the template, I set the promoted attributes to different values. Then, the implementation should render each clone differently, based on these attributes. However, how do I access the clone's attributes rather than the template's? As far as I can tell, I can use:

  • api.startNote - will refer to "implementation" above, from the template's subtree
  • api.currentNote - will refer to "JS code" above, from the template's subtree

If the render note is the currently open note, I can use api.getActive* functions, e.g., (await api.getActiveContext()).note. However, this fails for child previews, say if foo is open in this tree:

  • foo
    • clone 1 of template
    • clone 2 of template

In that case, the above function will return foo.

So, am I missing something? Is there a way to get the render note clone that is actually being rendered, whether it is the main note or a preview?

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

No branches or pull requests

1 participant