Question

Last week i posted a question that CKEditor wasn't maintaining the trailing slash of the
element. This though had a simple solution. Jquery .replace("<br>", "<br />"). This will be done when the Html is read from the Editor.

It's not a solution that will win a price award. but it worked. (The old post has been removed. because it was project related. and not interesting for other people)

Now the following problem <img> needs to be generated as <img />. The problem stays that the Ckeditor isn't keeping the trailing slash for self closing elements.

Someone told me on the other topic(That's deleted), that possibly we are changing settings of the HTMLWriter plugin. What should be causing the problem. I know the code we are using very good and i am sure that we didn't configure any settings of the html writer.

Besides that we only added custom plugins to the Ckeditor. And we had to shutdown the ACF because it was creating to much problems.

Sadly i can't share any code because it's code of the client.

But does anyone know a simple solution to put the trailing slash? Or if you have had the same problem, and have a solution feel free to anwser.

Was it helpful?

Solution 2

MY answer would be:

that i never found a solution. After this we looked up and Xhtml validator. And this one fixed all closing tag problems.

Thanks for the effort anyway

OTHER TIPS

Fix for CKEditor 4.x is following:

CKEDITOR.on('instanceReady', function(ev) {
    // Ends self closing tags the XHTML way, like <br />.
    ev.editor.dataProcessor.writer.selfClosingEnd = ' />';
});

Paste this code into config.js after CKEDITOR.editorConfig = function( config ) { ... }.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top