fix(spreadsheet): D 편집기 — 틀린 식(인자 수 등)은 Enter 로 확정하지 않음
- 확정 때 = 로 시작하면 parseFormula(sub3 a3434e3c) — 실패면 편집 유지 · 오류 알림 · 커서를 오류 자리로(엑셀처럼)
- M02 [스프레드시트 시험] ORCA: =SUM() Enter 막힘 · 「SUM 인수가 너무 적음(1 개부터)」 알림 · =SUM(1,2) → 3
- 크기 시험 통과(화면 28,613 B) · D 규칙 시험 9 통과
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6KXAabDTenEU7hrDQmCKY
This commit is contained in:
@@ -13,7 +13,7 @@ import { moveFormula } from "./spreadsheet_refshift";
|
||||
import { colName, parseA1, parseRange, rangeToA1, toA1 } from "./spreadsheet_address";
|
||||
import { funcHelp, suggestFunctions, type FuncHelp } from "./spreadsheet_func_help";
|
||||
import { defineName, resolveName } from "./spreadsheet_names";
|
||||
import { tokenize } from "./spreadsheet_parser";
|
||||
import { parseFormula, tokenize } from "./spreadsheet_parser";
|
||||
import { cellsOf, move, selectCell } from "./spreadsheet_selection";
|
||||
import { checkValue, findValidation } from "./spreadsheet_validation";
|
||||
import type { Cell, CellAddress, CellStyle, Sheet } from "./spreadsheet_types";
|
||||
@@ -356,9 +356,19 @@ export function createEditor(ctx: SpreadsheetContext): Editor {
|
||||
focus();
|
||||
}
|
||||
|
||||
/** 칸에 적음 — 유효성(sub4) 「막음」 을 어기면 안 적고 false(편집 그대로 · 엑셀처럼 다시 치게) */
|
||||
/** 칸에 적음 — 식이 틀렸거나(인자 수 등) 유효성(sub4) 「막음」 을 어기면 안 적고 false(편집 그대로 · 엑셀처럼 다시 치게) */
|
||||
function write(cells: CellAddress[], value: string, from: CellAddress): boolean {
|
||||
if (!st) return true;
|
||||
const parsed = value.length > 1 && value[0] === "=" ? parseFormula(value) : null;
|
||||
if (parsed && !parsed.ok) {
|
||||
showToast(parsed.message, "error");
|
||||
const node = src();
|
||||
const at = Math.min(parsed.at + 1, node.value.length);
|
||||
st.mode = "edit"; // 방향키가 글자 사이를 움직이게
|
||||
st.point = null;
|
||||
node.setSelectionRange(at, at);
|
||||
return false;
|
||||
}
|
||||
const sheet = sheetOf(st.sheet);
|
||||
const out: Record<string, Cell | null> = {};
|
||||
const warn = new Set<string>();
|
||||
|
||||
Reference in New Issue
Block a user