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

Define selected class.

Question

Hello @artf ,

Is there a way to automatically select the class that is created on elements with custom styles.

image

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, 20171 reactions

Update:

Ok I figured out that I can make them all unselect by default by changing src/selector_manager/model/Selector.js

   active: false,

image

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, 20171 reactions

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, 20170 reactions

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/selector_manager/model/SelectorModels.js

        // it('Has active property', () => {
        //   expect(obj.has('active')).toEqual(false);
        // });

and this

test/specs/css_composer/e2e/CssComposer.js line 129

 ruleOut = JSON.parse(JSON.stringify(ruleOut));
          var ruleResult = {
            mediaText: '',
            selectors: [{
             active: false, //changed this to false

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.