Issue #392💬 AnsweredOpened October 8, 2017by daniel-farina2 reactions

Define selected class.

Quick answerby daniel-farina1

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)

daniel-farinaOctober 8, 2017

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.

artfOctober 11, 2017

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))
daniel-farinaOctober 8, 2017

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.

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.