You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CKEditor5中addListToDropdown下拉菜单标签不显示问题求助

CKEditor5 42.0.0 自定义下拉菜单标签不显示问题

我使用CKEditor5 42.0.0版本(通过CDN引入),编写了自定义下拉菜单组件的代码,但调用addListToDropdown方法后,下拉菜单的标签无法正常显示。

相关代码如下:

editor.ui.componentFactory.add("InsertDropDown", locale => {

    //const dropdown = createDropdown(locale);
    const items = new Collection();
    items.add({
        type: 'button',
        model: new Model({
            withText: true,
            label: 'First item',
            labelStyle: 'color: red'
        })
    });

    items.add({
        type: 'button',
        model: new Model({
            withText: true,
            label: 'Second item',
            labelStyle: 'color: green',
            class: 'foo'
        })
    });

    items.add({
        type: 'button',
        model: new Model({
            withText: true,
            label: 'Second item',
            labelStyle: 'color: green',
            class: 'foo'
        })
    });


    const dropdown = createDropdown(locale);
    dropdown.buttonView.set({
        withText: true,
        label: "choose variable",
        tooltip: true
    });
    addListToDropdown(dropdown, items);
    return dropdown;
})

效果截图:
下拉菜单标签不显示效果截图

内容的提问来源于stack exchange,提问作者Shibon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 04:34:59