Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin initialization failure tinymce 6 #730

Open
gtraxx opened this issue Nov 21, 2023 · 6 comments
Open

plugin initialization failure tinymce 6 #730

gtraxx opened this issue Nov 21, 2023 · 6 comments

Comments

@gtraxx
Copy link

gtraxx commented Nov 21, 2023

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
Copy link

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

@jshster
Copy link

jshster commented Nov 27, 2023

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
Copy link
Author

gtraxx commented Nov 27, 2023

@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
Copy link
Author

gtraxx commented Nov 27, 2023

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

@jshster
Copy link

jshster commented Dec 17, 2023

@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
Copy link

tarzinio commented Jan 4, 2024

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants