我整天都在与 CKEditor 作斗争。都是因为它正在重新格式化我所有的 HTML。出于某种原因,它取代了像 <dl>
这样的标签。对于 <div>
或 <p>
.所以,我拿了this plugin并将其中一个预定义按钮的 HTML 输出更改为:
<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>
有关此代码块的更多信息 here .
当我按下按钮时,CKEditor 输出以下代码:
<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>
我不明白为什么会这样。我在 Foundation 5 中使用 CKEditor 4.3.2。
更新
我尝试改用这个插件:http://ckeditor.com/addon/templates并将其中一个模板的 HTML 更改为:
{
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>'
},
结果还是一样,CKEditor还是输出错误的代码。这是输出:
<p> </p>
<p>Skriv titeln och infoga din Youtube radioprogram</p>
<p> </p>
我想我有强有力的证据表明我的 CKEditor 有问题。有什么线索吗?
最佳答案
了解 Content Filtering .有很多方法可以配置 CKEditor 的内容过滤机制(称为 Advanced Content Filter )所以我不能在这里只显示一次,因为那样会产生误导。
更新:更改任何配置选项后清除浏览器缓存。
关于javascript - CKEditor 改变了我所有的 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26279189/