问题
I have been struggling with CKEditor the whole day long. All because it is re-formatting all my HTML. For some reason, it replaces tags like <dl>
for <div>
or <p>
. So, I took this plugin and changed the HTML output of one of the predefined buttons into:
<dl class="accordion" data-accordion>
<dd class="accordion-navigation">
<a href="#panel1">Redigera sidor</a>
<div id="panel1" class="content">
<a href="edit_index.php" title="Redigera startsidan">Redigera startsidan</a>
</div>
</dd>
</dl>
More info about this code block here.
When I press the button, CKEditor outputs the following code:
<p><a href="#panel1">Redigera sidor</a></p>
<div class="content"><a href="edit_index.php">Redigera startsidan</a></div>
<p><a href="#panel2">Inställningar</a></p>
<div class="content"><a href="memberlist.php">Administratörer lista</a></div>
I cannot understand why is this happening. I am using CKEditor 4.3.2 with Foundation 5.
UPDATE
I have tried to use this plugin instead: http://ckeditor.com/addon/templates and change the HTML of one of the templates to:
{
title: 'Ny radioprogram',
image: 'template2.gif',
description: 'A template that defines two colums, each one with a title, and some text.',
html: '<div class="row">' +
'<div class="small-2 large-4 columns"><p>Skriv titeln och infoga din Youtube radioprogram</p></div>' +
'</div>'
},
The result is the same, CKEditor is still outputting the wrong code. This is the output:
<p> </p>
<p>Skriv titeln och infoga din Youtube radioprogram</p>
<p> </p>
I guess I have strong evidence that something is not ok with my CKEditor. Any clues?
回答1:
Read about the Content Filtering. There are many ways to configure CKEditor's content filtering mechanism (called the Advanced Content Filter) so I can't just show here once, because that would be misleading.
Update: Clear your browsers cache after changing any configuration option.
来源:https://stackoverflow.com/questions/26279189/ckeditor-changing-all-my-html