Issue #1558Opened November 2, 2018by froderf0 reactions

Code manager set code

Question

Hi @artf. Is there something similar to this editor.CodeManager.setCode(component, 'css', {cssc: editor.CssComposer}

to update the css rule of the selected block returned from editor.CodeManager.getCode(component, 'css', {cssc: editor.CssComposer});

For example: This is the returned css rule collection from using
editor.CodeManager.getCode(component, 'css', {cssc: editor.CssComposer});

Returned:

.c1234 {
  color: 'white';
}

.classx .c1234{
 background: black;
}

What I need is to save and update it to like

.c1234 {
   color: 'yellow';
}

.classx .c1234{
 background: #222222;
}

I tried the cc.setClassRule('c1234', { background: #222222 }); but this csscomposer function is limited for 1 class only I need a dynamic function that can update the content returned by editor.CodeManager.getCode(component, 'css', {cssc: editor.CssComposer});

Thank you !

Answers (2)

artfNovember 3, 20180 reactions

Hi @froderf, for now, the only way to get that rule is to use CssComposer.get method. In your case, .classx .c1234 is stored inside selectorsAdd as not being a single level class selector (eg. .class1.class2)

editor.CssComposer.get([], null, null, { selectorsAdd: '.classx .c1234' })
lock[bot]November 3, 20190 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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.