Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/400.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何切换bullist/numlist TinyMCE_Javascript_Tinymce - Fatal编程技术网

Javascript 如何切换bullist/numlist TinyMCE

Javascript 如何切换bullist/numlist TinyMCE,javascript,tinymce,Javascript,Tinymce,因此,我创建了一个自定义右键单击菜单,并添加了“bullist”(InsertunderedList)。 它可以很好地插入这些列表。但是如果我再按一下它,它不会消失吗?我想要与“上下文菜单”中相同的行为 例如。 如果没有布利斯特-->添加布利斯特。 但如果有看涨者-->移除看涨者 我怎样才能做到这一点 我查阅了文档,发现了这段代码 tinymce.activeEditor.execCommand('RemoveList'); 但我如何将其插入切换 我的TinyMCE.init()代码: tin

因此,我创建了一个自定义右键单击菜单,并添加了“bullist”(InsertunderedList)。 它可以很好地插入这些列表。但是如果我再按一下它,它不会消失吗?我想要与“上下文菜单”中相同的行为

例如。 如果没有布利斯特-->添加布利斯特。 但如果有看涨者-->移除看涨者

我怎样才能做到这一点

我查阅了文档,发现了这段代码

tinymce.activeEditor.execCommand('RemoveList');
但我如何将其插入切换

我的TinyMCE.init()代码:

tinyMCE.init({
        // General options
        toolbar: 'anchor | ImageUpload image FileUpload | undo redo | styleselect | ' +
            ' bold italic | link | bullist numlist | alignleft aligncenter alignright alignjustify',
        plugins: "table autoresize paste link lists anchor image contextmenu code colorpicker",
        menu: {
            edit: { title: 'Edit', items: 'undo redo | cut copy paste | selectall' },
            insert: { title: 'Insert', items: 'link ImageUpload image FileUpload bullist numlist' },
            format: { title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat' },
            table: { title: 'Table', items: 'inserttable deletetable | cell row column' }
        },
        contextmenu: "cut copy paste undo | anchor link ImageUpload image FileUpload | bullist numlist | formats bold italic removeformat | inserttable tableprops cell row deletetable | underline strikethrough superscript subscript",
        image_dimensions: false,
        image_dimensions: false,
        a11y_advanced_options: true,
        preview_styles: false,
        paste_retain_style_properties: "none",
        object_resizing : ":not(table)",
        table_appearance_options: false,
        table_advtab: false,
        table_cell_advtab: false,
        table_row_advtab: false,
        table_toolbar: "tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol"
       
        setup: function(editor) {
            editor.on('change', function (e) {
                editor.save();
            });

            //This is where I add my custom bullist
            editor.ui.registry.addMenuItem('bullist', {
                icon: 'unordered-list',
                text: 'Punktlista',
                onAction: function () {
                    tinymce.activeEditor.execCommand('InsertUnorderedList', false, {
                        'list-style-type': 'disc'
                    });
                }
            });



        }
    });