فهرست منبع

Fixed drag and drop overlay on WebKit and Safari (#1011)

* Fixed drag and drop overlay on webkit/safari. Closes #1010

* Use dataTransfer.types when dataTransfer.items is not available/empty

* Updated package.json and header for contribution
Christian Domínguez 1 سال پیش
والد
کامیت
00ca25ffd7
3فایلهای تغییر یافته به همراه7 افزوده شده و 4 حذف شده
  1. 1 0
      CHANGELOG.md
  2. 2 1
      package.json
  3. 4 3
      src/mol-plugin-ui/plugin.tsx

+ 1 - 0
CHANGELOG.md

@@ -18,6 +18,7 @@ Note that since we don't clearly distinguish between a public and private interf
   - Labels applied in one node
 - ModelServer SDF/MOL2 ligand export: fix atom indices when additional atoms are present
 - Avoid showing (and calculating) inter-unit bonds for huge structures
+- Fixed `DragOverlay` on WebKit/Safari browsers
 
 ## [v3.43.1] - 2023-12-04
 

+ 2 - 1
package.json

@@ -103,7 +103,8 @@
     "Russell Parker <russell@benchling.com>",
     "Dominik Tichy <tichydominik451@gmail.com>",
     "Yana Rose <yana.v.rose@gmail.com>",
-    "Yakov Pechersky <ffxen158@gmail.com>"
+    "Yakov Pechersky <ffxen158@gmail.com>",
+    "Christian Dominguez <christian.99dominguez@gmail.com>"
   ],
   "license": "MIT",
   "devDependencies": {

+ 4 - 3
src/mol-plugin-ui/plugin.tsx

@@ -3,6 +3,7 @@
  *
  * @author David Sehnal <david.sehnal@gmail.com>
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
+ * @author Christian Dominguez <christian.99dominguez@gmail.com>
  */
 
 import { List } from 'immutable';
@@ -170,15 +171,15 @@ class Layout extends PluginUIComponent {
     private showDragOverlay = new BehaviorSubject(false);
     onDragEnter = (ev: React.DragEvent<HTMLDivElement>) => {
         let hasFile = false;
-        if (ev.dataTransfer.items) {
+        if (ev.dataTransfer.items && ev.dataTransfer.items.length > 0) {
             for (let i = 0; i < ev.dataTransfer.items.length; i++) {
                 if (ev.dataTransfer.items[i].kind !== 'file') continue;
                 hasFile = true;
                 break;
             }
         } else {
-            for (let i = 0; i < ev.dataTransfer.files.length; i++) {
-                if (!ev.dataTransfer.files[i]) continue;
+            for (let i = 0; i < ev.dataTransfer.types.length; i++) {
+                if (ev.dataTransfer.types[i] !== 'Files') continue;
                 hasFile = true;
                 break;
             }