0

I need a simple solution to a simple dropdown.

`CKEDITOR.plugins.add('dropdown_example', {

    icons: 'dropdown_example','insertExample1','insertExample2',

    // The plugin initialization logic goes inside this method.
    init: function(editor) {
        // Define the commands for each option in the dropdown.
        editor.addCommand('insertExample1', {
            exec: function(editor) {
                editor.insertHtml( '<br>1' );
            }
        });
        editor.addCommand('insertExample2', {
            exec: function(editor) {
                editor.insertHtml( '<br>2' );
            }
        });
        // Add dropdown button to the toolbar
        editor.ui.addButton('dropdown_example', {
            label: 'Choose Example',
            command: 'dropdown_example',
            toolbar: 'insert',
            dropdown: true
        });

        // Create a dropdown containing the command options
        editor.ui.addDropdown('dropdown_example', {
            label: 'Choose Example',
            toolbar: 'insert',
            onRender: function() {
                // Add the option to insert 'insertExample1'
                this.add('insertExample1', {
                command: 'insertExample1',
                toolbar: 'insert'

                });
                // Add the option to insert 'insertExample2'
                this.add('insertExample2', {
                    label: 'Wiki - Tabel uitleg links, voorbeeld afbeelding rechts 2',
                    command: 'insertExample2',
                    toolbar: 'insert'
                });
            }
        });
    }
});`

I want to add some custom templates, to a dropdown, that I can give an icon. With only one button, I can get it to work. When I transform it into a dropdown, where there are 2 options, the Toolbar, goes ||||| and nothing shows up anymore.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.