trippo / ResponsiveFilemanager

Completely Responsive Filemanager with integration for tinyMCE,CKEditor and CLEditor editor
http://responsivefilemanager.com
Other
815 stars 366 forks source link

plugin initialization failure tinymce 6 #730

Open gtraxx opened 10 months ago

gtraxx commented 10 months ago

Hi, from time to time I get the message: "plugin initialization failure: filemanager" in tinymce 6 Is this a script to correct in the plugin or is it in tinymce 6 ?

Capture d’écran 2023-11-21 à 10 40 15

Best Regards Aurélien

nikzad-avasam commented 10 months ago

Because ResponsiveFileManager plugin does not support tinymce version 6 yet: tinymce-support

jshster commented 10 months ago

Fairly easy to correct.

  1. Remove the following line from your tinymce initialisation: external_filemanager_path: "/cms/scripts/filemanager/",

  2. Add the following to your tinymce initialisation: setup: function (editor) { editor.options.register('external_filemanager_path', { processor: 'string', default: '/cms/scripts/filemanager/' }); }, Those two will fix the tinymce initialisation but there is a little more that you have to do. For this next part you will need to "beautify" the plugins.min.js file so that you can edit it easily.

  3. Find the following lines: editor.settings.file_picker_types = 'file image media'; editor.settings.file_picker_callback = filemanager;

  4. Replace it with: editor.options.register('file_picker_types', { processor: 'string', default: 'file image media' });

    editor.options.register('file_picker_callback', { processor: 'function', default: filemanager });

  5. A little further down in the file look for the following line: if (editor.settings.external_filemanager_path.toLowerCase().indexOf(event.origin.toLowerCase()) === 0) {

  6. Replace it with: if (editor.options.get('external_filemanager_path').toLowerCase().indexOf(event.origin.toLowerCase()) === 0) {

That should do the trick.

gtraxx commented 10 months ago

@jshster Hi, This line does not work for me because it cannot find the right path, previously this was what worked. it's ok :

external_filemanager_path: '/'+baseadmin+'/template/js/vendor/filemanager/',

but not this one

setup: function (editor) {
            editor.options.register('external_filemanager_path', {
                processor: 'string',
                default: '/'+baseadmin+'/template/js/vendor/filemanager/'
            });
        }
gtraxx commented 10 months ago

@nikzad-avasam We have updated various files for compatibility so it is compatible with tinymce 6, but there are still some minor bugs.

jshster commented 9 months ago

@jshster Hi, This line does not work for me because it cannot find the right path, previously this was what worked. it's ok :

external_filemanager_path: '/'+baseadmin+'/template/js/vendor/filemanager/',

but not this one

setup: function (editor) {
            editor.options.register('external_filemanager_path', {
                processor: 'string',
                default: '/'+baseadmin+'/template/js/vendor/filemanager/'
            });
        }

Hey gtraxx, sorry for delay in replying. What error are you receiving in the console? At a glance it will be scope issue. How have you defined the variable baseadmin? Var, let or something else? I'm going to bet the error is undefined or not defined, something like that?

tarzinio commented 9 months ago

I upgraded to version 6.x a long time ago so I don't remember everything, but you definitely need to add option registration via "editor.options.register"