Search code examples
tinymcephpfox

How to put Code Sample Plugin of TinyMCE in phpfox?


I have an tiny mce editor like image bellow:

enter image description here

and I want to put Code Sample Plugin of tinymce editor in phpfox like:

enter image description here

Please tell me what should I do.


Solution

    1. In case you don't have codesample installed, you can download entire bundle from tinymce.com and include plugin.min.js from directory js/tinymce/plugins/codesample/

    2. Download prism.js and prism.css from prismjs.com and include in your HTML page

    3. Modify your tinymce_setup.js and add codesample to your tinymce_setup.js My tinymce_setup.js looks like

    tinymce.init({
      selector: 'textarea',
      height: 500,
      plugins: [
        'advlist autolink lists link image charmap print preview anchor',
        'searchreplace visualblocks code fullscreen',
        'insertdatetime media table contextmenu paste code codesample'
      ],
      toolbar: ("insertfile undo redo | styleselect | bold italic | " +
                "alignleft aligncenter alignright alignjustify | " +
                "bullist numlist outdent indent | link image table | " +
                "code fullscreen codesample"),
    });