catchup-library-web 2.0.23 → 2.1.1
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
|
@@ -5662,7 +5662,6 @@ var MatchingActivityMaterialContent = ({
|
|
|
5662
5662
|
const [draggedElement, setDraggedElement] = (0, import_react21.useState)(
|
|
5663
5663
|
null
|
|
5664
5664
|
);
|
|
5665
|
-
const [isShuffled, setIsShuffled] = (0, import_react21.useState)(false);
|
|
5666
5665
|
const [shuffledMaterialList, setShuffledMaterialList] = (0, import_react21.useState)([]);
|
|
5667
5666
|
const dragElementRef = (0, import_react21.useRef)(null);
|
|
5668
5667
|
const [mousePosition, setMousePosition] = (0, import_react21.useState)({
|
|
@@ -5675,25 +5674,24 @@ var MatchingActivityMaterialContent = ({
|
|
|
5675
5674
|
});
|
|
5676
5675
|
const itemsRef = (0, import_react21.useRef)(null);
|
|
5677
5676
|
const dropZoneRefs = (0, import_react21.useRef)({});
|
|
5677
|
+
const hasShuffledRef = (0, import_react21.useRef)(false);
|
|
5678
5678
|
(0, import_react21.useEffect)(() => {
|
|
5679
|
+
if (hasShuffledRef.current) return;
|
|
5679
5680
|
const shuffleArray2 = (array) => {
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
[copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
|
|
5685
|
-
}
|
|
5686
|
-
setIsShuffled(true);
|
|
5687
|
-
return copyArray;
|
|
5681
|
+
const copyArray = JSON.parse(JSON.stringify(array));
|
|
5682
|
+
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
5683
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
5684
|
+
[copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
|
|
5688
5685
|
}
|
|
5689
|
-
return
|
|
5686
|
+
return copyArray;
|
|
5690
5687
|
};
|
|
5691
5688
|
const materialList = [];
|
|
5692
5689
|
Object.keys(materialMap).forEach((materialKey) => {
|
|
5693
5690
|
materialList.push(materialMap[materialKey]);
|
|
5694
5691
|
});
|
|
5695
5692
|
setShuffledMaterialList(shuffleArray2(materialList));
|
|
5696
|
-
|
|
5693
|
+
hasShuffledRef.current = true;
|
|
5694
|
+
}, [materialMap]);
|
|
5697
5695
|
(0, import_react21.useEffect)(() => {
|
|
5698
5696
|
if (!showCorrectAnswer) return;
|
|
5699
5697
|
answerMap = materialMap;
|
|
@@ -7083,7 +7081,9 @@ var ActivitySolutionContent = ({
|
|
|
7083
7081
|
return null;
|
|
7084
7082
|
let solutionMap;
|
|
7085
7083
|
try {
|
|
7086
|
-
solutionMap = JSON.parse(
|
|
7084
|
+
solutionMap = JSON.parse(
|
|
7085
|
+
solutionMapString.replace("\n[ONAYLI CEVAP]\n", "").replace("\n[ONAYLI CEVAP]", "").replace("[ONAYLI CEVAP]\n", "").replace("[ONAYLI CEVAP]", "")
|
|
7086
|
+
);
|
|
7087
7087
|
} catch (error) {
|
|
7088
7088
|
console.error("Error parsing solution map:", error);
|
|
7089
7089
|
return null;
|
package/dist/index.mjs
CHANGED
|
@@ -5438,7 +5438,6 @@ var MatchingActivityMaterialContent = ({
|
|
|
5438
5438
|
const [draggedElement, setDraggedElement] = useState20(
|
|
5439
5439
|
null
|
|
5440
5440
|
);
|
|
5441
|
-
const [isShuffled, setIsShuffled] = useState20(false);
|
|
5442
5441
|
const [shuffledMaterialList, setShuffledMaterialList] = useState20([]);
|
|
5443
5442
|
const dragElementRef = useRef6(null);
|
|
5444
5443
|
const [mousePosition, setMousePosition] = useState20({
|
|
@@ -5451,25 +5450,24 @@ var MatchingActivityMaterialContent = ({
|
|
|
5451
5450
|
});
|
|
5452
5451
|
const itemsRef = useRef6(null);
|
|
5453
5452
|
const dropZoneRefs = useRef6({});
|
|
5453
|
+
const hasShuffledRef = useRef6(false);
|
|
5454
5454
|
useEffect11(() => {
|
|
5455
|
+
if (hasShuffledRef.current) return;
|
|
5455
5456
|
const shuffleArray2 = (array) => {
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
[copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
|
|
5461
|
-
}
|
|
5462
|
-
setIsShuffled(true);
|
|
5463
|
-
return copyArray;
|
|
5457
|
+
const copyArray = JSON.parse(JSON.stringify(array));
|
|
5458
|
+
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
5459
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
5460
|
+
[copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
|
|
5464
5461
|
}
|
|
5465
|
-
return
|
|
5462
|
+
return copyArray;
|
|
5466
5463
|
};
|
|
5467
5464
|
const materialList = [];
|
|
5468
5465
|
Object.keys(materialMap).forEach((materialKey) => {
|
|
5469
5466
|
materialList.push(materialMap[materialKey]);
|
|
5470
5467
|
});
|
|
5471
5468
|
setShuffledMaterialList(shuffleArray2(materialList));
|
|
5472
|
-
|
|
5469
|
+
hasShuffledRef.current = true;
|
|
5470
|
+
}, [materialMap]);
|
|
5473
5471
|
useEffect11(() => {
|
|
5474
5472
|
if (!showCorrectAnswer) return;
|
|
5475
5473
|
answerMap = materialMap;
|
|
@@ -6859,7 +6857,9 @@ var ActivitySolutionContent = ({
|
|
|
6859
6857
|
return null;
|
|
6860
6858
|
let solutionMap;
|
|
6861
6859
|
try {
|
|
6862
|
-
solutionMap = JSON.parse(
|
|
6860
|
+
solutionMap = JSON.parse(
|
|
6861
|
+
solutionMapString.replace("\n[ONAYLI CEVAP]\n", "").replace("\n[ONAYLI CEVAP]", "").replace("[ONAYLI CEVAP]\n", "").replace("[ONAYLI CEVAP]", "")
|
|
6862
|
+
);
|
|
6863
6863
|
} catch (error) {
|
|
6864
6864
|
console.error("Error parsing solution map:", error);
|
|
6865
6865
|
return null;
|
package/package.json
CHANGED
|
@@ -21,7 +21,6 @@ const MatchingActivityMaterialContent = ({
|
|
|
21
21
|
const [draggedElement, setDraggedElement] = useState<HTMLElement | null>(
|
|
22
22
|
null
|
|
23
23
|
);
|
|
24
|
-
const [isShuffled, setIsShuffled] = useState(false);
|
|
25
24
|
const [shuffledMaterialList, setShuffledMaterialList] = useState<any[]>([]);
|
|
26
25
|
const dragElementRef = useRef<HTMLDivElement>(null);
|
|
27
26
|
const [mousePosition, setMousePosition] = useState<{ x: number; y: number }>({
|
|
@@ -34,26 +33,29 @@ const MatchingActivityMaterialContent = ({
|
|
|
34
33
|
});
|
|
35
34
|
const itemsRef = useRef<HTMLDivElement>(null);
|
|
36
35
|
const dropZoneRefs = useRef<{ [key: string]: HTMLDivElement | null }>({});
|
|
36
|
+
const hasShuffledRef = useRef<boolean>(false);
|
|
37
37
|
|
|
38
38
|
useEffect(() => {
|
|
39
|
+
// Only shuffle once, ever
|
|
40
|
+
if (hasShuffledRef.current) return;
|
|
41
|
+
|
|
39
42
|
const shuffleArray = (array: any) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
[copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
|
|
45
|
-
}
|
|
46
|
-
setIsShuffled(true);
|
|
47
|
-
return copyArray;
|
|
43
|
+
const copyArray = JSON.parse(JSON.stringify(array));
|
|
44
|
+
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
45
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
46
|
+
[copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
|
|
48
47
|
}
|
|
49
|
-
return
|
|
48
|
+
return copyArray;
|
|
50
49
|
};
|
|
50
|
+
|
|
51
51
|
const materialList: any = [];
|
|
52
52
|
Object.keys(materialMap).forEach((materialKey) => {
|
|
53
53
|
materialList.push(materialMap[materialKey]);
|
|
54
54
|
});
|
|
55
|
+
|
|
55
56
|
setShuffledMaterialList(shuffleArray(materialList));
|
|
56
|
-
|
|
57
|
+
hasShuffledRef.current = true;
|
|
58
|
+
}, [materialMap]);
|
|
57
59
|
|
|
58
60
|
useEffect(() => {
|
|
59
61
|
if (!showCorrectAnswer) return;
|
|
@@ -66,7 +68,6 @@ const MatchingActivityMaterialContent = ({
|
|
|
66
68
|
const dropZoneElement = dropZoneRefs.current[dropTargetKey];
|
|
67
69
|
if (!dropZoneElement) return;
|
|
68
70
|
|
|
69
|
-
// Find the scrollable parent container
|
|
70
71
|
const findScrollableParent = (element: HTMLElement): HTMLElement | null => {
|
|
71
72
|
let parent = element.parentElement;
|
|
72
73
|
|
|
@@ -249,7 +250,6 @@ const MatchingActivityMaterialContent = ({
|
|
|
249
250
|
|
|
250
251
|
return (
|
|
251
252
|
<div onMouseMove={handleMouseMove} onMouseUp={handleMouseUp}>
|
|
252
|
-
{/* Floating drag preview for mouse */}
|
|
253
253
|
{draggedValue && mousePosition.x > 0 && (
|
|
254
254
|
<div
|
|
255
255
|
className="fixed pointer-events-none z-50 opacity-80"
|
|
@@ -297,7 +297,6 @@ const MatchingActivityMaterialContent = ({
|
|
|
297
297
|
</div>
|
|
298
298
|
)}
|
|
299
299
|
|
|
300
|
-
{/* Floating drag preview for touch */}
|
|
301
300
|
{draggedValue && touchPosition.x > 0 && (
|
|
302
301
|
<div
|
|
303
302
|
className="fixed pointer-events-none z-50 opacity-80"
|
|
@@ -32,7 +32,13 @@ const ActivitySolutionContent = ({
|
|
|
32
32
|
|
|
33
33
|
let solutionMap;
|
|
34
34
|
try {
|
|
35
|
-
solutionMap = JSON.parse(
|
|
35
|
+
solutionMap = JSON.parse(
|
|
36
|
+
solutionMapString
|
|
37
|
+
.replace("\n[ONAYLI CEVAP]\n", "")
|
|
38
|
+
.replace("\n[ONAYLI CEVAP]", "")
|
|
39
|
+
.replace("[ONAYLI CEVAP]\n", "")
|
|
40
|
+
.replace("[ONAYLI CEVAP]", "")
|
|
41
|
+
);
|
|
36
42
|
} catch (error) {
|
|
37
43
|
console.error("Error parsing solution map:", error);
|
|
38
44
|
return null;
|