fix(spreadsheet): 메뉴 동작 뒤 초점 격자로 · 펼친 하위 메뉴가 화면 밖이면 올림(81-3)
- keepGridFocus — 항목을 누른 뒤 초점이 문서로 빠지면 격자 입력칸으로(Ctrl+Z 등 키가 바로 먹음) - ui_template_context_menu — 하위(▸)를 펼칠 때도 화면 안으로 당김(fit 한 곳) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UoSr2sqvYtBf1dtQdus88s
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
colMoreItems,
|
||||
copyCut,
|
||||
copyOnlyItems,
|
||||
keepGridFocus,
|
||||
pasteItems,
|
||||
rowInsertItems,
|
||||
rowMoreItems,
|
||||
@@ -44,6 +45,7 @@ export function attachMenu(ctx: SpreadsheetContext): PartHandle {
|
||||
|
||||
const menu = createMapContextMenu("ss");
|
||||
ctx.root.append(menu.element);
|
||||
keepGridFocus(ctx, menu.element); // 메뉴 동작 뒤 Ctrl+Z 등 키가 격자로
|
||||
ctx.cellMenuExtra ??= () => []; // 칸 메뉴 있음 — 조건 만들기가 이 끝에 붙음
|
||||
|
||||
function isMerged(range: CellRange): boolean {
|
||||
|
||||
@@ -83,6 +83,18 @@ function back(ctx: SpreadsheetContext): void {
|
||||
(ctx.editor as Editor).focus?.();
|
||||
}
|
||||
|
||||
/** 항목을 누른 뒤 초점이 문서(body)에 떨어졌으면 격자로 — 창을 띄운 동작은 그 창이 초점을 가짐 */
|
||||
export function keepGridFocus(ctx: SpreadsheetContext, menuRoot: HTMLElement): void {
|
||||
menuRoot.addEventListener(
|
||||
"click",
|
||||
() =>
|
||||
setTimeout(() => {
|
||||
if (document.activeElement === document.body) back(ctx);
|
||||
}),
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
/** 잘라내기 · 복사 — 초점을 격자로 되돌린 뒤 불러야 부품의 copy · cut 듣기가 받음(빈 복사 막음) */
|
||||
export function copyCut(ctx: SpreadsheetContext, kind: "cut" | "copy"): void {
|
||||
back(ctx);
|
||||
|
||||
Reference in New Issue
Block a user