0
votes

I have been adding a content toolbar on selected text.

But when you just right click anywhere you'll see a context menu with one item "Link". How can I add, for example, charmap plugin in this list? I can't figure this out.

This is my code so far:

tinymce.init({
    branding : false,
    content_css : '/css/tinymce_content.css',
    language : 'nl',
    menubar : false,
    plugins : ['charmap fullscreen hr link lists paste tabfocus'],
    relative_urls : false,
    remove_script_host : false,
    selector : '#' + alineaId,
    style_formats: [
        {title: 'Heading 2', format: 'h2'},
        {title: 'Heading 3', format: 'h3'},
        {title: 'Heading 4', format: 'h4'},
        {title: 'Heading 5', format: 'h5'},
        {title: 'Heading 6', format: 'h6'},
        {title: 'Normal', block: 'p'}
    ],
    toolbar : 'fullscreen | undo redo',
    fullscreen_new_window : true,
    fullscreen_settings : {
        theme_advanced_path_location : 'top'
    },
    setup: function (editor) {
        editor.ui.registry.addContextToolbar('textselection', {
            predicate: function (node) {
                return !editor.selection.isCollapsed();
            },
            items: 'bold italic | styleselect | link | bullist numlist',
            position: 'selection',
            scope: 'node'
        });
    }
});

And here is a link which also includes a codepen. Right click in the editor and you will see the context menu with "Link" on which I want to add the charmap plugin.

https://www.tiny.cloud/docs/ui-components/contextmenu/#

1

1 Answers

1
votes

Using same format as for toolbar:

contextmenu: 'charmap undo | redo'