2012-03-27 67 views
1

我使用cleditor作爲我在WordPress插件中選擇的富文本編輯器。cleditor內容千瘡百孔<span>標籤

但是,看似隨機,它已決定將<span class="Apple-style-span">插入到我的內容中。

我做了一個Google,但找不到cleditor,但顯然ckeditor有一個similar bug on Webkit browsers - 我網站上的兩位內容作者都使用Google Chrome。這已經是logged as a bug with 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> 

由於提前,

回答

1

這是一個「特徵」,在出現(用不同的瀏覽器不同的結果)時,execcommand被調用以JavaScript ,有助於總結在http://www.quirksmode.org/dom/execCommand.html

我不知道這是否可以繞過瀏覽器,但我懷疑它。最好的方法是使用lxml或BeautifulSoup來削減後端的「違規」HTML類。