feat(spreadsheet): D 잇기 — 셀 서식 창(Ctrl+1 · [서식…] 단추 · sub1)

- spreadsheet_keys.ts — Ctrl+1 자리
- spreadsheet_extras.ts — openFormatDialog 잇기 · 수식 입력줄 앞 [서식…](Ctrl+1 을 ORCA · 브라우저가 가로챌 때) · 창이 닫히면 초점을 격자로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6KXAabDTenEU7hrDQmCKY
This commit is contained in:
2026-09-27 21:17:16 +09:00
co-authored by Claude Opus 5.5
parent 0c3e4028e5
commit 73ad5c7070
2 changed files with 30 additions and 2 deletions
+24 -2
View File
@@ -1,7 +1,7 @@
/* =============================================================================
* spreadsheet_extras.ts (주인 D)
* 2단계 부품 잇기(sub1 파일들의 「잇는 법」) — 찾기 패널 · 메모 풍선(마우스 올림) · 메모 편집(Shift+F2) ·
* 서식 붓(수식 입력줄 앞 단추 · 두 번 누르면 계속 · Esc 끔) · 골라 붙여넣기(Ctrl+Shift+V → 값만 · 서식만 · 수식만) ·
* 셀 서식 창(Ctrl+1) · 서식 붓(수식 입력줄 앞 단추 · 두 번 누르면 계속 · Esc 끔) · 골라 붙여넣기(Ctrl+Shift+V → 값만 · 서식만 · 수식만) ·
* 도구 모음을 누른 뒤 초점을 격자로 되돌림 · 데이터 단추 · 메뉴는 `spreadsheet_data_menu.ts`.
* 빨간 세모는 C 격자 · 우클릭 [메모 …] 는 E 메뉴 몫(브레인 배정).
* ========================================================================== */
@@ -12,6 +12,7 @@ import { attachComments, getComment, setComment } from "./spreadsheet_comments";
import { mountDataMenu } from "./spreadsheet_data_menu";
import type { Editor } from "./spreadsheet_editor";
import { mountFindPanel } from "./spreadsheet_find_panel";
import { openFormatDialog } from "./spreadsheet_format_dialog";
import { createFormatPainter } from "./spreadsheet_format_painter";
import type { KeyHooks } from "./spreadsheet_keys";
import type { MouseHooks } from "./spreadsheet_mouse";
@@ -19,6 +20,7 @@ import { pasteSpecial, type PasteSpecialMode } from "./spreadsheet_paste_special
import type { PartHandle, SpreadsheetContext } from "./spreadsheet_view_types";
const TEXT = {
format: "셀 서식(Ctrl+1)",
painter: "서식 붓 — 한 번 누르면 한 번 · 두 번 누르면 Esc 까지 계속",
pasteTitle: "골라 붙여넣기",
modes: { 값: "값만", 서식: "서식만", 수식: "수식만" } as Record<PasteSpecialMode, string>,
@@ -107,7 +109,25 @@ export function attachExtras(
showBrush();
back();
});
if (!ctx.readOnly) ed.bar.prepend(brush);
// 셀 서식 창 — Ctrl+1 을 브라우저 · ORCA 가 가로챌 때 누를 자리
const fmt = el("button", {
className: "ss-brush",
text: "서식…",
attrs: { type: "button", title: TEXT.format },
});
/** 창이 닫히면(확인 · 취소) 초점을 격자로 */
function openFormat(): void {
if (ctx.readOnly) return;
openFormatDialog(ctx);
const watch = new MutationObserver(() => {
if (document.querySelector(".ss-fmtdlg")) return;
watch.disconnect();
back();
});
watch.observe(document.body, { childList: true });
}
fmt.addEventListener("click", openFormat);
if (!ctx.readOnly) ed.bar.prepend(fmt, brush);
// ── 데이터 단추 · 메뉴(정렬 · 필터 · 조건부 서식 · 유효성 · 이름 · 눈금선) ─────────
const data = mountDataMenu(ctx, back);
@@ -178,6 +198,7 @@ export function attachExtras(
memo.remove();
picker.remove();
brush.remove();
fmt.remove();
},
};
@@ -186,6 +207,7 @@ export function attachExtras(
find: (replace) => find.open(replace),
pasteSpecial: () => (armed = true),
comment: editMemo,
formatDialog: openFormat,
...data.keys,
escape() {
painter.clear();
@@ -41,6 +41,8 @@ export interface KeyHooks {
comment?(): void;
/** 고름 중 Esc(서식 붓 끄기 등) */
escape?(): void;
/** Ctrl+1 셀 서식 창 */
formatDialog?(): void;
/** Ctrl+Shift+L 필터 켜기 · 끄기 */
filter?(): void;
/** Alt+↓ — 필터 머리 칸이면 값 목록을 열고 true */
@@ -142,6 +144,10 @@ export function attachKeys(ctx: SpreadsheetContext, ed: Editor, hooks: KeyHooks
if (!hooks.find) return false;
hooks.find(k === "h");
return true;
case "1":
if (!hooks.formatDialog) return false;
hooks.formatDialog();
return true;
case "l":
if (!e.shiftKey || !hooks.filter) return false;
hooks.filter();