fix(docs): 문서 뷰어 :root 변수 소생 — 한글이 배경에 묻히던 문제
All checks were successful
CI / backend-test (push) Successful in 1m36s
CI / frontend-build (push) Successful in 45s
CI / backend-dep-scan (push) Successful in 28s

Shadow DOM 안엔 :root가 없어 문서가 :root에 정의한 CSS 변수(--ink 등)가
통째로 죽었다. var(--ink) 텍스트가 색을 잃고 배경과 같아짐(안드로이드·아이폰
공통). :root→:host로 변수를 그림자 트리에 심고, 기본 배경·글자색 폴백 추가.
This commit is contained in:
AWESOMEDEV 2026-07-23 13:35:12 +09:00
parent c813b99ea3
commit 6f1c78bc03

View File

@ -92,11 +92,21 @@ export default function DocViewerPage() {
// ). CSS `body { ... }` (· )
// . .__docbody div , CSS `body`
// `.__docbody` div . ( )
styles = styles.replace(/(^|[}{,])(\s*)body\b/g, '$1$2.__docbody');
styles = styles
.replace(/(^|[}{,])(\s*)body\b/g, '$1$2.__docbody')
// Shadow DOM :root(=document html) . :root
// CSS (--ink, --paper ) , var(--ink)
// (· ). :root :host( )
// . data-theme host
// OS (prefers-color-scheme) , .
.replace(/:root\b/g, ':host');
const bodyInner = parsed.body.innerHTML;
const bodyClass = parsed.body.className;
setShadowHtml(`<style>${styles}</style><div class="__docbody ${bodyClass}">${bodyInner}</div>`);
// ·
// ( ). .
const base = ':host,.__docbody{background:var(--paper,#FAFBFD);color:var(--ink,#101A28);}';
setShadowHtml(`<style>${base}${styles}</style><div class="__docbody ${bodyClass}">${bodyInner}</div>`);
})
.catch(() => {
if (!cancelled) setError(true);