TinyMCE WYSIWYG editor

TinyMCE Stopped working - TinyMCE WYSIWYG editor

TinyMCE Stopped working

by Petbeemer » Wed Aug 18, 2021 3:22 pm

Mine seems to have stopped working in latest update of Phoenix?
Petbeemer
Member
Posts: 34
Joined: Mon May 24, 2021 10:09 am
Phoenix Version:
Contact:

Re: TinyMCE Stopped working

by Petbeemer » Wed Aug 18, 2021 3:33 pm

<?php
/*
Copyright (c) 2020, C Poole
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/*
HOW TO USE
you can either load the js file needed for TinyMCE locally or via the TinyMCE CDN (if you have a api key
if using TinyMCE CDN
use the url proivded to you by TinyMCE

if loading tinymce locally
<script src="path/to/where/you/saved/it"></script>
I recommend using the TinyMCE CDN, as it will keep it up to date.

HOW TO ADD TO OTHER TEXTAREAS
You will need to add the name of the textera to the selector line
e.g. if the textarea name is example_name[1] you need to put
, textarea[name^="example_name"]
it will then load it on all textareas with example_name so if you have a multi language store, it will load for all languages
if the textarea is not on the catalog or manufacors page then you will neeed to add the filename to the $good_pages variable

HOW TO ADD/RE,OVE PLUGINS AND WHAT APPEARS IN THE TOOLBARS
this is done by simply adding/removing stuff from the plugins or toolbar settings
it is just what i use personally

*/
class hook_admin_siteWide_tinymce {
var $version = '1.0.5';

var $sitestart = null;
var $siteend = null;
var $good_pages = ['catalog.php', 'manufacturers.php', 'info_pages.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/ ... mce.min.js" integrity="sha512-rCSG4Ab3y6N79xYzoaCqt9gMHR0T9US5O5iBuB25LtIQ1Hsv3jKjREwEMeud8q7KRgPtxhmJesa1c9pl6upZvg==" crossorigin="anonymous"></script>' . PHP_EOL;
$tinyScript = <<<eod
<script>
tinymce.init({
selector: 'textarea[name^="products_description"], textarea[name^="catalog_description"], textarea[name^="manufacturers_description"], textarea[name^="page_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/ ... ll.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/ ... ap.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;
}
}
}
Petbeemer
Member
Posts: 34
Joined: Mon May 24, 2021 10:09 am
Phoenix Version:
Contact:

Re: TinyMCE Stopped working

by Petbeemer » Wed Aug 18, 2021 3:34 pm

working again
Petbeemer
Member
Posts: 34
Joined: Mon May 24, 2021 10:09 am
Phoenix Version:
Contact:

Re: TinyMCE Stopped working

by puddlec » Fri Aug 20, 2021 3:15 pm

i upload a fix later today, going to do it slightly differently, by including support for older versions of phoenix
puddlec
Member
Posts: 31
Joined: Mon Dec 07, 2020 3:11 pm
Phoenix Version:
Contact:

Re: TinyMCE Stopped working

by Anonymous » Thu Sep 02, 2021 7:01 pm

I checked the Add ON and there does not seem to be a fix loaded yet?

Are you still planning to update it?
Anonymous
Senior Contributor
Posts: 473
Joined: Sun Oct 06, 2019 12:52 pm
Phoenix Version:
Contact:

Re: TinyMCE Stopped working

by puddlec » Mon Sep 06, 2021 3:51 pm

completely forgot about it, should do it tonight
puddlec
Member
Posts: 31
Joined: Mon Dec 07, 2020 3:11 pm
Phoenix Version:
Contact:

Re: TinyMCE Stopped working

by MyGamesShop » Sat Oct 30, 2021 4:38 am

If you use the tinymce addon you might need to change line 44

var $good_pages = ['categories.php', 'manufacturers.php', 'info_pages.php']; // what pages do you want to load the tinymce editor on

to

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


depending on the Phoenix version your using.
MyGamesShop
Contributor
Posts: 131
Joined: Wed Mar 10, 2021 3:02 am
Phoenix Version: v1.1.0.6
Contact:

Re: TinyMCE Stopped working

by MyGamesShop » Tue Jan 18, 2022 9:18 pm

MyGamesShop
Contributor
Posts: 131
Joined: Wed Mar 10, 2021 3:02 am
Phoenix Version: v1.1.0.6
Contact:

Re: TinyMCE Host locally

by MyGamesShop » Thu Jun 20, 2024 7:23 am

Host this in local files, do the above changes:

This seems like the best free version I have found that does not start to take away features, it may have bugs/security issues but now you host it locally, I don't think it will matter: (plus its open source you call see any future changes you might want to add)

https://download.tiny.cloud/tinymce/com ... _5.8.2.zip

Make directory and extract to : ext/ajax/libs/tinymce/5.8.2/

edit in tinymce.php

change line to: var $good_pages = ['catalog.php', 'manufacturers.php', 'info_pages.php']; // what pages do you want to load the tinymce editor

and on -->
change line to: $this->siteend .= '<script src="/ext/ajax/libs/tinymce/5.8.2/tinymce.min.js"></script>' . PHP_EOL;

Also change the lines to your bootstrap version & font-awesome version your Phoenix uses if you wish.
MyGamesShop
Contributor
Posts: 131
Joined: Wed Mar 10, 2021 3:02 am
Phoenix Version: v1.1.0.6
Contact: