[QUESTION] Dynamic class generation with a template
Question
Hi there !
I am wondering if there is a way to force the dynamic class generation (of the form cXXXXX which happens when I drag'n'drop a component) at template import ?
The problem is, when I use a template, the generated components in the editor don't have that dynamic class, which I need to be able to generate media queries while editing in the phone/tablet modes.
For reference, here is the template I am importing :
https://gist.github.com/davydav/2413f5fdaa154a80dfa49a633bd247bb
Thanks a lot for your awesome work !

Answers (3)
Hi Davy, if you need a class you can set it already in your template, if you need a dynamic one, probably you would make use of events like component:add or block:drag:stop
Thank you for your answer ! Is there anyway to access your method of class generation, or could you point me to where it is in your code ? I've been trying to find it but no luck ! Thanks again
As you see it's called on add, so you can actually disable it (forceClass option) and implement your own logic
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1875
[QUESTION] ID changes when importing html or passing html in components prop in config.
Hi, I built a component and block that I can drag and drop in the canvas. My issue is that some styles rely on the ID. I know this might no...
Issue #1906
Components & Js - Load Template
Hey, I have a component which has a JS attached to it. Everything is created using the JS. When I drag and drop my block for the first time...
Issue #1707
Find images links in the editor
I am trying to integrate GrapesJs in reactJs. Can you please help me out with the below question w.r.t GrapesJs-React, • Is there a way to...
Issue #1683
How to change id/class when new element drop on editor or render element with dynamic ip?
Hello @artf , Hope you are doing well. I have two questions regards dynamic blocks adding, 1) Is it possible to render the block with dynam...
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.