admin管理员组文章数量:1293047
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';
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!
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';
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!
Share Improve this question asked Feb 25, 2014 at 18:46 user2270134user2270134 992 silver badges8 bronze badges3 Answers
Reset to default 4At 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:
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);
});
}
});
After that, you have to register it on CKEditor's config.js
.
config.extraPlugins = 'dropoff';
If you already using an extra plugin just put a ,
between them like this:
config.extraPlugins = 'mypreviousplugin,dropoff';
And be Happy! \o/
Here i found the solution to disable the drag and drop in ckeditor
ed.on('instanceReady', (ev) =>{
CKEDITOR.plugins.clipboard.preventDefaultDropOnElement(ev.editor.document);
});
I am using a ckeditor5 custom build which includes the Base64UploadAdapter plugin. So, to disable this plugin for some particular views, I just added the "removePlugins" instruction to the editor configuration. Then, dragging and dropping images gets disabled.
configEditor = {
removePlugins: [ 'Base64UploadAdapter' ],
toolbar: ['heading', '|', 'bold', 'bulletedList', 'numberedList'],
};
本文标签: javascriptCKEditordisable image drag and dropStack Overflow
版权声明:本文标题:javascript - CKEditor - disable image drag and drop - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741569185a2385904.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论