Это веб-код:
DecoupledEditor
.create( document.querySelector( '#webDetails' ),{
language: 'zh-cn',
image: {
toolbar: [ 'imageTextAlternative' ],
styles: [ 'full', 'side' ]
},
ckfinder: {
uploadUrl: '<%=WEBPATH%>/platform/updateMaterial'
}
} )
.then( editor => {
const toolbarContainer = document.querySelector( '#toolbar-webDetails' );
toolbarContainer.appendChild( editor.ui.view.toolbar.element );
} )
Это контроллер Spring:
@PostMapping("updateMaterial")
@ResponseBody
public String updateMaterial(@RequestParam("upload") MultipartFile file, HttpServletRequest request){
String trueFileName = null;
String realPath = null;
try {
realPath = request.getSession().getServletContext().getRealPath("/upload");
System.out.println(realPath);
trueFileName = uploadImg(realPath, file);
} catch (IllegalStateException | IOException e) {
e.printStackTrace();
}
return "{\"default\":\"" + realPath + File.separator + trueFileName + "\"}";
}
Здесь я возвращаю адрес изображения на диске.
Это стиль JSON String. Я хочу, чтобы CKEditor 5 api возвращал информацию, но все равно отказ.
Что мне нужно вернуть в фоновом режиме, чтобы преуспеть, или я пропустил шаг?
спасибо.
![enter image description here](https://i.stack.imgur.com/fs1fP.png)