0
votes

I have this plugin that I want to be enabled in WYSIWYG and Source modes. Here is the simple code:

(function()
{
    CKEDITOR.plugins.add('oovideo',
    {
        init : function(editor)
        {
            editor.addCommand('oovideo', new CKEDITOR.dialogCommand('oovideo'));
            editor.ui.addButton('OOVideo',
            {
                label: 'OOVideo',
                command: 'oovideo',
                icon: 'http://www.google.com/favicon.ico',
                modes : { source : 1, wysiwyg : 1, enhancedsource : 1 }
            });

            CKEDITOR.dialog.addIframe(
                'oovideo',
                'OOVideo',
                'http://www.example.com/', 450, 500,
                null, null 
            );
        }
    });
})();

Currently the button will only pull up the iFrame dialog when in WYSIWYG mode.

Because I added modes : { source : 1, wysiwyg : 1, enhancedsource : 1 } in the button control, the button is not grayed out in all modes, but the button will only function in WYSIWYG mode.

I found some hints in this post:

CKEditor plugin button disabled in source mode

It seems that I have to include the modes variable in the editor.addCommand() call, but I am passing a CKEDITOR.dialogCommand object in that parameter space and not JS code.

What is the best way to pass the dialog object and the mode parameter? Thanks for any assistance!

1

1 Answers

0
votes

I found the solution - the editor.addCommmand can be assigned to a variable, and then have the modes property added on a new line.

var command = editor.addCommand('tgroovideo', new CKEDITOR.dialogCommand('tgroovideo'));
command.modes = { wysiwyg:1, enhancedsource:1 };