Page 1 of 1

TinyMCE Editor

Posted: Sat Oct 28, 2023 2:51 pm
by tessthepup
Good afternoon everyone,

I am experiencing a slight issue with the TinyMCE hook.

The editor appears on all inputs defined except the products_description field :?

Please will another user who uses this hook compare what I have below with theirs to see if I am missing something.

Code: Select all

class hook_admin_siteWide_tinymce {
  var $version = '1.0.6';

  var $sitestart = null;
  var $siteend = null;
  var $good_pages = ['catalog.php', 'manufacturers.php', 'info_pages.php', 'faq_manager.php', 'advert_manager.php']; // what pages do you want to load the tinymce editor on

  function listen_injectSiteEnd() {
    $this->siteend .= '<!-- tiny mce -->' . PHP_EOL;
    $this->siteend .= '<script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.5.1/tinymce.min.js" integrity="sha512-rCSG4Ab3y6N79xYzoaCqt9gMHR0T9US5O5iBuB25LtIQ1Hsv3jKjREwEMeud8q7KRgPtxhmJesa1c9pl6upZvg==" crossorigin="anonymous"></script>' . PHP_EOL;
 $tinyScript = <<<eod
<script>
tinymce.init({
  selector: 'textarea[name^="products_description"], textarea[name^="categories_description"],  textarea[name^="manufacturers_description"],  textarea[name^="question"],  textarea[name^="answer"],  textarea[name^="advert_html_text"]',
  height: 500,
    forced_root_block : false,
  theme: 'silver',
  plugins: [
    'advlist autolink lists link image charmap print preview hr anchor pagebreak',
    'searchreplace wordcount visualblocks visualchars code fullscreen',
    'insertdatetime media nonbreaking save table directionality',
    'emoticons template paste textpattern imagetools codesample toc'
  ],
  toolbar1: 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
  toolbar2: 'print preview media | forecolor backcolor  | codesample fontselect fontsizeselect',
  image_advtab: true,
relative_urls : true,
remove_script_host : true,
  content_css: [
    'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css',
    'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css'
  ],
  setup: function (editor) { editor.on('change', function (e) {editor.save(); }); }
});
</script>
eod;

if (in_array(basename($_SERVER['PHP_SELF']), $this->good_pages)) {
 $this->siteend .= $tinyScript . PHP_EOL;
    return $this->siteend;
  }
 }
}
Thanks

Mark

Re: TinyMCE Editor

Posted: Sat Oct 28, 2023 5:09 pm
by Omar_one
tessthepup wrote: Sat Oct 28, 2023 2:51 pm Good afternoon everyone,

I am experiencing a slight issue with the TinyMCE hook.

The editor appears on all inputs defined except the products_description field :?

Please will another user who uses this hook compare what I have below with theirs to see if I am missing something.


Mark
which version you have? .. if it's less then 1.0.6 then add categories.php in
var $good_pages like this

Code: Select all

 var $good_pages = ['categories.php', 'catalog.php', 'manufacturers.php', 'info_pages.php', 'faq_manager.php', 'advert_manager.php'];

Re: TinyMCE Editor

Posted: Sat Oct 28, 2023 5:20 pm
by tessthepup
Omar_one wrote: Sat Oct 28, 2023 5:09 pm
tessthepup wrote: Sat Oct 28, 2023 2:51 pm Good afternoon everyone,

I am experiencing a slight issue with the TinyMCE hook.

The editor appears on all inputs defined except the products_description field :?

Please will another user who uses this hook compare what I have below with theirs to see if I am missing something.


Mark
which version you have? .. if it's less then 1.0.6 then add categories.php in
var $good_pages like this

Code: Select all

 var $good_pages = ['categories.php', 'catalog.php', 'manufacturers.php', 'info_pages.php', 'faq_manager.php', 'advert_manager.php'];
@Omar_one
It is version 1.0.6 and I have tried with and without categories.php

Re: TinyMCE Editor

Posted: Sat Oct 28, 2023 6:24 pm
by tessthepup
ok I found the issue. There must be a conflict between the masterSlave hook for the bundled products addon.

Once I removed the masterSlave.php hook file TinyMCE works perfectly.