Skip to content

Mount straight on DOMNode #90

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

Open
YanikCeulemans opened this issue Feb 28, 2025 · 2 comments
Open

Mount straight on DOMNode #90

YanikCeulemans opened this issue Feb 28, 2025 · 2 comments

Comments

@YanikCeulemans
Copy link

Hi, I'm loving Flame and was looking for a way to mount a flame application straight on a DOMNode, Web.DOM.Internal.Types.Element or something similar. The docs show that this is not possible, only through a QuerySelector can you mount a Flame application. However, I already have a node without anything to select on with a QuerySelector.

This makes it quite awkward to mount the application to. My current approach is:

  1. Generate a unique identifier
  2. Assign it to the id of the node
  3. Concat "#" with the the id
  4. Pass the result to the QuerySelector constructor
  5. Pass the QuerySelector to the mount function

I have already taken a look at the source of the current Flame.Application.EffectList.mount function, it calls the run function which takes a Node as one of its parameters. However, the run function is not exposed from the module.

Would you be open to consider exposing an additional mount function that takes some sort of Node?

Thanks in advance!
Kind regards.

@easafe
Copy link
Owner

easafe commented Mar 1, 2025

Hello there, this seems like a easy change, yes. But couldn't your node be selected by anything other than the id as well?

@YanikCeulemans
Copy link
Author

Well, I'm working in the context of a plugin for Obsidian. The API for a modal for example gives back an HTMLElement. Looking at the DOM when a modal is opened shows this:

Image

It looks like there is a class .modal-content I can select on. I'm not sure if that's the most reliable way to select it however, multiple modals can be open at the same time.

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

2 participants