fix: Studio 가 못 읽은 것을 없는 것으로 그리지 않게 한다
홈 「지금 집중하는 것」 편집기는 열린 질문과 결정을 못 읽으면 빈 배열로 삼키고 「이 프로젝트에 열린 질문이 없습니다」라고 적었다. 실제로는 넷이 있었고 공개 사이트에도 나오고 있었다 — 작성자에게는 자기가 아직 쓰지 않은 것으로 보였다. 거짓말을 하느니 못 읽었다고 말한다. 작업본 인트로가 「Case, Reference, Question, Decision」이었다. 바로 아래 필터는 새 이름이라 한 화면에 두 벌이 있었다. 공개 프로젝트·프로필 문구도 같이 고친다. 관계 대상 select 를 종류별로 묶는다. 평면 목록은 문서가 늘수록 나빠지는데 25개에서 49개가 됐다 — 종류는 카탈로그가 이미 알려 주고 있었고 화면만 버리고 있었다. 이유 칸은 이제 공개 화면에 그대로 나가므로 한 줄 input 에서 여러 줄로 바꾼다. 본문에 코드·표·목록을 넣는 도구를 둔다. 주제 화면에 비교표를 두자고 정해 놓고도 그 표를 작성할 수단이 문법을 외우는 것뿐이었다. 인라인 코드 스타일이 세 컨테이너에 따로 있어 어디에도 속하지 않는 자리 — 문서 머리말의 요약 — 에서는 코드가 본문과 같은 민무늬로 나왔다. 그 칸에 이름을 준다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ
This commit is contained in:
co-authored by
Claude Opus 5
parent
ffdeaa1e83
commit
7acde27f2e
@@ -856,7 +856,7 @@ export const profile: Profile = {
|
||||
},
|
||||
{
|
||||
title: "프로젝트 맥락으로 다시 연결합니다",
|
||||
description: "Case와 Reference, Question, Decision이 따로 흩어지지 않게 실제 작업과 연결합니다.",
|
||||
description: "검증 기록과 적용 기준, 열린 질문, 설계 결정이 따로 흩어지지 않게 실제 작업과 연결합니다.",
|
||||
},
|
||||
],
|
||||
currentProjectSlugs: ["backend-skeleton", "auth-lab"],
|
||||
|
||||
@@ -19,7 +19,7 @@ const principles = [
|
||||
{
|
||||
title: "프로젝트 맥락으로 다시 연결합니다",
|
||||
description:
|
||||
"Case와 Reference, Question, Decision이 따로 흩어지지 않게 실제 작업과 연결합니다.",
|
||||
"검증 기록과 적용 기준, 열린 질문, 설계 결정이 따로 흩어지지 않게 실제 작업과 연결합니다.",
|
||||
},
|
||||
] as const;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export function ProjectsPage() {
|
||||
<p className="section-kicker">Projects</p>
|
||||
<h1>프로젝트</h1>
|
||||
<p>
|
||||
Case와 Reference, Question을 실제 설계 목표와 결정의 흐름으로 묶어
|
||||
검증 기록과 적용 기준, 열린 질문을 실제 설계 목표와 결정의 흐름으로 묶어
|
||||
봅니다.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
@@ -25,7 +25,12 @@ function renderInlineCode(text: string, keyPrefix: string): ReactNode[] {
|
||||
if (parts.length % 2 === 0) return [text];
|
||||
return parts.map((part, index) =>
|
||||
index % 2 === 1 ? (
|
||||
<code key={`${keyPrefix}-c${index}`}>{part}</code>
|
||||
/*
|
||||
클래스를 붙인다. 인라인 코드 스타일이 `.document-body`·`.question-options`·`.code-block`
|
||||
세 곳에 따로 있었고, 그 어디에도 속하지 않는 자리 — 문서 머리말의 요약 — 에서는 코드가
|
||||
본문과 같은 19px 민무늬로 나왔다. 이 칸은 화면 어디에나 놓이므로 자기 이름을 갖는다.
|
||||
*/
|
||||
<code className="prose-code" key={`${keyPrefix}-c${index}`}>{part}</code>
|
||||
) : (
|
||||
<Fragment key={`${keyPrefix}-t${index}`}>{part}</Fragment>
|
||||
),
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { Asset, AssetKind } from "../../../contracts/studio/contract.ts";
|
||||
import { useStudioAssetGateway } from "../use-studio.ts";
|
||||
import { AssetPicker, buildEvidenceDirective } from "./asset-picker.tsx";
|
||||
import { AssetUploadDialog } from "./asset-upload-dialog.tsx";
|
||||
import { MarkdownToolbar } from "./markdown-toolbar.tsx";
|
||||
import { FieldNotice, type FieldIssue } from "./field-issues.tsx";
|
||||
|
||||
type CaseInput = components["schemas"]["CaseInput"];
|
||||
@@ -100,7 +101,7 @@ export function CaseFields({
|
||||
<label className="studio-field"><span>검증 환경</span><textarea value={draft.environment} onChange={(event) => update({ environment: event.currentTarget.value })} /><FieldNotice issues={issues} path="/environment" /></label>
|
||||
<label className="studio-field"><span>재현 조건</span><textarea value={draft.reproduction} onChange={(event) => update({ reproduction: event.currentTarget.value })} /><FieldNotice issues={issues} path="/reproduction" /></label>
|
||||
<label className="studio-field"><span>마지막 검증일</span><input type="date" value={draft.lastVerifiedOn ?? ""} onChange={(event) => update({ lastVerifiedOn: event.currentTarget.value || null })} /><FieldNotice issues={issues} path="/lastVerifiedOn" /></label>
|
||||
<label className="studio-field studio-field--wide"><span>본문 Markdown</span><textarea ref={bodyRef} className="studio-markdown-field" value={draft.bodyMarkdown} onChange={(event) => update({ bodyMarkdown: event.currentTarget.value })} /><FieldNotice issues={issues} path="/bodyMarkdown" /></label>
|
||||
<div className="studio-field studio-field--wide"><label htmlFor="studio-field-body">본문 Markdown</label><MarkdownToolbar target={bodyRef} onInsert={(next) => update({ bodyMarkdown: next })} /><textarea id="studio-field-body" ref={bodyRef} className="studio-markdown-field" value={draft.bodyMarkdown} onChange={(event) => update({ bodyMarkdown: event.currentTarget.value })} /><FieldNotice issues={issues} path="/bodyMarkdown" /></div>
|
||||
</div>
|
||||
<div className="studio-asset-panel" role="group" aria-labelledby="studio-asset-panel-title">
|
||||
<p className="studio-eyebrow">EVIDENCE</p>
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { Asset, AssetKind } from "../../../contracts/studio/contract.ts";
|
||||
import { useStudioAssetGateway } from "../use-studio.ts";
|
||||
import { AssetPicker, buildEvidenceDirective } from "./asset-picker.tsx";
|
||||
import { AssetUploadDialog } from "./asset-upload-dialog.tsx";
|
||||
import { MarkdownToolbar } from "./markdown-toolbar.tsx";
|
||||
import { FieldNotice, type FieldIssue } from "./field-issues.tsx";
|
||||
|
||||
type ConceptInput = components["schemas"]["ConceptInput"];
|
||||
@@ -89,7 +90,7 @@ export function ConceptFields({
|
||||
<div className="studio-editor-section-heading"><p className="studio-eyebrow">CONCEPT</p><h2 id="studio-concept-fields-title">개념</h2></div>
|
||||
<div className="studio-field-grid">
|
||||
<label className="studio-field"><span>기준 버전</span><input value={draft.basisVersion} onChange={(event) => update({ basisVersion: event.currentTarget.value })} /><small>“Kubernetes 1.31” 처럼 무엇을 보고 썼는지. 비워도 됩니다.</small><FieldNotice issues={issues} path="/basisVersion" /></label>
|
||||
<label className="studio-field studio-field--wide"><span>본문 Markdown</span><textarea ref={bodyRef} className="studio-markdown-field" value={draft.bodyMarkdown} onChange={(event) => update({ bodyMarkdown: event.currentTarget.value })} /><small>“##” 소제목이 목차가 됩니다. 아키텍처 도식은 아래에서 삽입하세요.</small><FieldNotice issues={issues} path="/bodyMarkdown" /></label>
|
||||
<div className="studio-field studio-field--wide"><label htmlFor="studio-field-body">본문 Markdown</label><MarkdownToolbar target={bodyRef} onInsert={(next) => update({ bodyMarkdown: next })} /><textarea id="studio-field-body" ref={bodyRef} className="studio-markdown-field" value={draft.bodyMarkdown} onChange={(event) => update({ bodyMarkdown: event.currentTarget.value })} /><small>“##” 소제목이 목차가 됩니다. 아키텍처 도식은 아래에서 삽입하세요.</small><FieldNotice issues={issues} path="/bodyMarkdown" /></div>
|
||||
</div>
|
||||
<div className="studio-asset-panel" role="group" aria-labelledby="studio-asset-panel-title">
|
||||
<p className="studio-eyebrow">EVIDENCE</p>
|
||||
|
||||
@@ -182,7 +182,7 @@ export function DocumentList() {
|
||||
<p className="studio-eyebrow">WORKING COPIES</p>
|
||||
<h1>작업본</h1>
|
||||
<p>
|
||||
세션에 있는 Case, Reference, Question, Decision을 찾고 다음 작업으로 이동합니다.
|
||||
세션에 있는 검증 기록·동작 원리·적용 기준·열린 질문·설계 결정을 찾고 다음 작업으로 이동합니다.
|
||||
</p>
|
||||
</div>
|
||||
<GuardedStudioLink className="studio-primary-action" href="/studio/documents/new">
|
||||
|
||||
@@ -32,6 +32,8 @@ export function HomeFocusEditor() {
|
||||
const [questionId, setQuestionId] = useState("");
|
||||
const [decisionId, setDecisionId] = useState("");
|
||||
const [projectQuestions, setProjectQuestions] = useState<{ id: string; label: string }[]>([]);
|
||||
/** 고를 목록을 못 읽었다. 「없다」와 구분해야 작성자가 자기 글이 사라진 줄 알지 않는다. */
|
||||
const [choicesFailed, setChoicesFailed] = useState(false);
|
||||
const [projectDecisions, setProjectDecisions] = useState<{ id: string; label: string }[]>([]);
|
||||
const [pending, setPending] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
@@ -106,10 +108,17 @@ export function HomeFocusEditor() {
|
||||
setProjectDecisions(
|
||||
decisionList.map((item) => ({ id: item.id, label: item.statement })),
|
||||
);
|
||||
setChoicesFailed(false);
|
||||
} catch {
|
||||
/*
|
||||
못 읽은 것과 없는 것은 다르다. 예전에는 둘 다 빈 배열이 되어 화면이 「이 프로젝트에
|
||||
열린 질문이 없습니다」라고 적었고 — 실제로는 넷이 있었다 — 작성자는 자기가 아직
|
||||
쓰지 않은 줄 알게 됐다. 거짓말을 하느니 못 읽었다고 말한다.
|
||||
*/
|
||||
if (!cancelled) {
|
||||
setProjectQuestions([]);
|
||||
setProjectDecisions([]);
|
||||
setChoicesFailed(true);
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -227,7 +236,9 @@ export function HomeFocusEditor() {
|
||||
</select>
|
||||
{questions.length === 0 ? (
|
||||
<small>
|
||||
{projectId
|
||||
{choicesFailed
|
||||
? "열린 질문을 불러오지 못했습니다. 새로고침해 주세요."
|
||||
: projectId
|
||||
? "이 프로젝트에 열린 질문이 없습니다."
|
||||
: "프로젝트를 먼저 고르세요."}
|
||||
</small>
|
||||
@@ -250,7 +261,9 @@ export function HomeFocusEditor() {
|
||||
</select>
|
||||
{decisions.length === 0 ? (
|
||||
<small>
|
||||
{projectId
|
||||
{choicesFailed
|
||||
? "결정을 불러오지 못했습니다. 새로고침해 주세요."
|
||||
: projectId
|
||||
? "이 프로젝트에 결정이 없습니다."
|
||||
: "프로젝트를 먼저 고르세요."}
|
||||
</small>
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
import { type RefObject } from "react";
|
||||
|
||||
/**
|
||||
* 본문 Markdown 위의 삽입 도구.
|
||||
*
|
||||
* <p>Markdown 을 쓰려면 문법을 외우고 있어야 했다. 코드 블록과 표는 특히 그래서, 주제 화면에
|
||||
* 비교표를 두자고 정해 놓고도 그 표를 작성할 수단이 편집기에 없었다.
|
||||
*
|
||||
* <p>세 개만 둔다 — 코드·표·목록. 굵게나 기울임은 문법이 짧아 외우기 쉽고, 버튼을 늘리면 이
|
||||
* 화면의 다른 목록들처럼 반복 버튼 더미가 된다. Asset 삽입은 이미 자기 버튼을 갖고 있다.
|
||||
*/
|
||||
export type MarkdownSnippet = {
|
||||
label: string;
|
||||
/** 커서 자리에 넣을 조각. 선택한 글이 있으면 `{selection}` 자리에 들어간다. */
|
||||
template: string;
|
||||
/** 넣은 뒤 커서를 둘 자리 — 조각 안에서 이 글자를 찾아 거기에 선택을 건다. */
|
||||
placeholder?: string;
|
||||
};
|
||||
|
||||
export const MARKDOWN_SNIPPETS: ReadonlyArray<MarkdownSnippet> = [
|
||||
{
|
||||
label: "코드",
|
||||
template: "```\n{selection}\n```",
|
||||
placeholder: "{selection}",
|
||||
},
|
||||
{
|
||||
label: "표",
|
||||
// 머리글 한 줄과 본문 두 줄. 셋 이하면 표를 왜 쓰는지가 보이지 않는다.
|
||||
template: "| 구분 | 값 | 비고 |\n| --- | --- | --- |\n| | | |\n| | | |",
|
||||
},
|
||||
{
|
||||
label: "목록",
|
||||
template: "- {selection}\n- \n- ",
|
||||
placeholder: "{selection}",
|
||||
},
|
||||
];
|
||||
|
||||
/** 조각을 커서 자리에 넣는다. 앞뒤로 빈 줄을 지켜 블록이 문단에 붙지 않게 한다. */
|
||||
export function applySnippet(
|
||||
textarea: HTMLTextAreaElement,
|
||||
snippet: MarkdownSnippet,
|
||||
commit: (next: string) => void,
|
||||
) {
|
||||
const { selectionStart, selectionEnd, value } = textarea;
|
||||
const selected = value.slice(selectionStart, selectionEnd);
|
||||
const body = snippet.template.replaceAll("{selection}", selected);
|
||||
const prefix = value.slice(0, selectionStart);
|
||||
const suffix = value.slice(selectionEnd);
|
||||
const before = prefix.length === 0 || prefix.endsWith("\n\n") ? prefix : `${prefix}\n\n`;
|
||||
const after = suffix.startsWith("\n") ? suffix : `\n${suffix}`;
|
||||
const next = `${before}${body}${after}`;
|
||||
commit(next);
|
||||
|
||||
/*
|
||||
넣고 나서 커서를 조각 안으로 옮긴다. 그러지 않으면 작성자가 스크롤을 되짚어 방금 넣은
|
||||
자리를 눈으로 찾아야 한다. React 가 값을 다시 그린 뒤에 자리를 잡아야 하므로 한 틱 미룬다.
|
||||
*/
|
||||
const caret = before.length + (selected.length > 0 ? body.length : firstBlank(body));
|
||||
queueMicrotask(() => {
|
||||
textarea.focus();
|
||||
textarea.setSelectionRange(caret, caret);
|
||||
});
|
||||
}
|
||||
|
||||
/** 빈 조각을 넣었을 때 커서가 갈 자리 — 첫 빈 칸, 없으면 조각 끝. */
|
||||
function firstBlank(body: string): number {
|
||||
const cell = body.indexOf("| |");
|
||||
if (cell >= 0) return cell + 2;
|
||||
const bullet = body.indexOf("- \n");
|
||||
if (bullet >= 0) return bullet + 2;
|
||||
const fence = body.indexOf("```\n");
|
||||
return fence >= 0 ? fence + 4 : body.length;
|
||||
}
|
||||
|
||||
export function MarkdownToolbar({
|
||||
target,
|
||||
onInsert,
|
||||
}: {
|
||||
target: RefObject<HTMLTextAreaElement | null>;
|
||||
onInsert(next: string): void;
|
||||
}) {
|
||||
return (
|
||||
<div className="studio-markdown-toolbar" role="group" aria-label="Markdown 삽입">
|
||||
{MARKDOWN_SNIPPETS.map((snippet) => (
|
||||
<button
|
||||
key={snippet.label}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
const textarea = target.current;
|
||||
// 칸이 아직 붙지 않았으면 넣을 자리가 없다 — 조용히 아무것도 하지 않는다.
|
||||
if (textarea) applySnippet(textarea, snippet, onInsert);
|
||||
}}
|
||||
>
|
||||
{snippet.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,15 +1,60 @@
|
||||
import type { components } from "../../../contracts/studio/generated.ts";
|
||||
import { createNewItemId } from "../../../domain/studio/local-id.ts";
|
||||
import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
|
||||
|
||||
type CatalogEntry = components["schemas"]["CatalogEntry"];
|
||||
type RelationInput = components["schemas"]["RelationInput"];
|
||||
type RecordKind = components["schemas"]["RecordKind"];
|
||||
|
||||
function ordered(relations: RelationInput[]): RelationInput[] {
|
||||
return relations.map((relation, order) => ({ ...relation, order }));
|
||||
}
|
||||
|
||||
/**
|
||||
* 고를 수 있는 대상을 종류별로 묶는다.
|
||||
*
|
||||
* <p>평면 목록은 문서가 늘수록 나빠진다 — 25개일 때는 훑을 수 있었지만 49개가 되자 원하는 것을
|
||||
* 찾으려면 목록 전체를 읽어야 한다. 종류는 이미 카탈로그가 알려 주고 있었고 화면만 버리고 있었다.
|
||||
*
|
||||
* <p>순서는 목록 화면과 같다. 프로젝트는 기록이 아니라 그릇이므로 맨 뒤에 둔다.
|
||||
*/
|
||||
const GROUP_ORDER: ReadonlyArray<RecordKind | "PROJECT"> = [
|
||||
"CASE",
|
||||
"CONCEPT",
|
||||
"REFERENCE",
|
||||
"QUESTION",
|
||||
"PROJECT_DECISION",
|
||||
"PROJECT",
|
||||
];
|
||||
|
||||
function groupLabel(kind: RecordKind | "PROJECT"): string {
|
||||
return kind === "PROJECT" ? "프로젝트" : DOCUMENT_KIND_LABELS[kind];
|
||||
}
|
||||
|
||||
function grouped(catalog: CatalogEntry[]) {
|
||||
const buckets = new Map<string, CatalogEntry[]>();
|
||||
for (const entry of catalog) {
|
||||
// 종류를 모르는 항목도 고를 수는 있어야 한다 — 묶음 없이 맨 뒤에 남긴다.
|
||||
const key = entry.kind ?? "";
|
||||
const bucket = buckets.get(key);
|
||||
if (bucket) bucket.push(entry);
|
||||
else buckets.set(key, [entry]);
|
||||
}
|
||||
const known = GROUP_ORDER.filter((kind) => buckets.has(kind)).map((kind) => ({
|
||||
label: groupLabel(kind),
|
||||
entries: buckets.get(kind)!,
|
||||
}));
|
||||
const rest = buckets.get("") ?? [];
|
||||
return { known, rest };
|
||||
}
|
||||
|
||||
export function RelationEditor({ relations, catalog, evidence = false, onChange }: { relations: RelationInput[]; catalog: CatalogEntry[]; evidence?: boolean; onChange(relations: RelationInput[]): void }) {
|
||||
const noun = evidence ? "근거" : "관계";
|
||||
const groups = grouped(catalog);
|
||||
const taken = (index: number, id: string) =>
|
||||
relations.some(
|
||||
(candidate, candidateIndex) => candidateIndex !== index && candidate.targetId === id,
|
||||
);
|
||||
const update = (index: number, patch: Partial<RelationInput>) => onChange(ordered(relations.map((relation, candidateIndex) => candidateIndex === index ? { ...relation, ...patch } : relation)));
|
||||
const move = (index: number, delta: -1 | 1) => {
|
||||
const target = index + delta;
|
||||
@@ -24,8 +69,50 @@ export function RelationEditor({ relations, catalog, evidence = false, onChange
|
||||
{relations.length === 0 ? <p>{evidence ? "연결한 근거 기록이 없습니다." : "연결한 공개 기록이 없습니다."}</p> : null}
|
||||
{relations.map((relation, index) => (
|
||||
<div className="studio-relation-item" key={relation.id ?? `relation-${index}`}>
|
||||
<label><span>{noun} {index + 1} 대상</span><select value={relation.targetId ?? ""} onChange={(event) => update(index, { targetId: event.currentTarget.value || null })}><option value="">대상 선택</option>{catalog.map((entry) => <option key={entry.id} value={entry.id} disabled={relations.some((candidate, candidateIndex) => candidateIndex !== index && candidate.targetId === entry.id)}>{entry.label}</option>)}</select></label>
|
||||
<label><span>{noun} {index + 1} 이유</span><input value={relation.reason} onChange={(event) => update(index, { reason: event.currentTarget.value })} /></label>
|
||||
<label>
|
||||
<span>{noun} {index + 1} 대상</span>
|
||||
<select
|
||||
value={relation.targetId ?? ""}
|
||||
onChange={(event) => update(index, { targetId: event.currentTarget.value || null })}
|
||||
>
|
||||
<option value="">대상 선택</option>
|
||||
{groups.known.map((group) => (
|
||||
<optgroup key={group.label} label={group.label}>
|
||||
{group.entries.map((entry) => (
|
||||
<option key={entry.id} value={entry.id} disabled={taken(index, entry.id)}>
|
||||
{entry.label}
|
||||
</option>
|
||||
))}
|
||||
</optgroup>
|
||||
))}
|
||||
{groups.rest.map((entry) => (
|
||||
<option key={entry.id} value={entry.id} disabled={taken(index, entry.id)}>
|
||||
{entry.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
{/*
|
||||
이 문장은 이제 공개 화면의 「다음에 읽을 것」에 그대로 나간다. 한 줄 input 이던 동안
|
||||
작성자는 자기가 쓴 문장의 끝을 볼 수 없었다.
|
||||
|
||||
안내는 label 밖에 둔다 — 안에 두면 그 글까지 칸의 이름이 되어, 이름이 「관계 1 이유」가
|
||||
아니라 문장 하나가 된다. 요약 칸에서 같은 것을 이미 겪었다.
|
||||
*/}
|
||||
<div className="studio-relation-reason">
|
||||
<label htmlFor={`relation-reason-${index}`}>
|
||||
{noun} {index + 1} 이유
|
||||
</label>
|
||||
<textarea
|
||||
id={`relation-reason-${index}`}
|
||||
rows={2}
|
||||
value={relation.reason}
|
||||
onChange={(event) => update(index, { reason: event.currentTarget.value })}
|
||||
/>
|
||||
<span className="studio-char-count" aria-hidden="true">
|
||||
공개 화면의 「다음에 읽을 것」에 그대로 나갑니다.
|
||||
</span>
|
||||
</div>
|
||||
<div className="studio-item-actions"><button type="button" onClick={() => move(index, -1)} disabled={index === 0}>위로</button><button type="button" onClick={() => move(index, 1)} disabled={index === relations.length - 1}>아래로</button><button type="button" onClick={() => onChange(ordered(relations.filter((_, candidateIndex) => candidateIndex !== index)))}>삭제</button></div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -3015,3 +3015,20 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/*
|
||||
작성자가 백틱으로 적은 식별자. `ProseText` 가 놓이는 자리는 문서 머리말·판단 기준·질문·주제
|
||||
논지로 흩어져 있어, 컨테이너로 범위를 잡으면 늘 어딘가가 빠진다 — 실제로 머리말의 요약에서만
|
||||
코드가 본문과 같은 크기의 민무늬로 나왔다.
|
||||
|
||||
값은 `.document-body` 의 인라인 코드와 같게 둔다. 같은 것이 화면마다 다르게 보일 이유가 없다.
|
||||
*/
|
||||
.prose-code {
|
||||
padding: 0.08em 0.3em;
|
||||
border-radius: 4px;
|
||||
background: #ececea;
|
||||
color: #30333a;
|
||||
font-family: "IBM Plex Mono", monospace;
|
||||
font-size: 0.86em;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -237,3 +237,14 @@
|
||||
.studio-app .studio-document-status-bar__actions { gap: 12px; }
|
||||
/* 게시만 강조한다. 저장은 되돌릴 수 있으므로 같은 무게로 부를 이유가 없다. */
|
||||
.studio-app .studio-document-status-bar button:not(.studio-primary-button) { color: var(--muted); font-weight: 600; }
|
||||
|
||||
/* 관계의 이유. 요약 칸과 같은 배치다 — 라벨, 칸, 그리고 이름에 들어가지 않는 안내 한 줄. */
|
||||
.studio-app .studio-relation-reason { display: grid; gap: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
|
||||
|
||||
/*
|
||||
Markdown 삽입 도구. 버튼 셋뿐이므로 격자를 만들지 않는다 — 이 화면의 다른 반복 버튼들과 같은
|
||||
모양을 쓰되, 본문 칸 바로 위에 붙여 무엇에 작용하는지가 자리로 드러나게 한다.
|
||||
*/
|
||||
.studio-app .studio-markdown-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 6px; }
|
||||
.studio-app .studio-markdown-toolbar button { min-height: 32px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--ink-soft); font-size: 12px; font-weight: 600; cursor: pointer; }
|
||||
.studio-app .studio-markdown-toolbar button:hover { border-color: var(--signal); color: var(--signal); }
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "vitest";
|
||||
|
||||
import {
|
||||
MARKDOWN_SNIPPETS,
|
||||
applySnippet,
|
||||
} from "../../../src/features/tech-log/presentation/studio/components/markdown-toolbar.tsx";
|
||||
|
||||
/**
|
||||
* 표를 넣을 수단이 편집기에 없었다. 주제 화면에 비교표를 두자고 정해 놓고도 그 표를 작성할 방법이
|
||||
* 문법을 외우는 것뿐이었다.
|
||||
*/
|
||||
function textareaOf(value: string, start: number, end = start) {
|
||||
return {
|
||||
value,
|
||||
selectionStart: start,
|
||||
selectionEnd: end,
|
||||
focus() {},
|
||||
setSelectionRange() {},
|
||||
} as unknown as HTMLTextAreaElement;
|
||||
}
|
||||
|
||||
function snippet(label: string) {
|
||||
const found = MARKDOWN_SNIPPETS.find((entry) => entry.label === label);
|
||||
assert.ok(found, `${label} 조각이 없다`);
|
||||
return found;
|
||||
}
|
||||
|
||||
test("표 조각은 머리글과 구분선, 빈 줄 둘을 넣는다", () => {
|
||||
let next = "";
|
||||
applySnippet(textareaOf("", 0), snippet("표"), (value) => {
|
||||
next = value;
|
||||
});
|
||||
|
||||
const lines = next.trim().split("\n");
|
||||
assert.equal(lines.length, 4, "머리글 + 구분선 + 본문 둘이어야 한다");
|
||||
assert.match(lines[1]!, /^\|\s*---/u, "구분선이 없으면 Markdown 표로 읽히지 않는다");
|
||||
});
|
||||
|
||||
test("고른 글이 있으면 코드 조각이 그것을 감싼다", () => {
|
||||
let next = "";
|
||||
applySnippet(textareaOf("앞 SELECT 1 뒤", 2, 10), snippet("코드"), (value) => {
|
||||
next = value;
|
||||
});
|
||||
|
||||
assert.ok(next.includes("```\nSELECT 1\n```"), next);
|
||||
// 고른 글이 사라지면 안 된다 — 감싸는 것이지 지우는 것이 아니다.
|
||||
assert.ok(next.includes("앞") && next.includes("뒤"), next);
|
||||
});
|
||||
|
||||
/*
|
||||
블록이 앞 문단에 붙으면 Markdown 이 한 문단으로 읽는다. 빈 줄을 지키는 것이 이 함수가 하는
|
||||
일의 절반이다.
|
||||
*/
|
||||
test("앞 문단과 블록 사이에 빈 줄을 지킨다", () => {
|
||||
let next = "";
|
||||
applySnippet(textareaOf("문단", 2), snippet("목록"), (value) => {
|
||||
next = value;
|
||||
});
|
||||
|
||||
assert.ok(next.startsWith("문단\n\n- "), JSON.stringify(next));
|
||||
});
|
||||
@@ -120,7 +120,7 @@ describe("TechLog project screens", () => {
|
||||
expect(within(main).getByRole("heading", { level: 1, name: "프로젝트" })).toBeVisible();
|
||||
expect(
|
||||
within(main).getByText(
|
||||
"Case와 Reference, Question을 실제 설계 목표와 결정의 흐름으로 묶어 봅니다.",
|
||||
"검증 기록과 적용 기준, 열린 질문을 실제 설계 목표와 결정의 흐름으로 묶어 봅니다.",
|
||||
),
|
||||
).toBeVisible();
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user