我在我的 ckeditor 中添加了“增强图像”,image2 插件,我一直在尝试将其配置为当用户在文件浏览器中选择一个图像以自动上传到服务器时,无需用户单击发送到服务器按钮。有谁知道如何实现这一目标?
谢谢
我在我的 ckeditor 中添加了“增强图像”,image2 插件,我一直在尝试将其配置为当用户在文件浏览器中选择一个图像以自动上传到服务器时,无需用户单击发送到服务器按钮。有谁知道如何实现这一目标?
谢谢
我终于弄清楚了,尽管我确信一定存在更好的方法来做到这一点。
要上传图像而不需要发送到服务器按钮,我必须首先覆盖 CKEDITOR.ui.dialog.file.prototype.reset
CKEDITOR.ui.dialog.file.prototype.reset = function() {
//code
.$.write(['...',<input onchange="this.form.submit()" .../>, '...'])
//code
}
然后在我的 config.js 对话框定义中
var dialog = dialogDefinition.dialog;
var uploadButton = uploadTab.get('uploadButton');
if ( dialogName === 'image2') {
var filebrowserSe = dialog.getParentEditor()._.filebrowserSe = uploadButton;
filebrowserSe.getDialog = function() {return dialog};
uploadTab.remove('uploadButton');
//code ...
}