2014-10-29 19 views
0

有沒有辦法將格式化文本粘貼到ckeditor沒有樣式和保留語義?如何插入文本到沒有樣式但保留語義的CKEditor

例如這是它粘貼:

<h1 style="font-family: sans-serif; color: rgb(34, 34, 34); line-height: 18.2000007629395px;">An h1 header</h1> 

<p style="color: rgb(34, 34, 34); font-family: sans-serif; font-size: small; line-height: 18.2000007629395px;">Paragraphs are separated by a blank line.</p> 

<p style="color: rgb(34, 34, 34); font-family: sans-serif; font-size: small; line-height: 18.2000007629395px;">2nd paragraph.&nbsp;<em>Italic</em>,&nbsp;<strong>bold</strong>, and&nbsp;<code style="white-space: pre; background-color: rgb(238, 238, 238);">monospace</code>. Itemized lists look like:</p> 

<ul style="color: rgb(34, 34, 34); font-family: sans-serif; font-size: small; line-height: 18.2000007629395px;"> 
    <li>this one</li> 
    <li>that one</li> 
    <li>the other one</li> 
</ul> 

但我想粘貼此:

<h1>An h1 header</h1> 

<p>Paragraphs are separated by a blank line.</p> 

<p>2nd paragraph.&nbsp;<em>Italic</em>,&nbsp;<strong>bold</strong>, and&nbsp;<code>monospace</code>. Itemized lists look like:</p> 

<ul> 
    <li>this one</li> 
    <li>that one</li> 
    <li>the other one</li> 
</ul> 

回答

0

如果你有Advanced Content Filter啓用(默認情況下應啓用),那麼它將根據編輯器配置允許的內容過濾粘貼的內容。詳情請參閱Content Filtering指南。但是,如果您由於某些原因而禁用了ACF,或者您希望以不同方式過濾粘貼的內容,則可以創建自己的CKEDITOR.filter實例並將其應用於pasted data。有關如何將過濾器應用於HTML字符串的更多信息,請參閱Apply CKEditor Advanced Content Filter to a string

相關問題