Advanced Source Code Editor plugin for Tinymce WYSIWYG Editor built alongside ACE
To use this plugin copy the folder "codeeditor" and paste it into tinymce "plugins" folder in its source directory. Here's the path for tinymce_5.2.0 self-hosted production release -> tinymce_5.2.0/tinymce/js/tinymce/plugins
Download any of tinymce self-hosted releases here.
In order to have it in your editor, after including codeeditor folder in your tinymce plugins directory, you must tell tinymce to inlcude the plugin as well as its toolbar button as demonstrated bellow...
tinymce.init({
selector: "#target-element", // change this value according to your HTML target element selector
toolbar: ["codeeditor"],
plugins: ["codeeditor"],
});
The following configuration options are provided:
Check out ACE available themes here. Preview here.
codeeditor_wrap_mode -> Boolean. Default is true. If set to false, long lines won't be wrapped automatically to fit modal view size and therefore horizontal scrolling will be available.
codeeditor_font_size -> Number representing height in pixels. Default is 12.
tinymce.init({
selector: "#target-element", // change this value according to your HTML target element selector
toolbar: ["codeeditor"],
plugins: ["codeeditor"],
codeeditor_themes_pack: "twilight merbivore dawn kuroir", // or ["twilight", "merbivore", "dawn", "kuroir"]
codeeditor_wrap_mode: true,
codeeditor_font_size: 12
});
This project is licensed under the MIT License - see the LICENSE file for more details.