Replies: 6 comments
-
Hi @AStoker I don't understand what is the real issue with your example (aside not loading GrapesJS styles inside your shadow dom). If you're attaching shadow dom, obviously, you can't do this |
Beta Was this translation helpful? Give feedback.
-
The issue is that I must pass HTML elements everywhere and cannot use selectors. This can become cumbersome to write as I must now use the shadow Dom's query selector for every panel, every element, anything that we hook into GrapesJS. |
Beta Was this translation helpful? Give feedback.
-
I updated the JSFiddle so you can see what we need to do to get styles within Shadow DOM. But unfortunately the CSS that's automatically added by GrapesJS exists on the body and is both polluting the global stylesheets and pointless due to GrapesJS being inside the Shadow DOM. |
Beta Was this translation helpful? Give feedback.
-
Well about the font-awesome, the issue is clear, you can actually disable it from the config with a false value and import it manually as you do it already. What is not yet clear to me is this part:
What exactly do you need to? Can you show me an example of how would you expect it to work? |
Beta Was this translation helpful? Give feedback.
-
Didn't know that about the CSS, that's helpful, thanks. Here's an example repo of what I'm having to do: https://github.com/AStoker/grapesjs-aurelia/blob/main/src/my-app.js How I would envision it working, we'd essentially need some kind of shadow root option. "container" would be great, but it's being used for a different purpose (container of the form rather than the container for GrapesJS). So, we'd have some config, let's just call it 'shadowRoot' for now (but maybe just 'root' is better?), and with that you would pass in an HTML Node. This node is the root for GrapesJS, and therefore any selectors that are being used, any DOM elements being created, they all would be contained inside this root, effectively isolating it from the outside, and enabling isolation from within. let root = config.shadowRoot || document;
root.querySelector(someSelector); |
Beta Was this translation helpful? Give feedback.
-
We have already I'm still not getting your statement here:
Which panels/elements are you talking about?? There are something like 5 modules that allows rendering stuff externally by using |
Beta Was this translation helpful? Give feedback.
-
What are you trying to add to GrapesJS?
Better Shadow DOM support, allowing developers to render GrapesJS inside a Shadow element without having to specifically pass in elements rather than selectors in the configuration.
Describe your feature request detailed
When currently using element selectors, GrapesJS simply uses the document query selector. This does not work when rendering inside a Shadow DOM, as the document isn't the shadow root. I would like to be able to define a shadow root so that anything GrapesJS does/needs is contained within the shadow root.
Example of using GrapesJS inside a ShadowDOM: https://jsfiddle.net/theandybob/s9bnhw30/
Is there an alternative at the latest version?
Is this related to an issue?
Beta Was this translation helpful? Give feedback.
All reactions