我使用 CKeditor 版本 4。我面临与 HTML 5 标签相关的问题。
输入HTML代码:
<div class="col-md-4 col-sm-4">
<div class="item-cont">
<a href="contents/view/home">
<figure>
<img src="img/1468996695_img-1.jpg" />
</figure>
<div class="item-content">
<div class="align-content">
<div class="text-cont">
<h1>Text</h1>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry.</p>
</div>
</div>
</div>
</a>
</div>
</div>
从 Ckeditor 输出返回
<div class="col-md-4 col-sm-4">
<div class="item-cont">
<p><a href="contents/view/home"><img src="img/gallery/subGallery_1/1468996695_img-1.jpg" /> </a></p>
<div class="item-content">
<div class="align-content">
<div class="text-cont">
<h1><a href="contents/view/home">Aarhus</a></h1>
<p><a href="contents/view/home">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry.</a></p>
</div>
</div>
</div>
</div>
</div>
Issue:-
它将用“p”标签替换“figure”标签
外部锚标记替换为内部锚标记
我找到了正确的解决方案
CKeditor 设置的更改
$(function(){
CKEDITOR.replace('tinyeditor');
CKEDITOR.dtd.a.div = 1;
CKEDITOR.dtd.a.figure = 1;
CKEDITOR.config.allowedContent = true;
});
这样可以解决anchor标签和figure标签的问题
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)