Issue #1342💬 AnsweredOpened August 6, 2018by ryzraz1 reactions

How to add a new class to the editor's iframe body?

快速解答by ploutos271

@ryzraz what do you mean an existing class ? Even thought, setStyle can replace properties of existing classes by overwrite each classes as you like.. example:::

Read full answer below ↓

Question

hi, Is that possible to add a new css class to the body of editor's iframe ??

Answers (3)

ploutos27August 7, 2018

@ryzraz what do you mean an existing class ? Even thought, setStyle can replace properties of existing classes by overwrite each classes as you like..

example:::

editor.setStyle(` 
     .gjs-toolbar { 
          background-color: #595e61;  /* replace the background color of toolbar */
     }   
`);
ploutos27August 6, 2018

Hi @ryzraz you can use setStyle as below

editor.setStyle(` 
   .your-selector {
       color: white;
       background: red;
   }
`);
ryzrazAugust 6, 2018

hi @ploutos27, its an existing class .. i wanted here to add that class to the body of iframe..!

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.