diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js index 84c1c67fe..78e461ae4 100644 --- a/html/js/noalyss_script.js +++ b/html/js/noalyss_script.js @@ -130,7 +130,7 @@ function id$(ID) { } else if (document.all) { return document.all[ID]; } else { - document.debug_noalyss&&console.error(`id$ ${ID}`) + document.debug_noalyss&&console.error(`id$ ${ID} not found`) return undefined; } } @@ -4713,4 +4713,66 @@ Widget.prototype.toggle_full_size=function (widget_domid) { (function(){window.addEventListener("onload", (event) => {remove_waiting_box()});})(); */ -var bookmark=new Bookmark(); +//var bookmark=new Bookmark(); + +Noalyss = function () { + +} +/** + * Activate TinyMCE + * @param {string} domid id of the dom element + * @param {string} mode min for minimum or full , gives an error if the mode doesn't exist + * @returns {undefined} + */ +Noalyss.prototype.activate_tinymce=function (domid,mode) { + tinymce.remove('#'+domid); + if ( mode == 'min' || ! mode ) + { + tinymce.init({ + selector: 'textarea#'+domid, + height: 500, + menubar: false, + toolbar: 'undo redo | ' + + 'bold italic underline forecolor backcolor |fontsize styles ' + + ' | bullist numlist | ' + + 'removeformat | help', + content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }', + promotion: false, + license_key:'gpl', + statusbar: false, + branding: false + }); + } else if ( mode == "full") + { + /** + toolbar: 'undo redo ' + + 'bold italic underline strikethrough | hr quickimage | forecolor backcolor|emoticons |fontsize styles ' + + ' table tabledelete |' + + ' | link unlink bullist numlist | ' + + 'removeformat | help', + content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }', + */ + tinymce.init({ + selector: 'textarea#'+domid, + height: 500, + menubar: false, + plugins:'link lists emoticons quickbars pagebreak table', + toolbar: 'undo redo ' + + 'bold italic underline strikethrough | hr quickimage | forecolor backcolor|emoticons |fontsize styles ' + + ' table tabledelete |' + + ' | link unlink bullist numlist | ' + + 'removeformat | help', + content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }', + promotion: false, + license_key:'gpl', + statusbar: false, + branding: false + }); + + }else { + console.error(`Noalyss.activate_tinymce unknow mode`); + } + +} + +noalyss=new Noalyss(); diff --git a/include/lib/function_javascript.php b/include/lib/function_javascript.php index 278d114fd..01ce75770 100644 --- a/include/lib/function_javascript.php +++ b/include/lib/function_javascript.php @@ -2784,6 +2784,8 @@ EOF; echo js_include('acc_currency.js'); echo js_include('taggroup.js'); echo js_include('noalyss_checkbox.js'); + echo js_include('tinymce/tinymce.min.js'); + if (DEBUGNOALYSS > 1) { echo js_include('noalyss_debug.js'); } diff --git a/include/lib/itextarea.class.php b/include/lib/itextarea.class.php index f604c5aef..4912e27b5 100644 --- a/include/lib/itextarea.class.php +++ b/include/lib/itextarea.class.php @@ -49,11 +49,11 @@ class ITextarea extends HtmlInput /** * @brief set enrichText to plain or enrich , enrich for WYSIWYG function, plain, plain textarea and choose * to display a button to switch to a WYSIWYG - * @param mixed $enrich + * @param mixed $enrich plain , enrich (full option) , min (minimum options) */ public function set_enrichText($enrich) { - if ( ! in_array($enrich,['plain','enrich'])) { + if ( ! in_array($enrich,['plain','enrich',"min"])) { throw new \Exception("IT57.Invalid option"); } $this->enrichText = $enrich; @@ -83,12 +83,18 @@ class ITextarea extends HtmlInput +EOF; + }elseif ($this->enrichText=='min') { + if ( empty($this->id)) $this->id=$this->name; + + $r=<<style}>{$this->value} + EOF;