简体   繁体   English

chrome 中的 event.dataTransfer.dropEffect

[英]event.dataTransfer.dropEffect in chrome

I have a script which determines the result of drag and drop operation from the value of event.dataTransfer.dropEffect.我有一个脚本,它根据 event.dataTransfer.dropEffect 的值确定拖放操作的结果。 I set the property event.dataTransfer.effectAllowed to value "copymove".我将属性 event.dataTransfer.effectAllowed 设置为值“copymove”。 In Firefox the value of dropEffect is "move" by default and "copy" when I press ctrl key during drag.在 Firefox 中,dropEffect 的值默认为“移动”,在拖动过程中按 ctrl 键时为“复制”。 In Chrome, the value of dropEffect is always "none".在 Chrome 中,dropEffect 的值总是“none”。 Does Chrome not suppot this API? Chrome 不支持这个 API?

This is a bug in Chrome (and in Internet Explorer).这是 Chrome(和 Internet Explorer)中的一个错误。 For Chrome there is a bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=39399对于 Chrome,有一个错误报告: https : //bugs.chromium.org/p/chromium/issues/detail?id=39399

As a solution you must store the content of dropEffect in a global variable while the drag events and use its content instead of event.dataTransfer.dropEffect if that value is "none" in the drop event.作为解决方案,您必须在拖动事件时将 dropEffect 的内容存储在全局变量中,如果该值在放置事件中为“none”,则使用其内容而不是 event.dataTransfer.dropEffect。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM