Javascript 将新上载程序添加到Ckeditor5
如何向ckeditor5添加新的上传功能,如上传音频或视频 我试着使用doc,但一点也不清楚。 我使用这个vue文件来使用ckeditor5。在这个文件中,我为我的项目使用了一个定制的uploadadapter,但现在我不知道如何以这种态度上传另一种类型的文件,如音频和视频Javascript 将新上载程序添加到Ckeditor5,javascript,php,ckeditor5,Javascript,Php,Ckeditor5,如何向ckeditor5添加新的上传功能,如上传音频或视频 我试着使用doc,但一点也不清楚。 我使用这个vue文件来使用ckeditor5。在这个文件中,我为我的项目使用了一个定制的uploadadapter,但现在我不知道如何以这种态度上传另一种类型的文件,如音频和视频 <script> import ClassicEditor from '@ckeditor/ckeditor5-build-classic/build/ckeditor'; import MyUp
<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>
从“@ckeditor/ckeditor 5 build classic/build/ckeditor”导入ClassicEditor;
从“../adapter/UploadAdapter”导入MyUploadAdapter;
导出默认值{
数据(){
返回{
实例:null,
第条:{
数据:“”,
},
}
},
安装的(){
这是初始化();
},
方法:{
//初始化编辑器
初始化:函数(){
分类编辑器
.create(document.querySelector(“编辑器”),this.config)
.然后(编辑=>{
//获取编辑器的初始实例对象
this.instance=editor;
//在开始时设置编辑器的初始活页夹
editor.model.document.on('change',()=>{
此.valueBinder(editor.getData())
});
editor.plugins.get('FileDialogButtonView')
//这个地方装载适配器。
editor.plugins.get('FileRepository').createUploadAdapter=(加载程序,文章)=>{
返回新的MyUploadAdapter(loader,this.article);
}
})
.catch(错误=>{
控制台错误(error);
});
},
}
},
}
用于上传您可以使用的文件
有关CKfinder的配置,请参阅此
使用@ckeditor/ckeditor5 uploadtnx作为回应,我使用Vue和@ckeditor/ckeditor5 build classic,你能告诉我怎么做吗?你想用简单的javascript开发ckeditor吗?是的@Kaushikandai,我添加了我的代码好友…Tnx好友,但我如何为你添加不同的按钮audio@Kamran_dev对不起,迟了答复,对于音频按钮,我将在完成研究后更新您
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( ... );