Merge branch 'sub_laptop_1' of C:/Aislo_wt/sub_laptop_1 into main_laptop_1

This commit is contained in:
2026-11-09 18:25:41 +09:00
2 changed files with 32 additions and 13 deletions
@@ -40,6 +40,11 @@
line-height: 1.6;
}
/* [주] 글 — 본문(--text-body)보다 한 단 작게 */
.m01lab-src__note {
font-size: var(--text-body-sm);
}
.m01lab-src__file {
margin: 0;
font-size: var(--text-body-sm);
@@ -65,6 +65,18 @@ function rawNode(b: Block): HTMLElement {
return el("p", { className: "m01lab-src__p", text: b.p ?? "" });
}
/** 「[주]」 줄부터 다음 제목 앞까지 글 줄 = 한 단 작은 글자(`m01lab-src__note`) */
function noteMarked(blocks: Block[]): HTMLElement[] {
let inNote = false;
return blocks.map((b) => {
if (b.h) inNote = false;
else if (b.p?.trim().startsWith("[주]")) inNote = true;
const node = blockNode(b);
if (inNote && b.p !== undefined) node.classList.add("m01lab-src__note");
return node;
});
}
export interface SourceView {
root: HTMLElement;
/** 그 출처 글의 원문을 그림 — 지금 보이는 것과 같으면 안 부름 */
@@ -122,19 +134,21 @@ export function createSourceView(opts: SourceViewOptions = {}): SourceView {
if (shown !== src) return;
if (!found.length) return none();
body.replaceChildren(
...found.flatMap((f) => [
el("p", {
className: "ui-text ui-text--muted m01lab-src__file",
text: [
f.file,
f.matched === f.number ? "" : ts("Near", f.number),
f.item ? (/^\d+$/.test(f.item) ? `${f.item}항` : f.item) : "",
]
.filter(Boolean)
.join(" · "),
}),
...f.blocks.map(blockNode),
]),
...found.flatMap((f) => {
// 파일 경로는 안 보임 — 가까운 절 · 항 안내만
const note = [
f.matched === f.number ? "" : ts("Near", f.number),
f.item ? (/^\d+$/.test(f.item) ? `${f.item}항` : f.item) : "",
]
.filter(Boolean)
.join(" · ");
return [
...(note
? [el("p", { className: "ui-text ui-text--muted m01lab-src__file", text: note })]
: []),
...noteMarked(f.blocks),
];
}),
);
// 강조 항을 패널 몸 가운데로 — 몸만 굴림(85-5 · scrollIntoView 는 메인 창까지 굴림)
requestAnimationFrame(() => {