feat(spreadsheet): 도구 모음 단위 기호 골라 넣기

- [단위 ▾] 단추 → 자주 쓰는 기호 판(넓이·부피·길이 · 무게·부피(액체) · 개수 ·
  속도·각도·비율 · 연산·비교로 무리 지음) · 최근 쓴 것 앞(localStorage, 최대 8개)
- 누르면 편집 중이면 커서 자리에 끼워 넣고(D 편집기 textarea 캐럿 위치) · 아니면
  고른 칸 글 끝에 붙임(ctx.dispatch 라 되돌리기 짝 그대로)
- 체크박스로 「숫자 형식으로 붙이기」 고르면 값은 그대로 두고 형식만
  0"㎡" 처럼 단위를 붙임(기존 형식 끝 따옴표 단위는 새 것으로 교체)
- e_harness.ts 에 편집 중 커서 갈래를 시험할 숨은 textarea + __setEditing 시험
  전용 걸이 더함
- ORCA 실 엔진 확인 — 칸 글 끝 붙이기(터파기 계산서 → …㎡) · 형식 붙이기(12.5 값
  그대로 · 형식 0"㎡") · 편집 중 커서 자리 끼우기(f|oo → fkgoo, 캐럿 이동) · 최근
  목록 순서·중복 제거(개 본 개 식 → 식·개·본) 모두 확인

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeeQRLknEpP4SFjVkjDWDs
This commit is contained in:
2026-09-28 12:08:26 +09:00
co-authored by Claude Sonnet 5
parent e010f72505
commit 74b6937bc0
4 changed files with 178 additions and 2 deletions
+22 -2
View File
@@ -75,7 +75,9 @@ const grid: GridHandle = {
destroy() {},
};
function applyAndRefresh(command: import("../../../A00_Common/spreadsheet/spreadsheet_types").Command): void {
function applyAndRefresh(
command: import("../../../A00_Common/spreadsheet/spreadsheet_types").Command,
): void {
const effect = applyCommand(book, command);
if (effect.rebuild) engine.rebuild(book);
else engine.update(effect.cells);
@@ -126,7 +128,7 @@ const ctx: SpreadsheetContext = {
},
grid,
editor: {
editing: () => false,
editing: () => editingFlag,
begin() {},
commit() {},
cancel() {},
@@ -134,6 +136,24 @@ const ctx: SpreadsheetContext = {
},
};
// 단위 기호 [편집 중이면 커서 자리에] 갈래 시험용 — 진짜 D 편집기 대신 숨은 textarea 하나로 흉내.
let editingFlag = false;
const fakeEditorTa = document.createElement("textarea");
fakeEditorTa.id = "fake-editor-ta";
root.append(fakeEditorTa);
(window as unknown as { __setEditing: (on: boolean, value?: string) => void }).__setEditing = (
on,
value,
) => {
editingFlag = on;
if (on) {
if (value !== undefined) fakeEditorTa.value = value;
fakeEditorTa.focus();
} else {
fakeEditorTa.blur();
}
};
const toolbar = mountToolbar(ctx);
const tabs = mountTabs(ctx);
attachMenu(ctx);