Added TinyMCE editor options
authorThierry Florac <thierry.florac@onf.fr>
Wed, 07 Mar 2018 17:28:21 +0100
changeset 278 46d613cb4ef0
parent 277 1193d52e9bbb
child 279 6d93d4c9156a
Added TinyMCE editor options
src/pyams_skin/resources/js/myams.js
--- a/src/pyams_skin/resources/js/myams.js	Thu Feb 22 11:07:54 2018 +0100
+++ b/src/pyams_skin/resources/js/myams.js	Wed Mar 07 17:28:21 2018 +0100
@@ -4319,14 +4319,17 @@
 												var dataOptions = {
 													theme: data.amsTinymceTheme || "modern",
 													language: ams.lang,
-													plugins: [
+													menubar: data.amsTinymceMenubar !== false,
+													statusbar: data.amsTinymceStatusbar !== false,
+													plugins: data.amsTinymcePlugins || [
 														"advlist autosave autolink lists link image charmap print preview hr anchor pagebreak",
 														"searchreplace wordcount visualblocks visualchars code fullscreen",
 														"insertdatetime media nonbreaking save table contextmenu directionality",
 														"emoticons paste textcolor colorpicker textpattern autoresize"
 													],
-													toolbar1: data.amsTinymceToolbar1 || "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent",
-													toolbar2: data.amsTinymceToolbar2 || "forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code",
+													toolbar: data.amsTinymceToolbar,
+													toolbar1: data.amsTinymceToolbar1 === false ? false : "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent",
+													toolbar2: data.amsTinymceToolbar2 === false ? false : "forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code",
 													content_css: data.amsTinymceContentCss,
 													formats: data.amsTinymceFormats,
 													style_formats: data.amsTinymceStyleFormats,
@@ -4346,6 +4349,9 @@
 												if (data.amsTinymceExternalPlugins) {
 													var names = data.amsTinymceExternalPlugins.split(/\s+/);
 													for (var index in names) {
+														if (!names.hasOwnProperty(index)) {
+															continue;
+														}
 														var pluginSrc = editor.data('ams-tinymce-plugin-' + names[index]);
 														tinymce.PluginManager.load(names[index], ams.getSource(pluginSrc));
 													}