fix: 批改页 J/K 按键位对调;预览换内容不再进浏览器历史,“后退”能回到作品墙
Deploy / deploy (build, debian, 22) (push) Canceled after 0s

- J 上一个、K 下一个,和面板上的左右箭头一致
- 打开的作品放进地址栏(?sub=):点开记一步历史,J/K 切换只替换,关闭 / Esc 退回那一步
- 所有会换内容的预览 iframe 加 key,换内容时换新的 iframe:在原 iframe 里改 srcdoc 是一次导航,
  会进浏览器历史,“后退”就成了在预览里倒退(批改页切换学生、挑战页改代码都会这样)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-27 09:31:29 +08:00
1 parent 75e20a3ae1
commit 0b3780e0cd
7 files changed
+50 -15

No files matched your search

+5
View File
@@ -46,6 +46,7 @@
ref="frame"
class="iframe"
:sandbox="PREVIEW_SANDBOX"
:key="frameKey"
:srcdoc="previewContent"
></iframe>
</div>
@@ -141,8 +142,12 @@ function getContent(forDownload = false) {
})
}
// 每次内容变了换一个新的 iframe:在同一个 iframe 里改 srcdoc 会进浏览器历史,
// 按“后退”就成了在预览里倒退,而不是离开页面
const frameKey = ref(0)
function preview() {
previewContent.value = getContent()
frameKey.value++
}
function download() {