当您从word文档复制并粘贴到tinyMCE编辑器中时,有时会出现不需要的情况。<p>
标签。
<p> </p>
<div class="starpasspro-example-question">
<p><strong>Example: Levels of strategy</strong></p>
<p>Microsoft is one of the world’s largest organisations, providing corporate solutions to businesses throughout the world to help them realise their fullest potential. At Microsoft, there are three levels of strategy as follows:</p>
</div>
<p> </p>
这里生成的代码我想去掉了 <p>
标签有什么方法可以做到这一点?
在您的网站上添加这些行 tinymce.init({ });
例。
tinymce.init({
forced_root_block : "",
force_br_newlines : true,
force_p_newlines : false,
});
这将是有益的。
添加到你的 tinymce.yml 档案
forced_root_block : ""
force_br_newlines : true
force_p_newlines : false
是的,这是可能的。有一个安全的方法来删除所有您想删除的html元素(您可以定义什么是保留的)。它是通过使用tinymce配置参数。paste_preprocess
和一个自定义函数 strip_tags
. 看看吧 此处.
将此添加到你的 functions.php 文件中,通过向 tiny_mce_before_init 钩子添加一些参数,标准的 p-tagstags 将被移除。如果你想看看它是如何工作的,你可以在这个页面上进一步阅读。https:/codex.wordpress.orgTinyMCE
////////////////////////////////////////////////////////////////////////
//////////REMOVE STANDARD <P> FROM TINYMCE EDITOR/////////////////////////
///////////////////////////////////////////////////////////////////////
function my_format_TinyMCE( $in ) {
$in['forced_root_block'] = "";
$in['force_br_newlines'] = TRUE;
$in['force_p_newlines'] = FALSE;
return $in;
}
add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' );
USE HtmlEncode="false" in BoundField
<asp:BoundField DataField="PostContent" HtmlEncode="false" />