@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/docs-theme",
3
- "version": "1.0.233",
3
+ "version": "1.0.234",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -168,17 +168,21 @@ const onCopyAsMarkdownClick = async ({ setCopyingStatus }) => {
168
168
  try {
169
169
  setCopyingStatus('loading');
170
170
 
171
- // Fetch the markdown content
172
- const response = await fetch(markdownUrl);
173
-
174
- if (!response.ok) {
175
- throw new Error(`Failed to fetch markdown: ${response.status}`);
176
- }
177
-
178
- const markdownContent = await response.text();
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
- // Copy to clipboard
181
- await navigator.clipboard.writeText(markdownContent);
185
+ await navigator.clipboard.write([markdownContent]);
182
186
 
183
187
  // Show success feedback
184
188
  setCopyingStatus('copied');