CKEditor-禁用图像拖放 [英] CKEditor - disable image drag and drop
问题描述
问题:
在Firefox中将图像拖放到CKEditor窗口中时,图像会自动在base64中进行编码。
Problem: When drag and drop images in Firefox into the CKEditor Window, the image are automaticly encoded in base64.
现在我要禁用此功能。我尝试了以下方法:
Now i want to disable this. I tried it with:
config.removePlugins = 'dragdrop';
,但它根本不起作用。还尝试使用旧的插件(imagepaste),但也无法使用...
but it's not working at all. Also tried it with a old Plugin (imagepaste), but not working either...
那里是否存在已知的解决方案?
Is there a known solution out there? Thx!
推荐答案
起初,我尝试使用 config.removePlugins ='dragdrop,basket'禁用Base64。 ;
,但是根本不起作用。
At first I tried to disable Base64 with config.removePlugins = 'dragdrop,basket';
, but it didn't work at all.
然后我发现了此链接,它帮助我解决了此问题,并写了一个插件来完成这项工作。
Then I found this link, which helped me to solve this problem and wrote a plugin to do the job. Here it is with instructions:
要使用它,必须在 ./ plugins
内创建一个名为下车
。
然后创建一个名为 plugin.js
的文件,内容如下:
To use it you have to create a folder inside of ./plugins
named dropoff
.
Then create a file named plugin.js
with this content:
CKEDITOR.plugins.add('dropoff', {
init: function (editor) {
function rejectDrop(event) {
event.data.preventDefault(true);
};
editor.on('contentDom', function() {
editor.document.on('drop',rejectDrop);
});
}
});
之后,您必须在CKEditor的 config.js上注册
。
After that, you have to register it on CKEditor's config.js
.
config.extraPlugins = 'dropoff';
如果您已经在使用一个额外的插件,只需放置一个,$ c它们之间的$ c>像这样:
If you already using an extra plugin just put a ,
between them like this:
config.extraPlugins = 'mypreviousplugin,dropoff';
要开心! \o /
这篇关于CKEditor-禁用图像拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!