Commit e1790c8
fix: Safari clipboard fallback for "Copy as Markdown" README button
Fixes #2151
Safari requires navigator.clipboard.writeText() to be called
synchronously within a user gesture. The async fetchReadmeMarkdown()
breaks that chain, causing the clipboard write to silently fail.
Added a document.execCommand('copy') fallback via a temporary textarea
when the Clipboard API rejects. Also bypassed useClipboard's copy()
to directly use navigator.clipboard.writeText() so the rejection is
catchable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 7f2fc1a commit e1790c8
1 file changed
+34
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
110 | 128 | | |
111 | 129 | | |
112 | 130 | | |
113 | 131 | | |
114 | 132 | | |
115 | 133 | | |
116 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
117 | 150 | | |
118 | 151 | | |
119 | 152 | | |
| |||
0 commit comments