首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >充斥着<span>标签的cleditor内容

充斥着<span>标签的cleditor内容
EN

Stack Overflow用户
提问于 2012-03-27 19:59:08
回答 1查看 596关注 0票数 1

我在一个WordPress插件中使用cleditor作为我的富文本编辑器。

然而,似乎是随机的,它决定在我的内容中插入<span class="Apple-style-span">

我在谷歌上快速搜索了一下,没有找到关于cleditor的任何东西,但显然ckeditor有一个similar bug on Webkit browsers --我网站上的两位内容作者都使用谷歌浏览器。这就是logged as a bug with webkit

有没有人知道如何解决这个问题,除了在保存或查看内容时使用PHP str_replace

以下是输出的示例:

代码语言:javascript
复制
<h2 id="notes" class="profile_notes">Notes</h2>
<p>
    <span class="Apple-style-span" style="background-color: rgb(255, 255, 255); ">
        <div>
            This species is assigned the codes A220, A221 and A222 under the DATZ 'A' number system with these referring to similar-looking, possibly conspecific, populations. These differ in some aspects of colour pattern, particularly the orientation of the caudal-fin markings which may be horizontal, vertical, or somewhere inbetween.
        </div>
        <div>
            <br>
        </div>
        <div>
            One population displays an orange colouration on the belly and is sometimes referred to as A. mendezi 'orange' (A222) while another known as A. sp. 'fork-band' or 'gabelband' and collected in the rio Jaú may also represent a form of A. mendezi.
        </div>
        <div>
            <span class="Apple-style-span" style="background-color: rgb(255, 255, 255); ">
                <br>
            </span>
        </div>
            Apistogramma&nbsp;is...
        </div>
    </span>
</p>

提前谢谢你,

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-04-08 19:40:50

这是一个在javascript中调用execcommand时出现的“特性”(在不同的浏览器中会有不同的结果),在http://www.quirksmode.org/dom/execCommand.html中进行了有益的总结

我不知道这是否可以在浏览器中规避,但我对此表示怀疑。最好的方法是在后端使用lxml或BeautifulSoup删除“有问题的”HTML类。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9889128

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档