我们在使用Oracle JET框架编写的Web项目中使用了CKEditor。我集成了ck编辑器,效果很好。现在,我需要在编辑器中上传图像,然后在编辑器中单击“图像”按钮,将其另存为base64字符串。现在,当我们单击图像图标并选择要插入编辑器的图像文件时,编辑器什么也不做。
使用npm安装了ck编辑器
1.npm install --save @ckeditor/ckeditor5-build-classic
2.Configured path mapping json with the below entry.
"ckeditor": {
"cdn": "3rdparty",
"cwd": "node_modules/@ckeditor/ckeditor5-build-classic/build",
"debug": {
"src": ["ckeditor.js", "ckeditor.js.map"],
"path": "libs/ckeditor/ckeditor.js",
"cdnPath": "ckeditor/ckeditor"
},
"release": {
"src": ["ckeditor.js", "ckeditor.js.map"],
"path": "libs/ckeditor/ckeditor.js",
"cdnPath": "ckeditor/ckeditor"
}
}
3. define(['ojs/ojcore', 'knockout','ckeditor'],... in my .js file
4. self.ClassicEditor = require('ckeditor');
self.ClassicEditor.create(document.querySelector('#editor')).then(newEditor => {
self.editor = newEditor;
}).catch(error => {
console.error(error);
});
工作正常。但是,当我单击编辑器中的图像图标时,选择要上传的文件后它什么也没做。
因此,根据CKeditor网站(https://ckeditor.com/docs/ckeditor5/latest/features/image-upload/base64-upload-adapter.html),我执行了以下操作以添加Base64图像上传适配器。
npm install --save @ckeditor/ckeditor5-upload
此文件在node_modules @ ckeditor文件夹下安装了ckeditor5-upload,ckeditor5-utils,ckeditor5-widget和其他软件包。重建我的应用程序并运行它,但是没有用。
请让我知道如何使它工作。我需要从Oracle Jet角度看的代码。
尝试上传图片时出现以下错误:
filerepository-no-upload-adapter:未定义上载适配器。了解更多:https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-filerepository-no-upload-adapter 未定义