Issue #1315💬 AnsweredOpened July 24, 2018by YashPrince0 reactions

Get all the style value by ID

Quick answerby jmrgz

editor.getCss(); -> will give you all the CSS, is up to you to find what you need. comp = editor.getSelected(); const html = comp.toHTML(); -> selected comp html const css = editor.CodeManager.getCode(comp, 'css', {cssc: editor.CssComposer}); -> selected comp CSS

Read full answer below ↓

Question

@artf I want to get all the style associated with model selected by ID after save the template and reload and re init the editor. But I can not get all the style value of the selected model. But in css there are 2 css definition for that ID I want to know How can I get all the style value applied for a ID either it is 2 time or multiple time. Please also tell me how to prevent css composer to add new style tag for same ID after page reload or editor re-init so that it will not create new style and it only update the previous style.

Answers (3)

jmrgzJuly 25, 2018

editor.getCss(); -> will give you all the CSS, is up to you to find what you need.

comp = editor.getSelected(); const html = comp.toHTML(); -> selected comp html const css = editor.CodeManager.getCode(comp, 'css', {cssc: editor.CssComposer}); -> selected comp CSS

lock[bot]September 17, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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 →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.