Эх сурвалжийг харах

Ensure that the visual editor recognises a "drop" event as a "mouseup" (#19560)

GitOrigin-RevId: 967d3c80a1501ffdfe9a7e3e978cba746a54d7b3
Alf Eaton 2 жил өмнө
parent
commit
4af10054df

+ 8 - 0
services/web/frontend/js/features/source-editor/extensions/visual/selection.ts

@@ -107,6 +107,14 @@ const mouseDownListener = EditorView.domEventHandlers({
       })
     })
   },
+  drop: (event: MouseEvent, view) => {
+    // treat a `drop` event as a `mouseup` event, which isn't fired
+    window.setTimeout(() => {
+      view.dispatch({
+        effects: mouseDownEffect.of(false),
+      })
+    })
+  },
 })
 
 const mousedownSelectionState = StateField.define<EditorSelection | undefined>({