TinyMCE4 has no code editor plugin at default. This plugin is a code editor plugin called “tinymce4 code editor”, you can use it in your tinymce editor to toggle code quickly and edit code.
tinymce.init({ selector: "textarea", plugins: [ "leaui_code_editor", "advlist autolink link lists charmap hr anchor pagebreak", "directionality textcolor paste fullpage textcolor" ], toolbar1: "leaui_code_editor | styleselect formatselect fontselect fontsizeselect | bold italic underline strikethrough " });
Note: The default css in tinyce has no ”<pre>” style, you need to add another css file which contains the “pre” style to tinymce(use content_css option), eg:
tinymce.init({ selector: "textarea", content_css: ['tinymce/js/tinymce/plugins/leaui_code_editor/css/pre.css'], plugins: [ "leaui_code_editor", "advlist autolink link lists charmap hr anchor pagebreak", "directionality textcolor paste fullpage textcolor" ], toolbar1: "leaui_code_editor | styleselect formatselect fontselect fontsizeselect | bold italic underline strikethrough " });
We use cookies on our website. By continuing to use our site, you consent to the use of cookies as described in our Cookies Policy.