codeigniter 如何在Tinymce中删除p标签

ef1yzkbh  于 2022-12-06  发布在  其他
关注(0)|答案(3)|浏览(153)

虽然我在我的tinymce.init中使用了“forced_root_block”,但p标记没有被删除。
下面是我的init函数

<script type="text/javascript" src="https://tinymce.cachefly.net/4.1/tinymce.min.js"></script>

<script type="text/javascript">
tinymce.init({
     selector: "textarea#fulldis",
     mode : "textareas",
     editor_selector : "fulldis",
     setup: function (editor) { editor.on('change', function () {editor.save(); }); },
     forced_root_block : "", 
     force_br_newlines : true,
     force_p_newlines : false,
     toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify "
});
</script>

看起来是这样的:

任何关于如何删除“p”的想法,如上面圈出的。

9rnv2umw

9rnv2umw1#

将此行添加到init语句中。

forced_root_block : ""

完整的行可以是

<script>
     tinymce.init({
                   forced_root_block : "",
                   selector:'textarea'});
</script>
0h4hbjxa

0h4hbjxa2#

Use it. TinyMce automatically add "
" tag. You can set this option in tinyMce initialization like this on script ...

tinyMCE.init({
  mode : "textareas",
  theme : "advanced",
  force_br_newlines : false,
  force_p_newlines : false,
  forced_root_block : '',
});

Or You can use it....

This should work fine on Chrome also. Which version of TinyMCE are you using?
BTW a dirty hack to solve this is to open tiny_mce_src.js file and look for this

forced_root_block : 'p',

and set it to

forced_root_block : false or just remove the p.

Thank You

z3yyvxxp

z3yyvxxp3#

如果只想隐藏标签显示在tinymce状态栏上,那么需要使用这个选项,至少对于v5.x它是有效的:元素路径

相关问题