ResponsiveFilemanager icon indicating copy to clipboard operation
ResponsiveFilemanager copied to clipboard

plugin initialization failure tinymce 6

Open gtraxx opened this issue 1 year ago • 6 comments

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

gtraxx avatar Nov 21 '23 09:11 gtraxx

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

nikzad-avasam avatar Nov 26 '23 21:11 nikzad-avasam

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.

jshster avatar Nov 27 '23 01:11 jshster

@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 avatar Nov 27 '23 09:11 gtraxx

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

gtraxx avatar Nov 27 '23 10:11 gtraxx

@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?

jshster avatar Dec 17 '23 02:12 jshster

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"

tarzinio avatar Jan 04 '24 10:01 tarzinio