Skip to content

Commit

Permalink
Merge pull request #386 from easyops-cn/steve/allow-paste-a-route-int…
Browse files Browse the repository at this point in the history
…o-a-brick

fix(): allow paste a route into a brick
  • Loading branch information
weareoutman authored Oct 9, 2024
2 parents 3625dd4 + 42a0168 commit 140e965
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ describe("useCanPaste", () => {
[2, 3, true],
[2, 100, false],
[2, 101, true],
[100, 2, false],
[100, 2, true],
[100, 101, false],
[101, 100, true],
])("should work", (sourceUid, targetUid, canDrop) => {
])("should work for %d %d", (sourceUid, targetUid, canDrop) => {
const wrapper = shallow(
<TestComponent
clipboard={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ export function useCanPaste(): CanPaste {
}
if (
(sourceNode || clipboard.nodeType) &&
(isRouteNode(sourceNode || ({ type: clipboard.nodeType } as any))
? targetNode.type !== "routes"
: targetNode.type === "routes" || targetNode.type === "redirect")
(targetNode.type === "redirect" ||
(isRouteNode(sourceNode || ({ type: clipboard.nodeType } as any))
? targetNode.type === "bricks"
: targetNode.type === "routes"))
) {
return false;
}
Expand Down

0 comments on commit 140e965

Please sign in to comment.