Skip to content

Commit 536c7a0

Browse files
committed
fix(examples): multiselect
1 parent aaa64ce commit 536c7a0

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

examples/landing/components/selectors/Custom1/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const OnlyButtons = ({ children, ...props }) => {
1717

1818
OnlyButtons.craft = {
1919
rules: {
20-
canMoveIn: (node) => node.data.type === Button,
20+
canMoveIn: (nodes) => nodes.every((node) => node.data.type === Button),
2121
},
2222
};
2323

examples/landing/components/selectors/Custom2/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export const Custom2VideoDrop = ({ children }) => {
1616
};
1717
Custom2VideoDrop.craft = {
1818
rules: {
19-
canMoveIn: (incoming, self, helper) => {
19+
canMoveIn: (nodes, self, helper) => {
2020
return (
21-
incoming.data.type === Video &&
21+
nodes.every((node) => node.data.type === Video) &&
2222
helper(self.id).decendants().length === 0
2323
);
2424
},

examples/landing/components/selectors/Custom3/index.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,23 @@ export const Custom3BtnDrop = ({ children }) => {
1717

1818
Custom3BtnDrop.craft = {
1919
rules: {
20-
canMoveOut: (target, self, helpers) => {
20+
canMoveOut: (outgoingNodes, self, helpers) => {
2121
const {
2222
data: { nodes },
2323
} = self;
2424
const btnNodes = nodes.filter(
2525
(id) => helpers(id).get().data.type === Button
2626
);
27-
if (target.data.type === Button && btnNodes.length === 1) return false;
28-
return true;
27+
28+
const outgoingButtonNodes = outgoingNodes.filter(
29+
(node) => node.data.type === Button
30+
);
31+
32+
if (outgoingButtonNodes.length < btnNodes.length) {
33+
return true;
34+
}
35+
36+
return false;
2937
},
3038
},
3139
};

0 commit comments

Comments
 (0)