CK编辑器5 + Vue JS +在本地使用组件=复制

时间:2019-05-26 18:19:43

标签: vue.js ckeditor ckeditor5

我的页面上有一组这样的组件:

BlogEntryPointComponent,其中包含NewBlogComponentBlogEditComponent

NewBlogComponentBlogEditComponent均使用以下代码:

import CKEditor from '@ckeditor/ckeditor5-vue/dist/ckeditor.js'
import DecoupledEditor from '@ckeditor/ckeditor5-build-decoupled-document'
import CKOptions from '../../../../js/util/CKOptions.ts'

export default {
    name: "NewBlogComponent",
    components:{
        ckeditor: CKEditor.component,
        DecoupledEditor
    },
    data(){
        return{
            blog: {
                title:null,
                content:null,
            },
            editor: DecoupledEditor,
            editorConfig: CKOptions.defaultOptions
        }
    },

所以现在我挂载了BlogEntryPointComponent,但是问题是这导致了错误ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated

error page help讨论在一页上使用两种不同的版本;我想我是在这种情况下……但是那是两个不同的独立组件。怎么会这样 ?

所以我尝试按照文档建议从源代码构建编辑器,而我遇到了同样的问题。

1 个答案:

答案 0 :(得分:0)

我所做的是更新了所有与ckeditor5相关的软件包并添加了@ckeditor/ckeditor5-ui@latest

当我更新所有与ck5editor相关的软件包时,我遇到了这个新的多个错误

plugincollection-plugin-name-conflict through duplicate.....

https://github.com/ckeditor/ckeditor5/issues/1505

所以我删除了node_modulespackage.lock or yarn.locknpm install again

最有可能导致错误的原因是,如果您具有某些插件的较新版本并且也具有较旧的版本,则它将返回错误,因为您似乎同时使用了新旧版本,或者您无法使用较新的版本较旧版本的核心插件的插件