如何使用ssr在nuxt中添加ckeditor插件

2024-02-06

我正在尝试在我的通用 nuxt 应用程序中添加 ckeditor 5 的对齐插件(SSR)

我在插件中尝试过这样


import Vue from 'vue'
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'
import VueCkeditor from 'vue-ckeditor5'

// import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment'; <-- not working


const options = {

    editors: {
        classic: ClassicEditor,

    },
    name: 'ckeditor'
}

Vue.use(VueCkeditor.plugin, options);

我也尝试过直接导入到这样的页面

import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';

出现错误

意外的标识符

正常的 editorConfig 工作正常

editorConfig: {

      image: {

        toolbar: ['imageTextAlternative', '|', 'imageStyle:alignLeft', 'imageStyle:full', 'imageStyle:alignRight'],

                styles: [

                'full',


               'alignLeft',


               'alignRight'
           ]
         },
         alignment: {
           options: [ 'left', 'right' ]
         },
         toolbar: {
           items: [
            'heading',
            'bold',
            'italic',
            'link',
            'bulletedList',
            'numberedList',
            'blockQuote',
            'insertTable',
            'imageUpload',
            'mediaEmbed',
            'alignment'
          ]
       }
    },

我最终找到的最佳选择是制作自己的自定义构建 npm 包并像使用它一样

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用ssr在nuxt中添加ckeditor插件 的相关文章

随机推荐