CKEditor changing all my HTML

删除回忆录丶 提交于 2019-12-24 02:23:56

问题


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&auml;llningar</a></p>

<div class="content"><a href="memberlist.php">Administrat&ouml;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>&nbsp;</p>

<p>Skriv titeln och infoga din Youtube radioprogram</p>

<p>&nbsp;</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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!