tinyMCE - source code editing in a textarea

淺唱寂寞╮ 提交于 2019-12-22 03:36:03

问题


I'm playing around with MCE, I was wondering if there was the possibility of letting the user enter source code into a post, much like the 101010 button in this form.


回答1:


You'll need to add plugins: "code" to the initialization code as follows:

tinymce.init({
    plugins: "code"
});

https://www.tinymce.com/docs/plugins/code/




回答2:


The option exists. One of the optional buttons has 'html' written on it and can be used to go into HTML editing mode. You can see it in this full featured example - 6 places left of the top-right corner.




回答3:


Try 'code' plugin along with tinymce.min.js

e.g.

<script src="~/Scripts/tinymce/tinymce.min.js"></script>
<script src="~/Scripts/tinymce/plugins/code/plugin.min.js"></script>
<script>
    tinymce.init({
        selector: 'textarea',
        plugins: "code",
        toolbar: "code" });
</script>


来源:https://stackoverflow.com/questions/408998/tinymce-source-code-editing-in-a-textarea

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!