diff --git a/src/components/CopyPageDropdown.tsx b/src/components/CopyPageDropdown.tsx index 639457dd..7ffdccfd 100644 --- a/src/components/CopyPageDropdown.tsx +++ b/src/components/CopyPageDropdown.tsx @@ -47,6 +47,15 @@ function ChatGPTIcon({ className }: { className?: string }) { ) } +// Cursor icon +function CursorIcon({ className }: { className?: string }) { + return ( + + + + ) +} + // Cache for fetched markdown content const markdownCache = new Map() @@ -153,6 +162,17 @@ export function CopyPageDropdown({ window.open(`https://chatgpt.com/?q=${prompt}`, '_blank') } + const handleOpenInCursor = () => { + const pageUrl = window.location.href + const prompt = `Read from this URL:\n${pageUrl}\nand explain it to me` + window.open( + `cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent( + prompt, + )}`, + '_blank', + ) + } + const menuItems = [ { icon: MarkdownIcon, @@ -172,6 +192,12 @@ export function CopyPageDropdown({ description: 'Ask questions about this page', onSelect: handleOpenInChatGPT, }, + { + icon: CursorIcon, + label: 'Open in Cursor', + description: 'Ask questions about this page', + onSelect: handleOpenInCursor, + }, ] return ( @@ -246,7 +272,7 @@ export function CopyPageDropdown({ )} onSelect={item.onSelect} > -
+