首页 > 解决方案 > 无法在 reactjs 的 ckeditor5 中实现提及

问题描述

嗨,我正在使用 ckeditor 5,我想实现提及插件。

适合我通过npm安装@ckeditor/ckeditor5-react然后我安装ckeditor 5在线构建器(包括提及插件)然后我像这样导入文件

import { CKEditor } from '@ckeditor/ckeditor5-react';
import ClassicEditor from 'ckeditor5-custom-build';
import Mention from 'ckeditor5-custom-build'

这是我的组件

       <CKEditor
          editor={ClassicEditor}
          config={{
            plugins: [Mention],
            mention: {
              feeds: [
                {
                  marker: '@',
                  feed: ['@Barney', '@Lily', '@Marshall', '@Robin', '@Ted'],
                  minimumCharacters: 1
                }
              ]
            }
          }}
          data={dataMess.smsMess}
          onReady={editor => {

          }}
          onChange={(event, editor) => {
            const data = editor.getData();
            setDataMess({ ...dataMess, smsMess: data })
          }}
          onBlur={(event, editor) => {
            // console.log('Blur.', editor);
            getData(dataMess)
          }}
          onFocus={(event, editor) => {
            // console.log('Focus.', editor);
          }}
        />

但是当我按@时,没有出现下拉菜单,请给我提示,非常感谢!

标签: reactjsckeditormention

解决方案


推荐阅读