问题描述
我想在 Laravel 项目中使用 CKEditor 5,我完成了将图片上传到服务器的配置,但是上传的图片在 CKEditor 中没有显示。我该如何配置?
<script>
ClassicEditor.create( document.querySelector( '#editor' ),{
ckfinder: {
// Upload the images to the server using the CKFinder QuickUpload command.
uploadUrl: "{{ route('ck.upload',['_token'=> csrf_token()]) }}",// Define the CKFinder configuration (if necessary).
options: {
resourceType: 'Images'
}
}
})
.then( editor => {
console.log( editor );
})
.catch( error => {
console.error( error );
});
</script>
控制器
public function ckUpload(Request $request)
{
$file = $request->upload;
$fileName = $file->getClientOriginalName();
$new_name = time().$fileName;
$dir = "images/";
$file->move($dir,$new_name);
$url = asset('images/'.$new_name);
$CkeditorFuncNum = $request->input('CKEditorFuncNum');
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)