Answer the question
In order to leave comments, you need to log in
Ckeditor - how can I make sure that when a DOM element (p, for example. or ul) is created, a class is automatically added to it immediately?
How can I do it? I need this because I am using reset.css. Which is why I don't have lists or bold or anything like that. But I don't want to cancel the reset. I want to add a class for elements that have been written in ckeditor. I found this code on the internet:
CKEDITOR.on('instanceReady', function (ev) {
var editor = ev.editor;
editor.dataProcessor.htmlFilter.addRules({
elements: {
p: function (el) {
el.addClass('myClass');
}
}
});
});
Answer the question
In order to leave comments, you need to log in
You don't have to want it. The found solution has a number of significant drawbacks. One adequate solution to the problem would be to assign a class to the body of the editor's document. There is config.bodyClass for this. And for its child elements already reassign styles.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question