Issue #2060Opened June 1, 2019by alikabeer320 reactions

Custom defined css classes do not work if I use editor.setStyle(css_text);

Question

I need to set styles using the data I receive from the database asynchronously. But then the css I composed manually gets removed.

const cssComposer = editor.CssComposer;
var sm = editor.SelectorManager;
var sel1 = sm.add('simple-div');
var rule = cssComposer.add([sel1]);
// Update the style
rule.set('style', {
  width: '100%',
  height:'auto',
  padding:'15px',
  float: 'left',
});

the above class .simple-div doesn't exist If I use setStyle()

Answers (1)

artfJune 13, 20190 reactions

Use the setRule API

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.