0

这怎么可能向ckeditor5添加新的上传功能,比如上传音频或视频?

我尝试使用ckeditor5 doc,但根本不清楚。我使用这个 vue 文件来使用 ckeditor5。在这个文件中,我为我的项目使用了自定义的上传适配器,但现在我不知道如何以这种态度上传另一种类型的文件,如音频和视频

<script>
    import ClassicEditor from '@ckeditor/ckeditor5-build-classic/build/ckeditor';
    import MyUploadAdapter from '../adapter/UploadAdapter';

    export default {
        data() {
            return {
                instance: null,
                article: {
                    data: '',
                },
            }
        },

        mounted() {
            this.initialize();
        },

        methods: {
            // Initializing Editor
            initialize: function () {
                ClassicEditor
                    .create(document.querySelector("#editor"), this.config)
                    .then(editor => {
                        // get initial instance object of editor
                        this.instance = editor;

                        // set initial binder of editor on start
                        editor.model.document.on('change', () => {
                            this.valueBinder(editor.getData())
                        });

                        editor.plugins.get('FileDialogButtonView')


                        // This place loads the adapter.
                        editor.plugins.get('FileRepository').createUploadAdapter = (loader, article) => {
                            return new MyUploadAdapter(loader, this.article);

                        }
                    })
                    .catch(error => {
                        console.error(error);
                    });
            },

            }
        },
    }

</script>
4

1 回答 1

0

对于上传文件,您可以使用CKFinder

CKfinder 的配置请参考此链接

ClassicEditor
    .create( editorElement, {
        ckfinder: {
            uploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json' // here you can set your own file path
        }
    } )
    .then( ... )
    .catch( ... );
于 2018-08-30T06:47:02.720 回答