fix: 편집기에서 글을 쓸 수 있게 하고 종류 이름을 한 곳에 모은다
칸이 내용을 따라 자란다. 112px 고정이라 659자짜리 규칙 본문을 세 줄짜리 구멍으로 편집했다 — 편집기의 칸 22개 중 10개가 내용이 넘쳐 잘려 있었다. 상한을 70vh 로 두는 이유는 긴 본문 하나가 화면을 통째로 차지하면 나머지 칸으로 이동할 수 없기 때문이다. field-sizing 을 모르는 브라우저는 예전 동작 그대로다 — 나빠지지 않는다. 미리보기가 제자리에 붙는다. 폼과 같은 흐름에 놓여 있어서 편집기가 8,872px 이면 미리보기도 그만큼 아래로 흘렀고, 아래쪽 칸을 고치는 동안 미리보기는 화면 밖이었다. 한 열로 접히는 폭에서는 붙박이를 푼다 — 위아래로 쌓인 상태에서 붙이면 폼을 가린다. 종류 이름을 한 곳에 모은다. 표가 화면마다 복사되어 여섯 벌이었고 그래서 갈라졌다: 같은 QUESTION 이 공개 화면에서 "Open Question", 작업본 목록과 게시 기록에서 "Question", 편집기 상태 줄에서 "QUESTION" 이었다. 쓰는 사람은 같은 문서를 화면마다 다른 이름으로 만난다. Record<RecordKind, string> 이므로 종류가 늘면 빠진 자리를 타입이 잡는다. 미리보기는 공개 화면과 같은 렌더러를 쓰므로, 오늘 고친 문단·인라인 코드가 편집기 미리보기에도 그대로 적용된다. 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
9b7ad82fe3
commit
ca1fc92e6d
@@ -3,13 +3,7 @@ import { Link } from "react-router-dom";
|
||||
import type { PublicRecord } from "../../../application/ports/public-content-queries.ts";
|
||||
import type { components } from "../../../contracts/studio/generated.ts";
|
||||
import { ProseText } from "../../shared/public-render/prose-text.tsx";
|
||||
|
||||
const kindLabels = {
|
||||
CASE: "Case",
|
||||
REFERENCE: "Reference",
|
||||
QUESTION: "Open Question",
|
||||
CONCEPT: "개념",
|
||||
} as const;
|
||||
import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
|
||||
|
||||
export function PublicDocumentHeader({ record }: { record: PublicRecord }) {
|
||||
return (
|
||||
@@ -18,7 +12,7 @@ export function PublicDocumentHeader({ record }: { record: PublicRecord }) {
|
||||
<Link
|
||||
to={`/explore/${record.kind === "CASE" ? "cases" : record.kind === "REFERENCE" ? "references" : "questions"}`}
|
||||
>
|
||||
{kindLabels[record.kind]}
|
||||
{DOCUMENT_KIND_LABELS[record.kind]}
|
||||
</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
{/*
|
||||
@@ -39,7 +33,7 @@ export function PublicDocumentHeader({ record }: { record: PublicRecord }) {
|
||||
<dl>
|
||||
<div>
|
||||
<dt>유형</dt>
|
||||
<dd>{kindLabels[record.kind]}</dd>
|
||||
<dd>{DOCUMENT_KIND_LABELS[record.kind]}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>프로젝트</dt>
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import type { PublicRecord } from "../../../application/ports/public-content-queries.ts";
|
||||
|
||||
const kindLabels = {
|
||||
CASE: "Case",
|
||||
REFERENCE: "Reference",
|
||||
QUESTION: "Open Question",
|
||||
CONCEPT: "개념",
|
||||
} as const;
|
||||
import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
|
||||
|
||||
export function PublicRecordList({
|
||||
records,
|
||||
@@ -25,7 +19,7 @@ export function PublicRecordList({
|
||||
{records.map((record) => (
|
||||
<li key={record.path}>
|
||||
<Link to={record.path}>
|
||||
<span className="record-kind">{kindLabels[record.kind]}</span>
|
||||
<span className="record-kind">{DOCUMENT_KIND_LABELS[record.kind]}</span>
|
||||
<div>
|
||||
<strong>{record.title}</strong>
|
||||
<p>{record.summary}</p>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import type { components } from "../../contracts/studio/generated.ts";
|
||||
|
||||
type RecordKind = components["schemas"]["RecordKind"];
|
||||
|
||||
/**
|
||||
* 문서 종류를 사람에게 보여 주는 이름.
|
||||
*
|
||||
* <p>이 표는 화면마다 하나씩 복사되어 있었고, 그래서 갈라졌다. 같은 `QUESTION` 이 공개 화면에서는
|
||||
* "Open Question", 작업본 목록과 게시 기록에서는 "Question", 편집기 상태 줄에서는 "QUESTION" 으로
|
||||
* 나왔다 — 여섯 벌 중 네 가지 표기였다. 쓰는 사람은 같은 문서를 화면마다 다른 이름으로 만난다.
|
||||
*
|
||||
* <p>한 곳에 두면 다음에 종류가 늘어날 때도 한 번만 고친다. 종류를 더하면 이 표가 비어 있는 것을
|
||||
* 타입이 잡는다 — `Record<RecordKind, string>` 이므로 빠진 종류가 있으면 컴파일되지 않는다.
|
||||
*/
|
||||
export const DOCUMENT_KIND_LABELS: Record<RecordKind, string> = {
|
||||
CASE: "Case",
|
||||
REFERENCE: "Reference",
|
||||
QUESTION: "Open Question",
|
||||
CONCEPT: "개념",
|
||||
PROJECT_DECISION: "Decision",
|
||||
};
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
PublicDocumentRelations,
|
||||
type PublicRelation,
|
||||
} from "./public-document-relations.tsx";
|
||||
import { DOCUMENT_KIND_LABELS } from "../document-kind-labels.ts";
|
||||
|
||||
type PublicRenderModel = components["schemas"]["PublicRenderModel"];
|
||||
type PublicRenderModelBase = components["schemas"]["PublicRenderModelBase"];
|
||||
@@ -31,14 +32,6 @@ type RenderDependencies = {
|
||||
resolvePublishedLabel: ResolvePublishedLabel;
|
||||
};
|
||||
|
||||
const kindLabels = {
|
||||
CASE: "Case",
|
||||
REFERENCE: "Reference",
|
||||
QUESTION: "Open Question",
|
||||
CONCEPT: "개념",
|
||||
PROJECT_DECISION: "Decision",
|
||||
} as const;
|
||||
|
||||
function assertNever(value: never): never {
|
||||
throw new Error(`Unsupported Public render model: ${JSON.stringify(value)}`);
|
||||
}
|
||||
@@ -84,7 +77,7 @@ function ModelDocumentHeader({
|
||||
return (
|
||||
<header className="public-document-header">
|
||||
<nav aria-label="문서 경로">
|
||||
<Link to={explorePath(model.kind)}>{kindLabels[model.kind]}</Link>
|
||||
<Link to={explorePath(model.kind)}>{DOCUMENT_KIND_LABELS[model.kind]}</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
<TargetLink target={model.topic} />
|
||||
{model.project ? (
|
||||
@@ -99,7 +92,7 @@ function ModelDocumentHeader({
|
||||
<dl>
|
||||
<div>
|
||||
<dt>유형</dt>
|
||||
<dd>{kindLabels[model.kind]}</dd>
|
||||
<dd>{DOCUMENT_KIND_LABELS[model.kind]}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>프로젝트</dt>
|
||||
|
||||
@@ -6,14 +6,8 @@ import { managementFailureMessage } from "../../../application/ports/management-
|
||||
import { useStudio } from "../use-studio.ts";
|
||||
import { GuardedStudioLink } from "./guarded-studio-link.tsx";
|
||||
import { StudioPagination } from "./studio-pagination.tsx";
|
||||
import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
|
||||
|
||||
const kindLabel = {
|
||||
CASE: "Case",
|
||||
REFERENCE: "Reference",
|
||||
QUESTION: "Question",
|
||||
CONCEPT: "개념",
|
||||
PROJECT_DECISION: "Decision",
|
||||
} as const;
|
||||
const publicationLabel = {
|
||||
NEVER_PUBLISHED: "게시 전",
|
||||
PUBLISHED: "게시 중",
|
||||
@@ -261,7 +255,7 @@ export function DocumentList() {
|
||||
<div className="studio-document-list">
|
||||
{page.items.map((item) => (
|
||||
<article className="studio-document-row" key={item.id}>
|
||||
<p className="studio-row-label">{kindLabel[item.kind]}</p>
|
||||
<p className="studio-row-label">{DOCUMENT_KIND_LABELS[item.kind]}</p>
|
||||
<div className="studio-document-title">
|
||||
<h2>
|
||||
<GuardedStudioLink href={`/studio/documents/${item.id}/edit`}>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { DocumentEditorController } from "./document-editor-controller.ts";
|
||||
import type { FieldIssue } from "./field-issues.tsx";
|
||||
import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
|
||||
|
||||
const labels = {
|
||||
CLEAN: "저장됨",
|
||||
@@ -8,14 +9,6 @@ const labels = {
|
||||
CONFLICT: "저장 충돌",
|
||||
} as const;
|
||||
|
||||
const kindLabels = {
|
||||
CASE: "CASE",
|
||||
REFERENCE: "REFERENCE",
|
||||
QUESTION: "QUESTION",
|
||||
CONCEPT: "CONCEPT",
|
||||
PROJECT_DECISION: "Decision",
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* 작업 상태와 저장·게시를 화면 아래에 고정한다.
|
||||
*
|
||||
@@ -43,7 +36,7 @@ export function DocumentStatusBar({
|
||||
<aside className="studio-document-status-bar" aria-labelledby="studio-document-status-title">
|
||||
<h2 id="studio-document-status-title" className="studio-visually-hidden">작업 상태</h2>
|
||||
<p className={`studio-editor-status studio-editor-status--${controller.status.toLowerCase()}`} role="status" aria-label="편집 상태">{labels[controller.status]}</p>
|
||||
<dl><div><dt>저장 버전</dt><dd>{controller.saved.version}</dd></div><div><dt>종류</dt><dd>{kindLabels[controller.draft.kind]}</dd></div></dl>
|
||||
<dl><div><dt>저장 버전</dt><dd>{controller.saved.version}</dd></div><div><dt>종류</dt><dd>{DOCUMENT_KIND_LABELS[controller.draft.kind]}</dd></div></dl>
|
||||
{/*
|
||||
경고는 하나만 띄운다. 충돌은 그 자체로 무엇을 해야 하는지 말해 주므로 서버가 준 문구보다
|
||||
앞서고, 그 밖의 실패는 서버가 준 이유를 그대로 보여 준다. 둘을 함께 띄우면 같은 실패를
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
import { UnpublishDialog } from "./unpublish-dialog.tsx";
|
||||
import { useStudio } from "../use-studio.ts";
|
||||
import { StudioPagination } from "./studio-pagination.tsx";
|
||||
import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
|
||||
|
||||
const eventLabels = {
|
||||
PUBLISHED: "게시",
|
||||
@@ -25,14 +26,6 @@ const eventLabels = {
|
||||
UNPUBLISHED: "게시 취소",
|
||||
} as const;
|
||||
|
||||
const kindLabels = {
|
||||
CASE: "Case",
|
||||
REFERENCE: "Reference",
|
||||
QUESTION: "Question",
|
||||
CONCEPT: "개념",
|
||||
PROJECT_DECISION: "Decision",
|
||||
} as const;
|
||||
|
||||
function dateTime(value: string) {
|
||||
return new Intl.DateTimeFormat("ko-KR", {
|
||||
dateStyle: "medium",
|
||||
@@ -234,7 +227,7 @@ export function PublicationList({
|
||||
</p>
|
||||
<div className={styles.eventMain}>
|
||||
<p className={styles.kind}>
|
||||
{kindLabels[item.document.kind]} · v
|
||||
{DOCUMENT_KIND_LABELS[item.document.kind]} · v
|
||||
{item.event.publishedVersion}
|
||||
</p>
|
||||
<h2>{item.document.title || "제목 없는 작업본"}</h2>
|
||||
|
||||
@@ -5,16 +5,10 @@ import type { components } from "../../../contracts/studio/generated.ts";
|
||||
import { useStudio } from "../use-studio.ts";
|
||||
import { GuardedStudioLink } from "./guarded-studio-link.tsx";
|
||||
import { HomeFocusEditor } from "./home-focus-editor.tsx";
|
||||
import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
|
||||
|
||||
type DocumentSummary = components["schemas"]["DocumentSummary"];
|
||||
|
||||
const kindLabel = {
|
||||
CASE: "Case",
|
||||
REFERENCE: "Reference",
|
||||
QUESTION: "Question",
|
||||
CONCEPT: "개념",
|
||||
PROJECT_DECISION: "Decision",
|
||||
} as const;
|
||||
const actionLabel = {
|
||||
CONTINUE_EDITING: "작성 계속",
|
||||
VALIDATE: "검증하기",
|
||||
@@ -27,7 +21,7 @@ const actionLabel = {
|
||||
function WorkRow({ item }: Readonly<{ item: DocumentSummary }>) {
|
||||
return (
|
||||
<article className="studio-work-row">
|
||||
<p className="studio-row-label">{kindLabel[item.kind]}</p>
|
||||
<p className="studio-row-label">{DOCUMENT_KIND_LABELS[item.kind]}</p>
|
||||
<div>
|
||||
<h3>
|
||||
<GuardedStudioLink href={`/studio/documents/${item.id}/edit`}>
|
||||
|
||||
@@ -28,7 +28,12 @@
|
||||
/* 반쪽 폭에는 62px 짜리 제목이 앉을 자리가 없다. */
|
||||
.studio-app .studio-editor-split .studio-editor-heading h1 { font-size: clamp(28px, 3vw, 40px); }
|
||||
|
||||
.studio-app .studio-editor-preview { display: flex; flex-direction: column; padding-left: 40px; border-left: 1px solid var(--line); }
|
||||
/*
|
||||
미리보기는 제자리에 붙어 따라온다. 예전에는 폼과 같은 흐름에 나란히 놓여 있어서, 편집기가
|
||||
8,872px 이면 미리보기도 그만큼 아래로 흘렀다 — 아래쪽 칸을 고치는 동안 미리보기는 화면 밖이었다.
|
||||
`align-self: start` 가 없으면 격자가 칸을 늘려 버려 붙박이가 걸리지 않는다.
|
||||
*/
|
||||
.studio-app .studio-editor-preview { position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 48px); overflow-y: auto; display: flex; flex-direction: column; padding-left: 40px; border-left: 1px solid var(--line); }
|
||||
.studio-app .studio-editor-preview__heading { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
|
||||
.studio-app .studio-editor-preview__heading .studio-eyebrow { margin-bottom: 8px; }
|
||||
.studio-app .studio-editor-preview__body { padding-top: 20px; }
|
||||
@@ -54,8 +59,15 @@
|
||||
.studio-app .studio-ordered-item textarea,
|
||||
.studio-app .studio-relation-item input,
|
||||
.studio-app .studio-relation-item select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--paper); color: var(--ink); font: inherit; font-size: 15px; font-weight: 450; line-height: 1.55; }
|
||||
/*
|
||||
칸이 내용을 따라 자란다. 예전에는 112px 에 고정이라 659자짜리 규칙 본문을 세 줄짜리 구멍으로
|
||||
편집했다 — 편집기의 칸 22개 중 10개가 내용이 넘쳐 잘려 있었다. 상한을 두는 이유는 긴 본문
|
||||
하나가 화면을 통째로 차지하면 나머지 칸으로 이동할 수 없기 때문이다.
|
||||
|
||||
`field-sizing` 을 모르는 브라우저에서는 예전처럼 112px 에 스크롤이다 — 나빠지지는 않는다.
|
||||
*/
|
||||
.studio-app .studio-field textarea,
|
||||
.studio-app .studio-ordered-item textarea { min-height: 112px; resize: vertical; }
|
||||
.studio-app .studio-ordered-item textarea { min-height: 112px; max-height: 70vh; field-sizing: content; resize: vertical; }
|
||||
.studio-app .studio-field .studio-markdown-field { min-height: 420px; font-family: "IBM Plex Mono", monospace; font-size: 13px; }
|
||||
|
||||
/* 칸 아래 한 줄 설명. 라벨과 같은 격자 안에 들어가므로 별도 여백을 두지 않는다. */
|
||||
@@ -163,7 +175,7 @@
|
||||
@media (max-width: 1024px) {
|
||||
.studio-app .studio-editor-split { grid-template-columns: minmax(0, 1fr); gap: 40px; }
|
||||
.studio-app .studio-editor-split .studio-editor-heading h1 { font-size: clamp(38px, 5vw, 62px); }
|
||||
.studio-app .studio-editor-preview { padding-top: 8px; padding-left: 0; border-top: 1px solid var(--line-strong); border-left: 0; }
|
||||
.studio-app .studio-editor-preview { position: static; max-height: none; overflow-y: visible; padding-top: 8px; padding-left: 0; border-top: 1px solid var(--line-strong); border-left: 0; }
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
|
||||
@@ -103,8 +103,13 @@ describe("TechLog Studio document editor", () => {
|
||||
expect(screen.getByRole("status", { name: "편집 상태" })).toHaveTextContent(
|
||||
"저장되지 않음",
|
||||
);
|
||||
/*
|
||||
종류 이름은 모든 화면이 같은 표를 본다. 예전에는 화면마다 표를 복사해 두어 같은 문서가
|
||||
편집기에서 "CASE", 목록에서 "Case", 공개 화면에서 "Case" 로 갈렸다 — QUESTION 은 네
|
||||
가지 표기까지 났다.
|
||||
*/
|
||||
expect(screen.getByRole("complementary", { name: "작업 상태" })).toHaveTextContent(
|
||||
"저장 버전4종류CASE",
|
||||
"저장 버전4종류Case",
|
||||
);
|
||||
// 작성자가 밟는 단계는 저장과 게시 둘뿐이다. 예전에는 검증 → 미리보기 → 게시 세 화면을
|
||||
// 차례로 거쳐야 했는데, 그 셋은 백엔드가 게시 요청에 요구하는 값을 만들기 위한 것이지
|
||||
|
||||
Reference in New Issue
Block a user