CKEditor 改变了我所有的 HTML [英] CKEditor changing all my HTML

查看:37
本文介绍了CKEditor 改变了我所有的 HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一整天都在与 CKEditor 斗争.都是因为它正在重新格式化我所有的 HTML.出于某种原因,它为

替换了诸如

之类的标签.因此,我使用 这个插件 并将其中一个预定义按钮的 HTML 输出更改为:

<dd class="accordion-navigation"><a href="#panel1">Redigera sidor</a><div id="panel1" class="content"><a href="edit_index.php" title="Redigera startssidan">Redigera startssidan</a>

</dd></dl>

有关此代码块的更多信息此处.

当我按下按钮时,CKEditor 输出以下代码:

<p><a href="#panel1">Redigera sidor</a></p><div class="content"><a href="edit_index.php">Redigera startssidan</a></div><p><a href="#panel2">Inst&auml;llningar</a></p><div class="content"><a href="memberlist.php">Administrat&ouml;rer lista</a></div>

我不明白为什么会发生这种情况.我在 Foundation 5 中使用 CKEditor 4.3.2.

更新

我尝试使用这个插件:http://ckeditor.com/addon/templates并将其中一个模板的 HTML 更改为:

<代码>{标题:'纽约广播节目',图像:'template2.gif',description: '定义两个列的模板,每个列都有一个标题和一些文本.',html: '<div class="row">'+'<div class="small-2 large-4 columns"><p>Skriv titeln och infoga din Youtube radioprogram</p></div>'+'</div>'},

结果还是一样,CKEditor还是输出错误的代码.这是输出:

<p>&nbsp;</p><p>Skriv Titeln och infoga din Youtube 广播节目</p><p>&nbsp;</p>

我想我有强有力的证据表明我的 CKEditor 有问题.有什么线索吗?

解决方案

阅读内容过滤.CKEditor 的内容过滤机制(称为高级内容过滤器)有多种配置方式,因此我不能只在这里展示一次,因为那会产生误导.

更新:在更改任何配置选项后清除浏览器缓存.

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?

解决方案

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.

这篇关于CKEditor 改变了我所有的 HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆