fix: 요약이 문장 중간에서 멈추지 않게 하고 남은 자리를 보여 준다
요약 칸이 300자에서 말없이 입력을 멈췄다. 아무 표시가 없어 키보드가 고장 난 것처럼 보인다. 계약 상한을 600 으로 올리고(입력·공개 렌더 모델 함께) 칸 아래에 `412 / 600` 을 둔다. 한계에 닿으면 붉게 바뀐다. 글자 수는 label 밖에 둔다. 안에 두면 label 의 글자가 모두 칸의 이름이 되어 이름이 "요약 412 / 600" 으로 타자마다 바뀐다 — 기존 테스트 둘이 실제로 그것을 잡아냈다. 읽어 주는 것은 한계에 닿는 순간뿐이다. 글자마다 세어 읽으면 받아쓰기가 된다. 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
df371d38bd
commit
8fce8ea69c
@@ -38,28 +38,28 @@
|
||||
},
|
||||
"contractSet": {
|
||||
"setAlgorithm": "CA_CONTRACT_SET_V1",
|
||||
"setDigest": "sha256:e1b17dd429c6eae9c735cfae0383827b57cc557f5300ece8e691c9178d0e4ba1",
|
||||
"setDigest": "sha256:54e2295eb185cb608fcbe5c8557e0d4f436d8f83bd200e632f7b20e47b9b76d9",
|
||||
"packages": [
|
||||
{
|
||||
"packageId": "@tech-log/management-contract",
|
||||
"version": "1.0.0",
|
||||
"digest": "sha256:762aa81e6906469939fddd833c204ed3ca53f0fa96371f18a5ea1edaf76a64e8",
|
||||
"runtimeProtocolVersion": 1,
|
||||
"sourceRevision": "d445555"
|
||||
"sourceRevision": "617eb6a"
|
||||
},
|
||||
{
|
||||
"packageId": "@tech-log/public-contract",
|
||||
"version": "2.1.0",
|
||||
"digest": "sha256:afe415880eb5d6289ae10abf493333c97270c323c16a7245a466d4db4466e630",
|
||||
"runtimeProtocolVersion": 1,
|
||||
"sourceRevision": "d445555"
|
||||
"sourceRevision": "617eb6a"
|
||||
},
|
||||
{
|
||||
"packageId": "@tech-log/studio-contract",
|
||||
"version": "3.1.0",
|
||||
"digest": "sha256:1732dd7749aea49a41d2ef17dfe9896a73e10b1b97d7d0223b3ac530500816f3",
|
||||
"digest": "sha256:2236a17064a81ae7e0c358fbc0756c8d89a5bdd7a2dfba36efffae0a448624b1",
|
||||
"runtimeProtocolVersion": 1,
|
||||
"sourceRevision": "d445555"
|
||||
"sourceRevision": "617eb6a"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"packageId": "@tech-log/management-contract",
|
||||
"version": "1.0.0",
|
||||
"digest": "sha256:762aa81e6906469939fddd833c204ed3ca53f0fa96371f18a5ea1edaf76a64e8",
|
||||
"sourceRevision": "d445555",
|
||||
"sourceRevision": "617eb6a",
|
||||
"operationIds": [
|
||||
"createCaseDraft",
|
||||
"getCaseForEdit",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"packageId": "@tech-log/public-contract",
|
||||
"version": "2.1.0",
|
||||
"digest": "sha256:afe415880eb5d6289ae10abf493333c97270c323c16a7245a466d4db4466e630",
|
||||
"sourceRevision": "d445555",
|
||||
"sourceRevision": "617eb6a",
|
||||
"operationIds": [
|
||||
"getPublicSite",
|
||||
"getPublicHome",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"packageId": "@tech-log/studio-contract",
|
||||
"version": "3.1.0",
|
||||
"digest": "sha256:1732dd7749aea49a41d2ef17dfe9896a73e10b1b97d7d0223b3ac530500816f3",
|
||||
"sourceRevision": "d445555",
|
||||
"digest": "sha256:2236a17064a81ae7e0c358fbc0756c8d89a5bdd7a2dfba36efffae0a448624b1",
|
||||
"sourceRevision": "617eb6a",
|
||||
"operationIds": [
|
||||
"getStudioSession",
|
||||
"getStudioDashboard",
|
||||
|
||||
@@ -917,7 +917,7 @@ components:
|
||||
oneOf:
|
||||
- { type: string, const: "" }
|
||||
- { type: string, minLength: 3, maxLength: 100, pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$" }
|
||||
summary: { type: string, maxLength: 300 }
|
||||
summary: { type: string, maxLength: 600 }
|
||||
topicId: { type: [string, "null"], format: uuid }
|
||||
projectId:
|
||||
type: [string, "null"]
|
||||
@@ -1280,7 +1280,7 @@ components:
|
||||
kind: { $ref: "#/components/schemas/RecordKind" }
|
||||
slug: { type: string, minLength: 3, maxLength: 100, pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$" }
|
||||
title: { type: string, minLength: 1, maxLength: 120 }
|
||||
summary: { type: string, maxLength: 300 }
|
||||
summary: { type: string, maxLength: 600 }
|
||||
publicPath: { type: string, minLength: 1, maxLength: 500 }
|
||||
topic: { $ref: "#/components/schemas/DisplayTarget" }
|
||||
project:
|
||||
|
||||
@@ -5,6 +5,12 @@ import { RelationEditor } from "./relation-editor.tsx";
|
||||
|
||||
type CatalogEntry = components["schemas"]["CatalogEntry"];
|
||||
|
||||
/**
|
||||
* 요약이 들어갈 수 있는 최대 길이. 계약 `WorkingCopyInputBase.summary` 와 같은 값이어야 한다 —
|
||||
* 여기가 더 크면 다 쓰고 나서 저장할 때 거절당하고, 더 작으면 쓸 수 있는 자리를 못 쓴다.
|
||||
*/
|
||||
const SUMMARY_MAX = 600;
|
||||
|
||||
/** 이 화면이 자기 칸 아래에 보여 줄 수 있는 경로. 나머지는 게시 버튼 옆에 남는다. */
|
||||
export const COMMON_FIELD_PATHS = [
|
||||
"/title",
|
||||
@@ -37,10 +43,22 @@ export function CommonDocumentFields({
|
||||
<div className="studio-field-grid">
|
||||
<label className="studio-field studio-field--wide"><span>제목</span><input value={draft.title} maxLength={120} onChange={(event) => onUpdate({ title: event.currentTarget.value })} /><FieldNotice issues={issues} path="/title" /></label>
|
||||
<label className="studio-field"><span>slug</span><input value={draft.slug} maxLength={100} placeholder="비우면 제목에서 만듭니다 (영문 소문자·숫자·하이픈)" onChange={(event) => onUpdate({ slug: event.currentTarget.value as WorkingCopyInput["slug"] })} /><FieldNotice issues={issues} path="/slug" /></label>
|
||||
<label className="studio-field studio-field--wide"><span>요약</span><textarea value={draft.summary} maxLength={300} onChange={(event) => onUpdate({ summary: event.currentTarget.value })} /><FieldNotice issues={issues} path="/summary" /></label>
|
||||
{/*
|
||||
요약만 label 로 감싸지 않고 htmlFor 로 잇는다. 감싸면 label 안의 글자가 모두 칸의
|
||||
이름이 되어 "요약 412 / 600" 처럼 타자마다 이름이 바뀐다 — 이름은 「요약」로 두고
|
||||
남은 자리는 그 옆에 따로 보여 준다.
|
||||
*/}
|
||||
<div className="studio-field studio-field--wide"><label htmlFor="studio-field-summary">요약</label><textarea id="studio-field-summary" value={draft.summary} maxLength={SUMMARY_MAX} onChange={(event) => onUpdate({ summary: event.currentTarget.value })} /><span className="studio-char-count" aria-hidden="true" data-full={draft.summary.length >= SUMMARY_MAX ? "" : undefined}>{draft.summary.length} / {SUMMARY_MAX}</span><FieldNotice issues={issues} path="/summary" /></div>
|
||||
<label className="studio-field"><span>Topic</span><select value={draft.topicId ?? ""} onChange={(event) => onUpdate({ topicId: event.currentTarget.value || null })}><option value="">선택하지 않음</option>{topics.map((entry) => <option key={entry.id} value={entry.id}>{entry.label}</option>)}</select><FieldNotice issues={issues} path="/topicId" /></label>
|
||||
<label className="studio-field"><span>Project</span><select value={draft.projectId ?? ""} onChange={(event) => onUpdate({ projectId: event.currentTarget.value || null })}><option value="">미지정</option>{projects.map((entry) => <option key={entry.id} value={entry.id}>{entry.label}</option>)}</select><FieldNotice issues={issues} path="/projectId" /></label>
|
||||
</div>
|
||||
{/*
|
||||
보조 기술에는 글자마다 세어 읽어 줄 수 없다 — 받아쓰기가 된다. 한계에 닿는 순간만 알린다.
|
||||
label 밖에 두는 이유는 안에 두면 요약 칸의 이름이 이 문장까지 포함하게 되기 때문이다.
|
||||
*/}
|
||||
<p role="status" className="studio-visually-hidden">
|
||||
{draft.summary.length >= SUMMARY_MAX ? `요약을 ${SUMMARY_MAX}자까지 모두 썼습니다. 더 입력되지 않습니다.` : ""}
|
||||
</p>
|
||||
<RelationEditor evidence={draft.kind === "PROJECT_DECISION"} relations={draft.relations} catalog={relations} onChange={(next) => onUpdate({ relations: next })} />
|
||||
<FieldNotice issues={issues} path="/relations" />
|
||||
</section>
|
||||
|
||||
@@ -207,6 +207,9 @@
|
||||
`.studio-field` 는 세로 흐름이므로 별도의 배치가 필요 없다 — 입력 바로 다음 줄에 놓인다.
|
||||
*/
|
||||
.studio-app .studio-field-notice { display: block; margin-top: 6px; font-size: 12px; line-height: 1.5; }
|
||||
/* 남은 자리를 보여 주는 표시. 쓰는 데 방해되지 않게 옅게, 한계에 닿으면 눈에 띄게. */
|
||||
.studio-app .studio-char-count { justify-self: end; margin-top: -2px; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
|
||||
.studio-app .studio-char-count[data-full] { color: var(--danger, #b4232a); font-weight: 650; }
|
||||
.studio-app .studio-field-notice--error { color: var(--danger, #b4232a); }
|
||||
.studio-app .studio-field-notice--warning { color: var(--muted); }
|
||||
.studio-app .studio-editor-unplaced-issues { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
|
||||
|
||||
@@ -38,7 +38,9 @@ function renderEditor(
|
||||
function labelsIn(container: HTMLElement, selector: string): string[] {
|
||||
return Array.from(
|
||||
container.querySelectorAll<HTMLElement>(selector),
|
||||
(label) => label.querySelector(":scope > span")?.textContent ?? "",
|
||||
// 칸 이름은 보통 `<label><span>이름</span>` 이지만, 요약처럼 label 을 htmlFor 로 잇는
|
||||
// 칸도 있다 — 두 모양 다 같은 이름 목록에 실려야 순서를 볼 수 있다.
|
||||
(field) => field.querySelector(":scope > span, :scope > label")?.textContent ?? "",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -236,6 +238,31 @@ describe("TechLog Studio document editor", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("shows how much of the summary limit is left and keeps that limit at the contract's", async () => {
|
||||
renderEditor(FIXTURE_IDS.edgeTokenQuestion);
|
||||
|
||||
const summary = await screen.findByLabelText("요약");
|
||||
/*
|
||||
계약 WorkingCopyInputBase.summary 와 같은 값이어야 한다. 300 이던 시절 이 칸은 문장
|
||||
중간에서 말없이 입력을 멈췄고, 쓰는 사람에게는 키보드가 고장 난 것처럼 보였다.
|
||||
*/
|
||||
expect(summary).toHaveAttribute("maxlength", "600");
|
||||
|
||||
fireEvent.change(summary, { target: { value: "가".repeat(412) } });
|
||||
expect(screen.getByText("412 / 600")).toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByText(/600자까지 모두 썼습니다/),
|
||||
).not.toBeInTheDocument();
|
||||
|
||||
fireEvent.change(summary, { target: { value: "가".repeat(600) } });
|
||||
expect(screen.getByText("600 / 600")).toBeInTheDocument();
|
||||
// 한계에 닿았을 때만 알린다 — 글자마다 읽어 주면 받아쓰기가 된다.
|
||||
expect(screen.getByText(/600자까지 모두 썼습니다/)).toBeInTheDocument();
|
||||
|
||||
// 글자 수는 칸의 이름에 섞이지 않아야 한다. 섞이면 이름이 타자마다 바뀐다.
|
||||
expect(screen.getByLabelText("요약")).toBe(summary);
|
||||
});
|
||||
|
||||
it("renders source not-found and retry surfaces for document loading", async () => {
|
||||
const unknown = renderEditor("aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa");
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user