芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/reginaeigbe.com/folder/admin/tmp/resources/js/Admin/Components/Inputs/Editor.jsx
import ClassicEditor from "@ckeditor/ckeditor5-build-classic"; import {CKEditor} from "@ckeditor/ckeditor5-react"; export default function Editor({ onChange, value = "" }){ function uploadAdapter(loader) { return { upload: () => { return new Promise((resolve, reject) => { const body = new FormData(); loader.file.then((file) => { body.append("files", file); axios.post(route('admin.editor.image.upload'), body).then((res) => { resolve({ default: res.data }); }).catch((err) => { reject(err); }) }); }); } }; } function uploadPlugin(editor) { editor.plugins.get("FileRepository").createUploadAdapter = (loader) => { return uploadAdapter(loader); }; } const editorConfiguration = { // Other configuration options... extraPlugins: [uploadPlugin], }; return(
{ const data = editor.getData(); onChange(data) } } /> ) }