Skip to content

Commit ec67b8f

Browse files
committed
Fix - parent element (e.g. div) with nested children inside of it can now be drag and dropped to be repositioned. Rename function inside of SeparatorChild.tsx from DirectChildHTMLNestable to SeparatorChild to not cause confusion, as a different DirectChildHTMLNestable function already exists inside DirectChildHTMLNestable.tsx
1 parent 0f4b093 commit ec67b8f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/src/components/main/SeparatorChild.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from '../../redux/reducers/slice/appStateSlice';
1717
import { emitEvent } from '../../helperFunctions/socket';
1818

19-
function DirectChildHTMLNestable({
19+
function SeparatorChild({
2020
childId,
2121
type,
2222
typeId,
@@ -165,4 +165,4 @@ function DirectChildHTMLNestable({
165165
);
166166
}
167167

168-
export default DirectChildHTMLNestable;
168+
export default SeparatorChild;

app/src/helperFunctions/changePositionValidation.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ const validateNewParent = (
1818
nestedParent = false
1919
): boolean => {
2020
for (const element of array) {
21-
if (element.childId === toTargetParentId && nestedChild === true)
21+
if (
22+
element.childId === toTargetParentId &&
23+
nestedChild === true &&
24+
element.typeId > 1000 // check if not a separator (1000) or previously dragged component (> 1000)
25+
)
2226
return (nestedParent = true);
2327
else if (
2428
element.childId === currentChildId &&

0 commit comments

Comments
 (0)