Как создать и добавить плагин в vue ckeditor? - PullRequest
0 голосов
/ 09 января 2020

Я использую vue ckeditor.

Файл плагина Mycustom: MyCustomPlugin. js

class MyCustomPlugin extends Plugin {
    init() {
        const editor = this.editor;

        editor.ui.componentFactory.add( 'myCustomPlugin', locale => {
            const view = new ButtonView( locale );
            try {
                view.set( {
                    label: 'Insert image',
                    icon: imageIcon,
                    tooltip: true
                } );

                view.on( 'execute', () => {
                    console.log('dispatch some event');
                } );
            } catch (error) {
                console.log(error);
            }


            return view;
        } );
    }
}

export default MyCustomPlugin;

в приложении. js

import MyCustomPlugin from './core/MyCustomPlugin';
window.MyCustomPlugin = MyCustomPlugin;

Файл компонента: MyFile. vue

<template>
        <ckeditor :editor="editor" v-model="form.title" :config="editorConfig"></ckeditor>
</template>
<script>
    export default {
    props:['courseId'],
    data:function () {
        return {
            editor:ClassicEditor,
            editorConfig:{
                  extraPlugins: [MyCustomPlugin],
            },

        }
    },
</script>

и ошибка в консоли: enter image description here

Заранее спасибо!

...