Answer the question
In order to leave comments, you need to log in
How to automatically add custom attribute in IMG tag in CKEditor?
Good day.
I need to automatically add data-fancybox to the img tag. Tell me how to do it? I understand that it is necessary to write the code in config.js , but I don’t quite understand which one.
Here is a code example for what the class would add and it works.
CKEDITOR.on( 'instanceReady', function( evt ) {
evt.editor.dataProcessor.htmlFilter.addRules( {
elements: {
img: function(el) {
el.addClass('img-responsive');
}
}
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question