1

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.

4

2 回答 2

2

CKEditor 4.x 的修复如下:

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

将此代码粘贴到config.jsafterCKEDITOR.editorConfig = function( config ) { ... }中。

于 2014-02-11T18:48:29.697 回答
0

我的回答是:

我从来没有找到解决方案。在此之后,我们查找了 Xhtml 验证器。而这个解决了所有结束标签的问题。

无论如何感谢您的努力

于 2014-02-12T07:22:02.367 回答