Unable to add class when adding Dom Component
Yeah, you have to use classes property, but I agree that is confusing (that because classes are treated a bit differently), so I'll try to make the initialization possible also with attributes.class value
Read full answer below ↓Question
GrapesJS Version used: 0.16.12 (current) Just a strange behavior, I can add all the attributes I want when adding component directly inside canvas using dom components add function (like code below) but the editor always remove the class. The class is only added if we create the component first and then assign a class to it. Example, we add the code above and then we add the code below:
Answers (1)
Yeah, you have to use classes property, but I agree that is confusing (that because classes are treated a bit differently), so I'll try to make the initialization possible also with attributes.class value
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3674
Invisible webcomponents
Version: 0.17.19 What is the current behavior? That the added webcomponent is visible: When adding web components inside grapesjs container...
Issue #510
Add new class programatically
Hello Artf, I want to edit the styles of components (mostly imported html) without modifying all components with the same class. I tried to...
Issue #3316
The editor does not remove the dead script blocks
Version: 0.16.34 Are you able to reproduce the bug from the demo? [ ] Yes [x ] No As I understand the code import dialog skips all the HTML...
Issue #5037
How to drag external text into particular index inside the textable component?
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link NA Describe...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →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.