Merge remote-tracking branch 'origin/dev' into sub_laptop_7
# Conflicts: # M02_MasterTemplete/M02_MasterTemplete_UI_Side.ts
This commit is contained in:
@@ -95,7 +95,12 @@ export function canEdit(layer: Layer, isAdmin: boolean): boolean {
|
||||
return layer === "project" || layer === "personal" || (layer === "system" && isAdmin);
|
||||
}
|
||||
|
||||
export function createMain(isAdmin: boolean, onSaved?: () => void): MainHandle {
|
||||
/** `onOpened` — 무엇을 열든(좌측 · 카드 [도면 수정] · 다시 읽기) 연 바로 뒤 부름(좌측 고름 표시) */
|
||||
export function createMain(
|
||||
isAdmin: boolean,
|
||||
onSaved?: () => void,
|
||||
onOpened?: () => void,
|
||||
): MainHandle {
|
||||
const title = el("h2", { className: "m02-main__title", text: L("M02_PickTemplate") });
|
||||
const reload = createButton({ label: L("M02_Reload"), variant: "ghost" });
|
||||
const save = createButton({ label: L("M02_Save"), variant: "filled" });
|
||||
@@ -136,7 +141,13 @@ export function createMain(isAdmin: boolean, onSaved?: () => void): MainHandle {
|
||||
window.addEventListener("beforeunload", guard);
|
||||
const confirmLeave = async (): Promise<boolean> => {
|
||||
if (!dirty) return true;
|
||||
if (!(await showConfirmDialog(L("M02_DiscardConfirm")))) return false;
|
||||
if (!(await showConfirmDialog(L("M02_DiscardConfirm")))) {
|
||||
// 취소 — 초점을 시트(고른 칸 입력 자리) · 집계표 · 도면으로 돌려 키보드 그대로
|
||||
host
|
||||
.querySelector<HTMLElement>(".ss-input, .ui-sheet, iframe")
|
||||
?.focus({ preventScroll: true });
|
||||
return false;
|
||||
}
|
||||
dirty = false;
|
||||
return true;
|
||||
};
|
||||
@@ -359,6 +370,7 @@ export function createMain(isAdmin: boolean, onSaved?: () => void): MainHandle {
|
||||
drop();
|
||||
showNotice([]);
|
||||
sel = next;
|
||||
onOpened?.();
|
||||
bar();
|
||||
if (!next) {
|
||||
title.textContent = L("M02_PickTemplate");
|
||||
@@ -437,6 +449,7 @@ export function createMain(isAdmin: boolean, onSaved?: () => void): MainHandle {
|
||||
drop();
|
||||
showNotice([]);
|
||||
sel = null;
|
||||
onOpened?.(); // 좌측 양식 · 열 줄 고름 지움
|
||||
bar();
|
||||
title.textContent = label;
|
||||
host.replaceChildren(node);
|
||||
|
||||
Reference in New Issue
Block a user