feat(templates): confirm before leaving wizard with draft content

Intercept route changes and tab close when the template wizard has
unsubmitted content so users can save a draft, discard, or stay instead
of silently losing their progress.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-07 12:07:51 +08:00
parent c1e7c5e90c
commit 7443bb3260
3 changed files with 156 additions and 10 deletions
@@ -939,6 +939,13 @@ const enUS = {
queued: 'Task submitted. The article is now waiting in the generation queue.',
submitted: 'Generation task submitted. Refreshing article data.',
},
leaveConfirm: {
title: 'Save as draft?',
content: 'This template wizard has content. Save it as a draft before leaving.',
stay: 'Keep editing',
discard: 'Leave without saving',
save: 'Save draft',
},
},
},
article: {
@@ -905,6 +905,13 @@ const zhCN = {
queued: "任务已提交,正在排队生成",
submitted: "生成任务已提交,正在刷新文章列表。",
},
leaveConfirm: {
title: "是否保存为草稿?",
content: "当前模版向导已有填写内容。离开前可以保存为草稿,稍后继续编辑。",
stay: "继续编辑",
discard: "不保存离开",
save: "保存草稿",
},
},
},
article: {