Skip to content

Commit df43e5a

Browse files
committed
feat: enhance comment item handling with additional metadata
- Updated the comment item creation logic to include `commentText` and `timestamp` for better context. - Ensured that `extraPrompt` is conditionally included in the comment items based on its presence.
1 parent 8d20a7d commit df43e5a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,8 @@ export const init = (rawOptions?: Options): ReactGrabAPI => {
821821
onCopySuccess: (copiedElements: Element[], content: string) => {
822822
pluginRegistry.hooks.onCopySuccess(copiedElements, content);
823823

824+
if (!extraPrompt) return;
825+
824826
const hasCopiedElements = copiedElements.length > 0;
825827

826828
if (hasCopiedElements) {
@@ -862,7 +864,7 @@ export const init = (rawOptions?: Options): ReactGrabAPI => {
862864
createElementBounds(element),
863865
),
864866
elementSelectors,
865-
commentText: extraPrompt ?? undefined,
867+
commentText: extraPrompt,
866868
timestamp: Date.now(),
867869
});
868870
setCommentItems(updatedCommentItems);

0 commit comments

Comments
 (0)