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

[cmd:edit] trigger event "editEditorPrepare" in editors of editor.default.js #2381

Closed
nao-pon opened this issue Feb 10, 2018 · 1 comment
Closed
Assignees
Labels

Comments

@nao-pon
Copy link
Member

nao-pon commented Feb 10, 2018

Trigger event "editEditorPrepare" to make preparatory action possible before editor instance creation.

@nao-pon nao-pon self-assigned this Feb 10, 2018
@nao-pon
Copy link
Member Author

nao-pon commented Feb 10, 2018

Example of customization of editors configuration.

In bootCallback function or var fm = $('#elfinder').elfinder('instance');

fm.bind('editEditorPrepare', function(e) {
    var data = e.data || {},
        node = data.node,
        id = data.id,
        editorObj = data.editorObj,
        instance = data.instance,
        opts = data.opts,
        customOpts;
    if (id) {
        if (id === 'aceeditor') {
            instance.setOptions({
                // custom config options of ACE Editor
                
            });
        } else if (id === 'codemirror') {
            customOpts = {
                // custom config options of CodeMirror
                
            };
            Object.assign(opts, customOpts);
        } else if (id === 'ckeditor') {
            customOpts = {
                // custom config options of CKEditor
                
            };
            Object.assign(opts, customOpts);
        } else if (id === 'ckeditor5') {
            customOpts = {
                // custom config options of CKEditor5
                
            };
            Object.assign(opts, customOpts);
        } else if (id === 'tinymce') {
            customOpts = {
                // custom config options of TinyMCE
                
            };
            Object.assign(opts, customOpts);
        }
        // show `data` into browser console for debugging
        fm.log(data);
    }
});

nao-pon added a commit that referenced this issue Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant