当您从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>
标签吗?
4 回答
在
tinymce.init({ });
中添加这些行Example:
它会有所帮助 .
添加到 tinymce.yml 文件中
是的,这是可能的 . 有一种安全的方法可以删除您要删除的所有html元素(您可以定义要保留的内容) . 它是通过使用tinymce配置参数
paste_preprocess
和自定义函数strip_tags
. 看看here .将此添加到functions.php文件中,将通过向tiny_mce_before_init挂钩添加一些参数来删除标准p-tags标记 . 如果您想了解它的工作原理,可以在此页面进一步阅读:https://codex.wordpress.org/TinyMCE