簡體   English   中英

Ckeditor5 -“小部件工具欄沒有項目”{toolbarId:'mediaEmbed'}

[英]Ckeditor5 - "widget toolbar no items" {toolbarId: 'mediaEmbed'}

我正在將 Ckeditor5 與 React 一起使用,並且在呈現組件時在控制台中收到此警告,我該如何擺脫它?

錯誤截圖

這是官方文檔上的錯誤參考

https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-widget-toolbar-no-items

這是我的組件

export const EditorField = (props) => {

    const {name,method,placeholder,isSimplified} = props

    const link = {
        decorators: {
            toggleDownloadable: {
                mode: 'manual',
                label: 'Downloadable',
                attributes: {
                    download: 'file'
                }
            },
            openInNewTab: {
                mode: 'manual',
                label: 'Open in a new tab',
                defaultValue: true,
                attributes: {
                    target: '_blank',
                    rel: 'noopener noreferrer'
                }
            }
        }
    }
    const image = {
        toolbar: [
            'imageTextAlternative',
            'imageStyle:inline',
            'imageStyle:block',
            'imageStyle:side',
            'linkImage'
        ]
    }
    const table = {
        contentToolbar: [
            'tableColumn',
            'tableRow',
            'mergeTableCells',
            'tableCellProperties',
            'tableProperties'
        ]
    }
    const toolbar = isSimplified ? {
        items: [
            'bold','italic','underline','strikethrough','|',
            'link','|',
            'specialCharacters','|',
            'undo','redo'
        ], shouldNotGroupWhenFull: true
    } : {
        items: [
            'heading','|',
            'bold','italic','underline','strikethrough','|',
            'fontColor','fontBackgroundColor','|',
            'bulletedList','numberedList','|',
            'link','imageUpload','insertTable','mediaEmbed','|',
            'specialCharacters','blockQuote','horizontalLine','|',
            'undo','redo'
        ], shouldNotGroupWhenFull: true
    }

    return (
        <CKEditor
            config={ {
                toolbar,
                language: 'it',
                placeholder,
                link,
                image,
                table,
            } }
            editor={ Editor }
            data={request[name] || ''}
            onChange={ (event, editor) => {
                const data = editor.getData()
                dispatch(setValue({method,name,value:data}))
            } }
        />
    )
}

我終於通過將它添加到我的配置中來解決這個問題。

removePlugins: ["MediaEmbedToolbar"],

目前,這個插件沒有做任何事情: https : //github.com/ckeditor/ckeditor5/issues/9824

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM