Skip to content

Commit 3fdcaf4

Browse files
Alek99claude
andauthored
fix(docs): dropdown bg in dark mode, MCP sidebar sync, Safari copy (#6402)
- Add missing --c-slate-1 dark-mode definition in custom-colors.css; bg-slate-1 resolves through this var, which was undefined in dark mode and caused the copy-page popover (and any other bg-slate-1 surface) to render transparent. - In SidebarState.sidebar_index, route MCP doc paths to index 1 so the MCP category is selected when landing directly on /docs/ai-builder/integrations/mcp-*. - Fix copy-page button on Safari: rewrite to use navigator.clipboard.write with a ClipboardItem whose data is a Promise. Calling clipboard.write synchronously inside the click handler preserves Safari's user-gesture requirement; the prior fetch().then(writeText) chain only worked in Chromium. - Remove the llms-full.txt entry from the copy-page dropdown. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e6e3784 commit 3fdcaf4

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

docs/app/assets/custom-colors.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
--slate-10: #737c8a;
109109
--slate-11: #adb4bf;
110110
--slate-12: #eceef1;
111-
/* #151618 */
111+
--c-slate-1: #151618;
112112
--c-slate-2: #1a1b1d;
113113
/* #1A1B1D */
114114
--c-slate-3: #222326;

docs/app/reflex_docs/templates/docpage/docpage.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -453,20 +453,21 @@ def _copy_page_button(doc_content: str, path: str = "") -> rx.Component:
453453
});
454454
};
455455
animate();
456+
if (navigator.clipboard && typeof ClipboardItem !== 'undefined' && navigator.clipboard.write) {
457+
const blobPromise = fetch(mdUrl).then((r) => {
458+
if (!r.ok) throw new Error(r.status);
459+
return r.text().then((t) => new Blob([t], { type: 'text/plain' }));
460+
});
461+
navigator.clipboard
462+
.write([new ClipboardItem({ 'text/plain': blobPromise })])
463+
.catch((err) => console.error('Copy page failed:', err));
464+
return;
465+
}
456466
fetch(mdUrl)
457467
.then((r) => (r.ok ? r.text() : Promise.reject(r.status)))
458468
.then((text) => {
459469
if (navigator.clipboard && navigator.clipboard.writeText) {
460-
return navigator.clipboard.writeText(text).catch(() => {
461-
const ta = document.createElement('textarea');
462-
ta.value = text;
463-
ta.style.position = 'fixed';
464-
ta.style.opacity = '0';
465-
document.body.appendChild(ta);
466-
ta.select();
467-
try { document.execCommand('copy'); } catch (e) {}
468-
document.body.removeChild(ta);
469-
});
470+
return navigator.clipboard.writeText(text);
470471
}
471472
const ta = document.createElement('textarea');
472473
ta.value = text;
@@ -523,12 +524,6 @@ def _copy_page_button(doc_content: str, path: str = "") -> rx.Component:
523524
description="Copy page as Markdown for LLMs",
524525
on_click=copy_action,
525526
),
526-
_copy_page_menu_item(
527-
icon=ui.icon("File01Icon", size=16),
528-
title="llms-full.txt",
529-
description="View all docs as Markdown for LLMs",
530-
href="/docs/llms-full.txt",
531-
),
532527
rx.el.div(class_name="h-px bg-slate-4 my-1 mx-2"),
533528
_copy_page_menu_item(
534529
icon=ui.icon("MessageProgrammingIcon", size=16),

docs/app/reflex_docs/templates/docpage/sidebar/state.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def sidebar_index(self) -> int:
5757
return 2
5858
elif "enterprise" in route:
5959
return 3
60+
elif "/mcp-" in route:
61+
return 1
6062
else:
6163
return 0
6264
if "hosting" in route:

0 commit comments

Comments
 (0)