docs: Update clipboard handling for Safari compatibility in LLMButtons#2258
docs: Update clipboard handling for Safari compatibility in LLMButtons#2258birosrichard merged 3 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Comment @cursor review or bugbot run to trigger another review on this PR
|
|
||
| // Copy to clipboard | ||
| await navigator.clipboard.writeText(markdownContent); | ||
| console.log('markdownContent', markdownContent); |
There was a problem hiding this comment.
@cursoragent please remove the console.log
There was a problem hiding this comment.
I've successfully removed the debug console.log statement from the LLMButtons component. The change has been committed and pushed to the fix/safari-clipboard branch.
The console.log at line 180 that was logging the markdownContent ClipboardItem has been removed, so it will no longer output to the browser console in production.
| 'text/plain': fetch(markdownUrl) | ||
| .then(async (response) => response.text()) | ||
| .then((content) => new Blob([content], { type: 'text/plain' })), | ||
| }); |
There was a problem hiding this comment.
Missing HTTP response error check after fetch
Medium Severity
The previous code checked response.ok and threw on non-2xx status codes (e.g., 404 or 500). The new promise chain inside ClipboardItem calls response.text() without checking response.ok, so a failed fetch (like a 404) will silently copy the error page HTML to the clipboard and display "Copied" success feedback to the user.
|
Preview for this PR was built for commit |
Co-authored-by: Richard Biroš <richardbiros@icloud.com>
|
Preview for this PR was built for commit |
|
Preview for this PR was built for commit |




https://wolfgangrittner.dev/how-to-use-clipboard-api-in-safari/
Note
Low Risk
Small, localized change to a UI clipboard action; main risk is browser support/behavior differences for
ClipboardItemand async fetch failures.Overview
Updates the
LLMButtons“Copy for LLM” flow to write fetched Markdown to the clipboard vianavigator.clipboard.write([new ClipboardItem(...)])instead ofwriteText, avoiding Safari rejecting clipboard operations when the fetch is awaited before the write.Adds an in-function debug
console.logof the createdClipboardItem.Written by Cursor Bugbot for commit 8ecd7a9. Configure here.