tinyMCE - source code editing in a textarea

前端 未结 3 2152
無奈伤痛
無奈伤痛 2021-02-19 16:22

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.

相关标签:
3条回答
  • 2021-02-19 16:46

    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>
    
    0 讨论(0)
  • 2021-02-19 16:48

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

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

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

    0 讨论(0)
  • 2021-02-19 16:59

    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.

    0 讨论(0)
提交回复
热议问题