feat: 편집기 미리보기 폭, 관계 대상 거르기, 좁은 화면 여백, 마감
미리보기가 늘 좁은 칸에 갇혀 있었다. 공개 화면은 1,180px 셸인데 그 칸은 절반도 안 되므로, 작성자가 보던 것은 공개 화면이 아니라 좁은 화면용 배치였다 — 데스크톱에서 어떻게 보이는지는 게시한 뒤에야 알 수 있었다. 나란히·넓게·숨김과 데스크톱·모바일 폭을 고를 수 있게 한다. 관계 대상이 105개다. 평면 셀렉트에서 그것을 이름으로 찾으려면 목록 전체를 눈으로 훑어야 하고, 종류로 묶어도 한 묶음이 마흔이 넘으면 마찬가지다 — 셀렉트는 열어 둔 채 타이핑으로 걸러지지 않는다. 거르는 칸을 위에 둔다. 이미 고른 대상은 걸러도 남긴다: 사라지면 그 줄이 무엇을 가리키는지 읽을 수 없다. 게시 화면이 어느 주소로 나가는지 말하지 않았다. 게시는 공개 주소 하나를 만들거나 갈아 끼우는 일이고, 작성자가 확인하고 싶은 것도 그 주소다. Studio 의 좁은 화면 좌우 여백이 16px 이라 글이 테두리에 붙었다. 공개 화면과 같은 20px 로 맞춘다. hover 는 120ms 로 색만 옮긴다. 자리를 옮기는 전환은 목록에서 줄이 흔들려 보인다. 움직임을 줄이라고 한 사람에게는 기존 `prefers-reduced-motion` 블록이 0 으로 만든다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015c8cBFUaVr7KLVUx6ujz7D
This commit is contained in:
co-authored by
Claude Opus 5
parent
ae6da7156e
commit
86a35fcc8e
@@ -1,3 +1,5 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import type { components } from "../../../contracts/studio/generated.ts";
|
||||
import { usePreviewScrollSync } from "./use-preview-scroll-sync.ts";
|
||||
import { EditorSectionToc } from "./editor-section-toc.tsx";
|
||||
@@ -74,6 +76,12 @@ export function DocumentEditor({
|
||||
|| controller.draft.kind === "SETUP",
|
||||
);
|
||||
const unplaced = issuesOutside(issues, [...COMMON_FIELD_PATHS, ...kindPaths]);
|
||||
/*
|
||||
미리보기를 어떻게 볼지. 「넓게」는 편집 칸을 잠시 접어 공개 화면과 같은 폭으로 보여 준다 —
|
||||
좁은 칸에 갇힌 미리보기는 공개 화면이 아니라 좁은 화면용 배치를 보여 주고 있었다.
|
||||
*/
|
||||
const [previewMode, setPreviewMode] = useState<"split" | "full" | "hidden">("split");
|
||||
const [previewWidth, setPreviewWidth] = useState<"desktop" | "mobile">("desktop");
|
||||
|
||||
/*
|
||||
편집과 미리보기를 한 화면에 나란히 둔다. 예전에는 탭이었고, 고친 것이 어떻게 보이는지
|
||||
@@ -85,11 +93,12 @@ export function DocumentEditor({
|
||||
*/
|
||||
return (
|
||||
<div className="studio-editor-page">
|
||||
<div className="studio-editor-split">
|
||||
<div className="studio-editor-split" data-preview={previewMode}>
|
||||
<section
|
||||
id="studio-editor-workspace"
|
||||
className="studio-editor-workspace"
|
||||
aria-labelledby="studio-edit-title"
|
||||
hidden={previewMode === "full"}
|
||||
>
|
||||
<header className="studio-editor-heading">
|
||||
<p className="studio-eyebrow">{controller.draft.kind} · VERSION {controller.saved.version}</p>
|
||||
@@ -118,12 +127,60 @@ export function DocumentEditor({
|
||||
미리보기는 편집 칸보다 훨씬 짧을 수도, 길 수도 있다. 그대로 두면 본문을 스크롤하는
|
||||
동안 화면 밖으로 나가 버리므로 붙잡아 두고 자기 높이 안에서 따로 스크롤한다.
|
||||
*/}
|
||||
<section className="studio-editor-preview" aria-labelledby="studio-preview-title">
|
||||
<section
|
||||
className="studio-editor-preview"
|
||||
aria-labelledby="studio-preview-title"
|
||||
hidden={previewMode === "hidden"}
|
||||
>
|
||||
<header className="studio-editor-preview__heading">
|
||||
<p className="studio-eyebrow">LIVE</p>
|
||||
<h2 id="studio-preview-title">즉시 미리보기</h2>
|
||||
{/*
|
||||
미리보기가 늘 좁은 칸에 갇혀 있었다. 공개 화면은 1,180px 셸인데 이 칸은 그 절반도
|
||||
안 되므로, 작성자가 보는 것은 <em>공개 화면</em>이 아니라 좁은 화면용 배치였다 —
|
||||
데스크톱에서 어떻게 보이는지는 게시한 뒤에야 알 수 있었다.
|
||||
*/}
|
||||
<div className="studio-preview-modes" role="group" aria-label="미리보기 보기 방식">
|
||||
{(
|
||||
[
|
||||
["split", "나란히"],
|
||||
["full", "넓게"],
|
||||
["hidden", "숨김"],
|
||||
] as const
|
||||
).map(([mode, label]) => (
|
||||
<button
|
||||
key={mode}
|
||||
type="button"
|
||||
aria-pressed={previewMode === mode}
|
||||
onClick={() => setPreviewMode(mode)}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="studio-preview-modes" role="group" aria-label="미리보기 폭">
|
||||
{(
|
||||
[
|
||||
["desktop", "데스크톱"],
|
||||
["mobile", "모바일"],
|
||||
] as const
|
||||
).map(([width, label]) => (
|
||||
<button
|
||||
key={width}
|
||||
type="button"
|
||||
aria-pressed={previewWidth === width}
|
||||
onClick={() => setPreviewWidth(width)}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</header>
|
||||
<div id="studio-editor-preview-body" className="studio-editor-preview__body">
|
||||
<div
|
||||
id="studio-editor-preview-body"
|
||||
className="studio-editor-preview__body"
|
||||
data-width={previewWidth}
|
||||
>
|
||||
<InstantPreview draft={controller.draft} catalog={catalog} assets={assets} />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -10,6 +10,7 @@ const publicationFlowClassContract = {
|
||||
gateReady: "studio-publication-gate-ready",
|
||||
summary: "studio-publication-summary",
|
||||
changeSummary: "studio-publication-change-summary",
|
||||
publicPath: "studio-publication-public-path",
|
||||
publishAction: "studio-publication-action",
|
||||
blocked: "studio-publication-blocked",
|
||||
noWarnings: "studio-publication-no-warnings",
|
||||
|
||||
@@ -335,6 +335,16 @@ export function PublishScreen({
|
||||
? `게시 버전 v${currentPublication.publishedVersion}에서 저장 버전 v${document.version}으로 반영합니다.`
|
||||
: `저장 버전 v${document.version}을 처음 게시합니다.`}
|
||||
</p>
|
||||
{/*
|
||||
어느 주소로 나가는지. 「저장 버전 v5 를 반영합니다」만으로는 이 동작이 무엇을 바꾸는지
|
||||
알 수 없다 — 게시는 공개 주소 하나를 만들거나 갈아 끼우는 일이고, 작성자가 확인하고
|
||||
싶은 것도 그 주소다.
|
||||
*/}
|
||||
{currentPublication?.publicPath ? (
|
||||
<p className={styles.publicPath}>
|
||||
공개 주소 <code>{currentPublication.publicPath}</code>
|
||||
</p>
|
||||
) : null}
|
||||
{preview ? (
|
||||
<p>
|
||||
Preview 만료:{" "}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { useState } from "react";
|
||||
|
||||
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";
|
||||
@@ -50,7 +52,23 @@ function grouped(catalog: CatalogEntry[]) {
|
||||
|
||||
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);
|
||||
/*
|
||||
고를 것이 105개다. 평면 셀렉트에서 그것을 이름으로 찾으려면 목록 전체를 눈으로 훑어야 하고,
|
||||
종류로 묶어 두어도 한 묶음이 마흔이 넘으면 훑기는 마찬가지다 — 셀렉트는 열어 둔 채 타이핑으로
|
||||
걸러지지 않는다.
|
||||
|
||||
그래서 거르는 칸을 위에 둔다. 적은 말이 들어간 것만 셀렉트에 남긴다. 이미 고른 대상은 걸러도
|
||||
남긴다 — 걸러서 사라지면 그 줄이 무엇을 가리키는지 화면에서 읽을 수 없게 된다.
|
||||
*/
|
||||
const [filter, setFilter] = useState("");
|
||||
const needle = filter.trim().toLowerCase();
|
||||
const chosen = new Set(relations.map((relation) => relation.targetId).filter(Boolean));
|
||||
const visible = needle
|
||||
? catalog.filter(
|
||||
(entry) => entry.label.toLowerCase().includes(needle) || chosen.has(entry.id),
|
||||
)
|
||||
: catalog;
|
||||
const groups = grouped(visible);
|
||||
const taken = (index: number, id: string) =>
|
||||
relations.some(
|
||||
(candidate, candidateIndex) => candidateIndex !== index && candidate.targetId === id,
|
||||
@@ -66,6 +84,20 @@ export function RelationEditor({ relations, catalog, evidence = false, onChange
|
||||
return (
|
||||
<fieldset className="studio-ordered-list">
|
||||
<legend>{evidence ? "근거 기록" : "관계"}</legend>
|
||||
<label className="studio-relation-filter">
|
||||
<span>대상 거르기</span>
|
||||
<input
|
||||
type="search"
|
||||
value={filter}
|
||||
placeholder="제목의 일부를 적으세요"
|
||||
onChange={(event) => setFilter(event.currentTarget.value)}
|
||||
/>
|
||||
<small>
|
||||
{needle
|
||||
? `${visible.length}개가 남았습니다 (전체 ${catalog.length}개)`
|
||||
: `고를 수 있는 대상 ${catalog.length}개`}
|
||||
</small>
|
||||
</label>
|
||||
{relations.length === 0 ? <p>{evidence ? "연결한 근거 기록이 없습니다." : "연결한 공개 기록이 없습니다."}</p> : null}
|
||||
{relations.map((relation, index) => (
|
||||
<div className="studio-relation-item" key={relation.id ?? `relation-${index}`}>
|
||||
|
||||
@@ -3920,3 +3920,25 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
|
||||
.search-group .search-page-results {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* 마감 — hover 가 의도로 읽히게 한다 */
|
||||
|
||||
/*
|
||||
색이 즉시 튀면 눌린 것처럼 보이고, 너무 느리면 반응이 없는 것처럼 보인다. 120ms 는 그 사이다.
|
||||
움직임을 줄이라고 한 사람에게는 위의 `prefers-reduced-motion` 블록이 이 시간을 0 으로 만든다.
|
||||
|
||||
색만 옮긴다. 자리를 옮기는 전환은 목록에서 줄이 흔들려 보이므로 넣지 않는다.
|
||||
*/
|
||||
a,
|
||||
button,
|
||||
summary {
|
||||
transition:
|
||||
color 120ms ease,
|
||||
background-color 120ms ease,
|
||||
border-color 120ms ease;
|
||||
}
|
||||
|
||||
/* 손잡이는 누를 수 있다는 것이 보여야 한다. */
|
||||
summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -579,3 +579,13 @@
|
||||
padding: 24px 20px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 게시가 만드는(또는 갈아 끼우는) 공개 주소 */
|
||||
|
||||
.publicPath code {
|
||||
padding: 2px 7px;
|
||||
border-radius: 4px;
|
||||
background: var(--canvas);
|
||||
font-family: "IBM Plex Mono", monospace;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@@ -281,3 +281,20 @@
|
||||
.studio-app .studio-ordered-item .studio-item-actions { grid-column: 2; }
|
||||
/* 순서 바꾸기는 이 행의 목적이 아니다 — 글자 크기로 그렇게 말한다. */
|
||||
.studio-app .studio-ordered-item .studio-item-actions button { font-size: 12px; font-weight: 500; }
|
||||
|
||||
/* 미리보기 보기 방식 — 좁은 칸에 갇힌 미리보기는 공개 화면이 아니다 */
|
||||
.studio-app .studio-preview-modes { display: inline-flex; gap: 2px; margin-left: 14px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; }
|
||||
.studio-app .studio-preview-modes button { min-height: 28px; padding-inline: 10px; border: 0; border-radius: 4px; background: none; color: var(--muted); font-size: 12px; }
|
||||
.studio-app .studio-preview-modes button[aria-pressed="true"] { background: var(--canvas); color: var(--ink); font-weight: 640; }
|
||||
.studio-app .studio-editor-split[data-preview="full"] { grid-template-columns: minmax(0, 1fr); }
|
||||
.studio-app .studio-editor-split[data-preview="hidden"] { grid-template-columns: minmax(0, 1fr); }
|
||||
/*
|
||||
모바일 폭은 실제 좁은 화면의 폭(390px)으로 잘라 본다. 줄여 그리지 않고 그 폭 그대로 두어야
|
||||
줄바꿈과 접힘이 배포본과 같아진다.
|
||||
*/
|
||||
.studio-app .studio-editor-preview__body[data-width="mobile"] > * { max-width: 390px; margin-inline: auto; }
|
||||
|
||||
/* 관계 대상 거르기 — 105개를 평면 셀렉트에서 이름으로 찾을 수는 없다 */
|
||||
.studio-app .studio-relation-filter { display: grid; gap: 5px; margin-bottom: 18px; }
|
||||
.studio-app .studio-relation-filter > span { color: var(--muted); font-size: 12px; font-weight: 640; }
|
||||
.studio-app .studio-relation-filter > small { color: var(--faint); font-size: 12px; }
|
||||
|
||||
@@ -193,9 +193,10 @@
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
/* 좁은 화면의 좌우 여백은 20px 이다. 공개 화면과 같은 값을 쓴다 — 16px 은 글이 테두리에 붙는다. */
|
||||
.studio-app .studio-header-inner,
|
||||
.studio-app .studio-mobile-navigation,
|
||||
.studio-app .studio-main { width: min(100% - 32px, 1180px); }
|
||||
.studio-app .studio-main { width: min(100% - 40px, 1180px); }
|
||||
.studio-app .studio-header-inner { min-height: 68px; gap: 16px; }
|
||||
.studio-app .studio-desktop-navigation { display: none; }
|
||||
.studio-app .studio-menu-trigger { display: inline-flex; align-items: center; }
|
||||
@@ -487,3 +488,12 @@
|
||||
.studio-app .asset-detail-facts dd { margin: 0; color: var(--ink-soft); font-size: 14px; }
|
||||
.studio-app .asset-detail-facts code { font-family: "IBM Plex Mono", monospace; font-size: 12px; }
|
||||
.studio-app .asset-detail-usage-title { margin: 24px 0 10px; font-size: 13px; font-weight: 650; }
|
||||
|
||||
/* 불러오는 동안의 자리. 빈 화면이 깜빡이는 대신 목록이 올 자리를 미리 잡는다. */
|
||||
.studio-app .studio-loading { color: var(--muted); font-size: 15px; }
|
||||
.studio-app .studio-loading::after { content: ""; display: inline-block; width: 28px; height: 1px; margin-left: 10px; background: var(--line-strong); vertical-align: middle; animation: studio-loading-sweep 1.1s ease-in-out infinite; }
|
||||
|
||||
@keyframes studio-loading-sweep {
|
||||
0%, 100% { opacity: 0.25; }
|
||||
50% { opacity: 1; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user