Jump to content

Prestashop 1.6.1.13 Uncaught ReferenceError: tinyMCE is not defined


Recommended Posts

hi guys, 

i have some problems with tinyMce or Javascript in the backend. Some pages that contain text editors are not loading properly, and i can't edit text or use any of the buttons, regardless of the fact that they are not tinyMCE related. I think it crashes JS

Product edit page works correctly.

The megamenu edit page is not loading correctly, and another module that uses tinyMCE. Please check the attached files

 

I checked Chrome and i get the following error:

Uncaught ReferenceError: tinySetup is not defined
    at HTMLDocument.<anonymous> (index.php?controller=AdminModules&configure=iqitmegamenu&tab_module=front_office_features&module_name=iqitmegamenu&token=c9ce6996a657237c5a69e6dc5fcb45ee:7183)
- this changes in relation to the page i am trying to load
    at j (jquery-1.11.0.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-1.11.0.min.js:2)
    at Function.ready (jquery-1.11.0.min.js:2)
    at HTMLDocument.K (jquery-1.11.0.min.js:2)

 

I have the following files and code:

js/tinymce.inc.js 

 

function tinySetup(config)
{
    if(!config)
        config = {};

    //var editor_selector = 'rte';
    //if (typeof config['editor_selector'] !== 'undefined')
        //var editor_selector = config['editor_selector'];
    if (typeof config['editor_selector'] != 'undefined')
        config['selector'] = '.'+config['editor_selector'];
 
//    safari,pagebreak,style,table,advimage,advlink,inlinepopups,media,contextmenu,paste,fullscreen,xhtmlxtras,preview
    default_config = {
        selector: ".rte" ,
        plugins : " fieldsetcontrols visualblocks, preview searchreplace print insertdatetime, hr charmap colorpicker anchor code   link image paste pagebreak table contextmenu filemanager table code media textcolor emoticons shortcode  advlist fullpage fullscreen",
        toolbar2 : "newdocument,print,|,bold,italic,underline,|,strikethrough,superscript,subscript,|,forecolor,colorpicker,backcolor,|,bullist,numlist,outdent,indent",
        toolbar1 : "styleselect,|,formatselect,|,fontselect,|,fontsizeselect,", 
        toolbar3 : "shortcode, code,|,table,|,cut,copy,paste,alignleft,aligncenter ,alignright,alignjustify,    ,searchreplace,|,blockquote,|,undo,redo,|,link,unlink,anchor,|,image,emoticons,media,|,inserttime,|,preview,fullpage,fullscreen,  ",
        toolbar4 : "visualblocks,|,charmap,|,hr,|,removeformat,|,addfieldset ,delfieldset,pasteword,pastetex",
          
        external_filemanager_path: ad+"/filemanager/",
        filemanager_title: "File manager" ,
        external_plugins: { "filemanager" : ad+"/filemanager/plugin.min.js"},
        extended_valid_elements: 'pre[*],script[*],style[*]', 
        valid_children: "+body[style|script],pre[script|div|p|br|span|img|style|h1|h2|h3|h4|h5],*[*]",
        valid_elements : '*[*]', 
        force_p_newlines : false, 
        cleanup: false, 
        forced_root_block : false, 
        force_br_newlines : true, 
        width: 1000,
        height: 500,
relative_urls : false,
remove_script_host : false,
convert_urls : true,

        menu: {
            edit: {title: 'Edit', items: 'undo redo | cut copy paste | selectall'},
            insert: {title: 'Insert', items: 'media image link | pagebreak'},
            view: {title: 'View', items: 'visualaid'},
            format: {title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat'},
            table: {title: 'Table', items: 'inserttable tableprops deletetable | cell row column'},
            tools: {title: 'Tools', items: 'code'}
        } 
    } 
    $.each(default_config, function(index, el)
    {        if (config[index] === undefined )
            config[index] = el;
    }); 
    tinyMCE.init(config); 
};

$().ready(function() {
   tinySetup(); 
});

 

classes/Validate.php with the code: public static function isCleanHtml($html, $allow_iframe = false) { return true; }

 

I have tried all solutions that i could find over web and in the forum with no luck.

- replaced admin, js, classes and override files with original ones

- replaced all tinymce files with original ones

- i've downloaded the latest 1.6 version of prestas and tried to use those files. 

- i've disabled all CCC options, disabled cache, disabled most of the modules, including statistics and blog related modules.

- cleared cache multiple times, cleared browser history and cookies, renamed admin folder to a different name.

NOTHING Worked

Right now i am not able to edit my menu and some other info. And it also crashes the main backend menu. 

Tested in Chrome and Edge.

 

 

cap1.PNG

cap2.PNG

Link to comment
Share on other sites

  • 3 months later...

hi kornfr333k.

You can use this "duty" hack: edit /js/admin/tinymce.inc.js and paste before "if (!config)" line with checking tinyMCE. This is first lines from my file:

function tinySetup(config)
{
      if (typeof tinyMCE === 'undefined') {
        setTimeout(function() {
        tinySetup(config);
        }, 100);
        return;
        }
	if(!config)
		config = {};

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...