Issue #715💬 AnsweredOpened January 5, 2018by suchithmahadi0 reactions

Can we set a class to wrapper

快速解答by artf

Sure editor.DomComponents.getWrapper().addClass('wrapper')

Read full answer below ↓

Question

Hello ,

As per the document , // Change background of the wrapper and set some attribute var wrapper = domComponents.getWrapper(); wrapper.set('style', {'background-color': 'red'}); wrapper.set('attributes', {'title': 'Hello!'});

Can we set a class to wrapper.

Please let us know how to set a class to the root component i.e. wrapper.

Thanks.

Answers (3)

artfJanuary 5, 2018

Sure editor.DomComponents.getWrapper().addClass('wrapper')

suchithmahadiJanuary 5, 2018

@artf , Thanks for the reply.

Can we do editor.DomComponents.getWrapper().addClass('wrapper')

in the release 0.10.7

Thanks.

suchithmahadiJanuary 5, 2018

Sorry to bother you,

Because when i tried in version 0.10.7 it is giving a error [Error] TypeError: wrapper.addClass is not a function. (In 'wrapper.addClass('wrapper')', 'wrapper.addClass' is undefined) Global Code (index.html:4474) And one more request , i do not want to update to latest release, so can you tellme , any possible way to achieve this.

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 →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.