Define selected class.
Update: Ok I figured out that I can make them all unselect by default by changing src/selector_manager/model/Selector.js and this pretty much solves all my problems as when I change the background color of the block, it will update only c875!. Closing this as it's now solved.
Read full answer below ↓Question
Hello @artf , Is there a way to automatically select the class that is created on elements with custom styles. I'm currently trying to dynamically update classes with a grid system and it's working fine but the auto selection of all classes is creating issues. I've been looking at the code for hours trying to figure this out. Any directions to the right file where the magic occurs is appreciated. I'm currently looking at: \src\selector_manager\view\ClassTagView.js Thanks!
Answers (3)
Update: Ok I figured out that I can make them all unselect by default by changing src/selector_manager/model/Selector.js and this pretty much solves all my problems as when I change the background color of the block, it will update only c875!. Closing this as it's now solved.
You can access selectors from the model
model.get('classes').each(selector => selector.set('active', 0))
or for example, disable them all from its module
editor.SelectorManager.getAll().each(selector => selector.set('active', 0))
fyi changing this to false will make your build to fail due to this in the test script: I just commented this out here: test/specs/selectormanager/model/SelectorModels.js and this test/specs/csscomposer/e2e/CssComposer.js line 129
Related Questions and Answers
Continue research with similar issue discussions.
Issue #394
Text: New div is created every time I hit enter instead of creating a </br>
Hi @artf Is there a reason why when inserting text a new div is created for every break instead of a standard </br> Is it possible to disab...
Issue #987
[BUG/Question] Dropdown indicator not displayed for a custom trait
Hello, the dropdown (select) element arrow indicator icon is not rendered when adding a custom trait to a component: I'm using following co...
Issue #659
Custom button Save in Extensions GrapesJS Aviary
Hi, Does way to custom Save button in Extensions GrapesJS Aviary ? https://github.com/artf/grapesjs/wiki
Issue #1843
Class on different states are not being applied to those states.
I'm trying to apply a class on hover of a component and the class is being applied but not on hover, it applies with normal state. Please l...
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 →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.