@gustavo-valsechi/client 1.4.310 → 1.4.312
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.
|
@@ -72,26 +72,28 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
72
72
|
});
|
|
73
73
|
}, [targets, inputRef, containerRef, theme.content.isMobile]);
|
|
74
74
|
(0, import_react.useEffect)(() => {
|
|
75
|
+
const removeTarget = (node) => {
|
|
76
|
+
if (!(node instanceof HTMLElement)) return;
|
|
77
|
+
const index = import_lodash.default.findIndex(memory, (target) => {
|
|
78
|
+
return target.ref.current === node || node.contains(target.ref.current);
|
|
79
|
+
});
|
|
80
|
+
console.log(node);
|
|
81
|
+
console.log(import_lodash.default.find(memory, (target) => {
|
|
82
|
+
return target.ref.current === node || node.contains(target.ref.current);
|
|
83
|
+
}));
|
|
84
|
+
console.log(index);
|
|
85
|
+
if (index === -1) return;
|
|
86
|
+
removeInside(index);
|
|
87
|
+
memory.splice(index, 1);
|
|
88
|
+
setTargets([...memory]);
|
|
89
|
+
};
|
|
75
90
|
const observer = new MutationObserver((mutations) => {
|
|
76
91
|
for (const mutation of mutations) {
|
|
77
|
-
mutation.
|
|
78
|
-
|
|
79
|
-
const index = import_lodash.default.findIndex(memory, (target) => {
|
|
80
|
-
return target.ref.current === node || node.contains(target.ref.current);
|
|
81
|
-
});
|
|
82
|
-
console.log(node);
|
|
83
|
-
console.log(import_lodash.default.find(memory, (target) => {
|
|
84
|
-
return target.ref.current === node || node.contains(target.ref.current);
|
|
85
|
-
}));
|
|
86
|
-
console.log(index);
|
|
87
|
-
if (index === -1) return;
|
|
88
|
-
removeInside(index);
|
|
89
|
-
memory.splice(index, 1);
|
|
90
|
-
setTargets([...memory]);
|
|
91
|
-
});
|
|
92
|
+
mutation.addedNodes.forEach(removeTarget);
|
|
93
|
+
mutation.removedNodes.forEach(removeTarget);
|
|
92
94
|
}
|
|
93
95
|
});
|
|
94
|
-
observer.observe(document.
|
|
96
|
+
observer.observe(document.getElementById("modal-context-container"), { childList: true, subtree: true });
|
|
95
97
|
return () => observer.disconnect();
|
|
96
98
|
}, []);
|
|
97
99
|
const getCoords = (target, component) => {
|
|
@@ -38,26 +38,28 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
38
38
|
});
|
|
39
39
|
}, [targets, inputRef, containerRef, theme.content.isMobile]);
|
|
40
40
|
useEffect(() => {
|
|
41
|
+
const removeTarget = (node) => {
|
|
42
|
+
if (!(node instanceof HTMLElement)) return;
|
|
43
|
+
const index = _.findIndex(memory, (target) => {
|
|
44
|
+
return target.ref.current === node || node.contains(target.ref.current);
|
|
45
|
+
});
|
|
46
|
+
console.log(node);
|
|
47
|
+
console.log(_.find(memory, (target) => {
|
|
48
|
+
return target.ref.current === node || node.contains(target.ref.current);
|
|
49
|
+
}));
|
|
50
|
+
console.log(index);
|
|
51
|
+
if (index === -1) return;
|
|
52
|
+
removeInside(index);
|
|
53
|
+
memory.splice(index, 1);
|
|
54
|
+
setTargets([...memory]);
|
|
55
|
+
};
|
|
41
56
|
const observer = new MutationObserver((mutations) => {
|
|
42
57
|
for (const mutation of mutations) {
|
|
43
|
-
mutation.
|
|
44
|
-
|
|
45
|
-
const index = _.findIndex(memory, (target) => {
|
|
46
|
-
return target.ref.current === node || node.contains(target.ref.current);
|
|
47
|
-
});
|
|
48
|
-
console.log(node);
|
|
49
|
-
console.log(_.find(memory, (target) => {
|
|
50
|
-
return target.ref.current === node || node.contains(target.ref.current);
|
|
51
|
-
}));
|
|
52
|
-
console.log(index);
|
|
53
|
-
if (index === -1) return;
|
|
54
|
-
removeInside(index);
|
|
55
|
-
memory.splice(index, 1);
|
|
56
|
-
setTargets([...memory]);
|
|
57
|
-
});
|
|
58
|
+
mutation.addedNodes.forEach(removeTarget);
|
|
59
|
+
mutation.removedNodes.forEach(removeTarget);
|
|
58
60
|
}
|
|
59
61
|
});
|
|
60
|
-
observer.observe(document.
|
|
62
|
+
observer.observe(document.getElementById("modal-context-container"), { childList: true, subtree: true });
|
|
61
63
|
return () => observer.disconnect();
|
|
62
64
|
}, []);
|
|
63
65
|
const getCoords = (target, component) => {
|