[HELP] Get css of selected component and its children
Question
Hi,
i'm trying to implement possibility to save elements as custom blocks. How can i get css of component and its children? I can recursively get styles from each nested component, but maybe there is a way, how it can be done easier?
Answers (2)
const component = editor.getSelected();
let componentCss = editor.CodeManager.getCode(component, 'css', {
cssc: editor.CssComposer
});
@Ju99ernaut thanks!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #392
Define selected class.
Hello @artf , Is there a way to automatically select the class that is created on elements with custom styles. I'm currently trying to dyna...
Issue #2404
Question: how to observe children changes in component
Is there an easy way to subscribe/listen to changes in the components/children of my custom component type? Perhaps an event I can subscrib...
Issue #913
[Question] Using Style tag instead of css
Hi, I've been taking a look inside of the dom_components, but cant seem to figure out how to manually override the styling aspect. I need a...
Issue #1953
[QUESTIONS] render without iframe or get global styles and scritps
Hello, I am trying to integrate grapesjs in prestashop, but due to the iframe, I do not get the global css or js. I tried to enter the css...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.