Skip to content

Commit 6889a55

Browse files
committed
fix
1 parent 43f938c commit 6889a55

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

packages/react-grab/src/core/index.tsx

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -822,14 +822,22 @@ export const init = (rawOptions?: Options): ReactGrabAPI => {
822822
}
823823
};
824824

825-
const handleCopySuccessWithComments = (
826-
copiedElements: Element[],
827-
content: string,
828-
extraPrompt: string | undefined,
829-
elementName: string | undefined,
830-
tagName: string | null,
831-
componentName: string | null,
832-
) => {
825+
const handleCopySuccessWithComments = (options: {
826+
copiedElements: Element[];
827+
content: string;
828+
extraPrompt: string | undefined;
829+
elementName: string | undefined;
830+
tagName: string | null;
831+
componentName: string | null;
832+
}) => {
833+
const {
834+
copiedElements,
835+
content,
836+
extraPrompt,
837+
elementName,
838+
tagName,
839+
componentName,
840+
} = options;
833841
pluginRegistry.hooks.onCopySuccess(copiedElements, content);
834842

835843
if (!extraPrompt) return;
@@ -919,14 +927,14 @@ export const init = (rawOptions?: Options): ReactGrabAPI => {
919927
transformCopyContent: pluginRegistry.hooks.transformCopyContent,
920928
onAfterCopy: pluginRegistry.hooks.onAfterCopy,
921929
onCopySuccess: (copiedElements: Element[], content: string) => {
922-
handleCopySuccessWithComments(
930+
handleCopySuccessWithComments({
923931
copiedElements,
924932
content,
925933
extraPrompt,
926934
elementName,
927935
tagName,
928936
componentName,
929-
);
937+
});
930938
},
931939
onCopyError: pluginRegistry.hooks.onCopyError,
932940
},

packages/react-grab/src/utils/get-nearest-edge.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
type ViewportEdge = "top" | "bottom" | "left" | "right";
1+
import type { ToolbarState } from "../types.js";
22

3-
export const getNearestEdge = (rect: DOMRect): ViewportEdge => {
3+
export const getNearestEdge = (rect: DOMRect): ToolbarState["edge"] => {
44
const centerX = rect.left + rect.width / 2;
55
const centerY = rect.top + rect.height / 2;
66
const distanceToTop = centerY;

0 commit comments

Comments
 (0)