充满<span>标签

cleditor content riddled with <span> tags

本文关键字:标签 gt span 充满 lt      更新时间:2023-09-26

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

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

我在谷歌上快速搜索了一下,找不到cleditor的任何内容,但显然ckeditor在Webkit浏览器上也有类似的错误——我网站上的两位内容作者都使用谷歌Chrome。这已被记录为webkit的错误。

除了在保存或查看内容时执行PHP str_replace之外,有人知道如何解决这个问题吗?

以下是输出示例:

<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>

提前感谢,

这是一个"功能",当用javascript调用execcommand时会出现(在不同的浏览器中会有不同的结果),在http://www.quirksmode.org/dom/execCommand.html

我不知道在浏览器中是否可以绕过这一点,但我对此表示怀疑。最好的方法是使用lxml或BeautifulSoup在后台剪切"冒犯"的HTML类。