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;
}
}
}Mark