fix(M02): 병합에서 빠진 CAD 호스트 생성 · 💾 저장 통로를 도면 부품에 되살림
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PxvYb5ufV1kWdBvZbpDfu6
This commit is contained in:
@@ -170,6 +170,25 @@ export function mountDrawingTemplate(
|
||||
showToast(error instanceof Error ? error.message : "자리표 목록을 받지 못했습니다.", "error"),
|
||||
);
|
||||
|
||||
// CAD 안 💾 · Ctrl+S — 양식 파일은 페이지 [저장] 만 쓴다. 저장 중 또 눌러도 한 번만 부른다.
|
||||
let saving = false;
|
||||
const hostSave = (): void => {
|
||||
if (readOnly) return void showToast("이 양식은 볼 수만 있습니다.", "info");
|
||||
if (saving || !options.onSave) return;
|
||||
saving = true;
|
||||
getDoc()
|
||||
.then((next) => options.onSave?.(next))
|
||||
.catch((error) =>
|
||||
showToast(error instanceof Error ? error.message : "양식을 저장하지 못했습니다.", "error"),
|
||||
)
|
||||
.finally(() => (saving = false));
|
||||
};
|
||||
|
||||
const cad = createCadHost<DrawingTemplateDoc>({
|
||||
title: "도면 양식",
|
||||
onChanged: (dirty) => options.onChanged?.(dirty),
|
||||
onHostSave: hostSave,
|
||||
});
|
||||
const load = (drawing: DrawingTemplateDoc): void => {
|
||||
cad.beginLoading();
|
||||
cad.load(
|
||||
|
||||
Reference in New Issue
Block a user