tinyMCE 5 右键单击​​更改上下文菜单

tinyMCE 5 change context menu on right click

我一直在为所选文本添加内容工具栏。

但是当您在任意位置右击时,您会看到一个包含一项的上下文菜单 "Link"。例如,如何在此列表中添加 charmap 插件? 我想不通。

到目前为止,这是我的代码:

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'
        });
    }
});

这是一个 link,其中还包括一个代码笔。右键单击编辑器,您将看到带有 "Link" 的上下文菜单,我想在其中添加 charmap 插件。

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

使用与 toolbar 相同的格式:

contextmenu: 'charmap undo | redo'