Issue #2861✓ SolvedOpened June 28, 2020by makkaronis4e3 reactions

Get css of selected component and its children

快速解答by Ju99ernaut3

Read full answer below ↓

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)

👍 Most helpfulJu99ernautJune 29, 2020
const component = editor.getSelected();
let componentCss = editor.CodeManager.getCode(component,  'css', {
   cssc: editor.CssComposer
});
makkaronis4eJune 29, 2020

@Ju99ernaut thanks!

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.