@apify/docs-theme 1.0.233 → 1.0.234
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/theme/LLMButtons/index.jsx +14 -10
package/package.json
CHANGED
|
@@ -168,17 +168,21 @@ const onCopyAsMarkdownClick = async ({ setCopyingStatus }) => {
|
|
|
168
168
|
try {
|
|
169
169
|
setCopyingStatus('loading');
|
|
170
170
|
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
171
|
+
// Safari requires clipboard writes to be created synchronously inside the user gesture.
|
|
172
|
+
// We therefore pass a Promise that resolves to a Blob into ClipboardItem instead of
|
|
173
|
+
// awaiting fetch first — otherwise Safari would reject the clipboard operation.
|
|
174
|
+
const markdownContent = new ClipboardItem({
|
|
175
|
+
'text/plain': fetch(markdownUrl)
|
|
176
|
+
.then((response) => {
|
|
177
|
+
if (!response.ok) {
|
|
178
|
+
throw new Error(`Failed to fetch markdown: ${response.status}`);
|
|
179
|
+
}
|
|
180
|
+
return response.text();
|
|
181
|
+
})
|
|
182
|
+
.then((content) => new Blob([content], { type: 'text/plain' })),
|
|
183
|
+
});
|
|
179
184
|
|
|
180
|
-
|
|
181
|
-
await navigator.clipboard.writeText(markdownContent);
|
|
185
|
+
await navigator.clipboard.write([markdownContent]);
|
|
182
186
|
|
|
183
187
|
// Show success feedback
|
|
184
188
|
setCopyingStatus('copied');
|