use*_*134 5 javascript ckeditor
问题:将Firefox中的图像拖放到CKEditor窗口时,图像会在base64中自动编码.
现在我想禁用它.我尝试过:
config.removePlugins = 'dragdrop';
Run Code Online (Sandbox Code Playgroud)
但它根本不起作用.还尝试使用旧的插件(imagepaste),但不工作...
那里有一个已知的解决方案吗?谢谢!
起初我尝试用 禁用 Base64 config.removePlugins = 'dragdrop,basket';,但根本不起作用。
然后我找到了这个链接,它帮助我解决了这个问题并编写了一个插件来完成这项工作。这是带有说明的:
要使用它,您必须在./plugins命名的内部创建一个文件夹dropoff。plugin.js然后创建一个以此内容命名的文件:
CKEDITOR.plugins.add('dropoff', {
init: function (editor) {
function rejectDrop(event) {
event.data.preventDefault(true);
};
editor.on('contentDom', function() {
editor.document.on('drop',rejectDrop);
});
}
});
Run Code Online (Sandbox Code Playgroud)
之后,您必须在 CKEditor 上注册它config.js。
config.extraPlugins = 'dropoff';
Run Code Online (Sandbox Code Playgroud)
如果您已经使用了额外的插件,只需在,它们之间放置一个,如下所示:
config.extraPlugins = 'mypreviousplugin,dropoff';
Run Code Online (Sandbox Code Playgroud)
而且要快乐!\o/