ckfinder删除包裹标签

时间:2013-08-22 13:43:15

标签: javascript ckeditor

我正在尝试使用CK Editor 4实现CMS来编辑网页的某些可编辑片段。但它正在改变标记,尽管我尽最大努力进行配置,但事实并非如此。

其中一个例子是加载到编辑器中的以下原始标记

<article class="last"> 
    <a href="#" class="promo-m">
        <div class="info"> 
                <h3>Access for All</h3>
                <p>We want everyone to enjoy the benefits of good, clear communication.</p>
                <p class="product-cta">
                    Find out more
                </p>
        </div>        
    </a>
</article>

编辑器在wysiwyg模式下渲染后,在保存(或在源模式下查看)时,它会将标记更改为:

<article class="last">
<div class="info">
<h3><a class="promo-m" href="#">Access for All</a></h3>

<p><a class="promo-m" href="#">We want everyone to enjoy the benefits of good, clear communication.</a></p>

<p class="product-cta"><a class="promo-m" href="#">Find out more </a></p>
</div>
</article>

换句话说,它正在删除包装标签并将标签应用于每个包含元素。 不幸的是,这会影响适用于内容的样式,并且意味着更改任何链接将意味着为每个包含的链接元素更改它。

我正在使用此配置关闭ACF:

CKEDITOR.replace('editor', {
    allowedContent: true
});

任何人都可以帮忙吗?

代码在jsfiddle.net上启动(基于早期的stackoverflow答案) http://jsfiddle.net/6FnRf/14/ 您可以单击编辑器中的源按钮,粘贴文章内容,单击以在wysiwyg模式下查看,然后返回源以查看更改标记的方式。

0 个答案:

没有答案