@lvce-editor/virtual-dom 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -664,17 +664,7 @@ const getEventListenerArgs = (params, event) => {
|
|
|
664
664
|
const isInputElement = element => {
|
|
665
665
|
return element instanceof HTMLInputElement;
|
|
666
666
|
};
|
|
667
|
-
|
|
668
|
-
if (target.dataset.index) {
|
|
669
|
-
return Number.parseInt(target.dataset.index);
|
|
670
|
-
}
|
|
671
|
-
const parentNode = target.closest('[data-index]');
|
|
672
|
-
if (!parentNode) {
|
|
673
|
-
return -1;
|
|
674
|
-
}
|
|
675
|
-
// @ts-ignore
|
|
676
|
-
return Number.parseInt(parentNode.dataset.index);
|
|
677
|
-
};
|
|
667
|
+
|
|
678
668
|
const preventEventsMaybe = (info, event) => {
|
|
679
669
|
if (info.preventDefault === 2) {
|
|
680
670
|
if (!isInputElement(event.target)) {
|
|
@@ -687,14 +677,13 @@ const preventEventsMaybe = (info, event) => {
|
|
|
687
677
|
event.stopPropagation();
|
|
688
678
|
}
|
|
689
679
|
if (event.dataTransfer) {
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
}
|
|
680
|
+
const uid = getComponentUid(event.target);
|
|
681
|
+
const dragInfo = getDragInfo(uid);
|
|
682
|
+
if (!dragInfo) {
|
|
683
|
+
return;
|
|
695
684
|
}
|
|
696
|
-
|
|
697
|
-
event.dataTransfer.
|
|
685
|
+
for (const item of info.dragInfo) {
|
|
686
|
+
event.dataTransfer.setData(item.type, item.data);
|
|
698
687
|
}
|
|
699
688
|
}
|
|
700
689
|
};
|
package/package.json
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
const getDragTargetIndex = (target: HTMLElement): number => {
|
|
6
|
-
if (target.dataset.index) {
|
|
7
|
-
return Number.parseInt(target.dataset.index)
|
|
8
|
-
}
|
|
9
|
-
const parentNode = target.closest('[data-index]')
|
|
10
|
-
if (!parentNode) {
|
|
11
|
-
return -1
|
|
12
|
-
}
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
return Number.parseInt(parentNode.dataset.index)
|
|
15
|
-
}
|
|
1
|
+
import { getComponentUid } from '../ComponentUid/ComponentUid.ts'
|
|
2
|
+
import { getDragInfo } from '../DragInfo/DragInfo.ts'
|
|
3
|
+
import { isInputElement } from '../IsInputElement/IsInputElement.ts'
|
|
16
4
|
|
|
17
5
|
export const preventEventsMaybe = (info: any, event: any): void => {
|
|
18
6
|
if (info.preventDefault === 2) {
|
|
@@ -26,14 +14,13 @@ export const preventEventsMaybe = (info: any, event: any): void => {
|
|
|
26
14
|
event.stopPropagation()
|
|
27
15
|
}
|
|
28
16
|
if (event.dataTransfer) {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
17
|
+
const uid = getComponentUid(event.target)
|
|
18
|
+
const dragInfo = getDragInfo(uid)
|
|
19
|
+
if (!dragInfo) {
|
|
20
|
+
return
|
|
34
21
|
}
|
|
35
|
-
|
|
36
|
-
event.dataTransfer.
|
|
22
|
+
for (const item of info.dragInfo) {
|
|
23
|
+
event.dataTransfer.setData(item.type, item.data)
|
|
37
24
|
}
|
|
38
25
|
}
|
|
39
26
|
}
|