Merge remote-tracking branches 'origin/sub_laptop_7' and 'origin/sub_laptop_8' into sub_laptop_2

This commit is contained in:
2026-10-08 13:38:03 +09:00
4 changed files with 31 additions and 9 deletions
@@ -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);