Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Passing DOM container element directly for Mirador init (instead of using id) #4107

Open
Simon-Dirks opened this issue Feb 19, 2025 · 0 comments

Comments

@Simon-Dirks
Copy link

Hi there,

I'm using Mirador (3.4.3) in an Angular project, where I would like to render multiple Mirador viewers into different containers in the DOM. Though I could theoretically generate unique IDs for all of these containers and use the built-in id init functionality (Mirador.viewer({id: '', ...})), in this context it would make much more sense to be able to init Mirador by passing the DOM element directly to the constructor. In my (Angular) use case with a ViewChild, but I can also imagine other scenarios where one already has a reference to the DOM container to be used, even when it does not have a unique id.

From what I'm seeing, this is not supported yet, but perhaps I'm missing something:

if (config.id) this.renderInto(document.getElementById(config.id));

I would say the most straightforward solution would be to add an 'element' or 'container' key to the config as an alternative to passing id. As a quick fix, I was hoping that I could init without passing id and then use the renderInto function to pass my container, but that seems to be a private function.

Do you see the value for this as well? If so, I'd be happy to create a PR for this.

All the best and thanks for the awesome project,
-Simon

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

No branches or pull requests

1 participant