- 教程 / 挑战编辑器“新建”时序号没有加 1(?? 的优先级),而保存按序号更新, 新建后保存会覆盖列表里最后一个任务 - 预览的 localStorage 作用域改由页面传入任务 id;自由创作页用的是局部 taskId, 之前读全局 taskId 会把数据存到上一个打开过的任务名下 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ffdfbc2513
commit
e47fac1732
6 files changed
+9
-10
No files matched your search
@@ -67,7 +67,6 @@ import {
|
||||
listenPreviewStorage,
|
||||
loadPreviewStorage,
|
||||
} from "../../utils/previewStorage"
|
||||
import { taskId } from "../../store/task"
|
||||
import { user } from "../../store/user"
|
||||
|
||||
interface Props {
|
||||
@@ -78,8 +77,8 @@ interface Props {
|
||||
submissionId?: string
|
||||
showCodeButton?: boolean
|
||||
clearable?: boolean
|
||||
// 自己的编辑器:代码里的 localStorage 按“用户 + 任务”存下来,刷新后还在
|
||||
persistStorage?: boolean
|
||||
// 自己的编辑器传当前任务 id:代码里的 localStorage 按“用户 + 任务”存下来,刷新后还在
|
||||
storageTaskId?: number
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
@@ -129,7 +128,7 @@ const previewContent = ref("")
|
||||
|
||||
const frame = useTemplateRef<HTMLIFrameElement>("frame")
|
||||
const storageScope = () =>
|
||||
props.persistStorage && taskId.value ? `${user.username}:${taskId.value}` : ""
|
||||
props.storageTaskId ? `${user.username}:${props.storageTaskId}` : ""
|
||||
|
||||
function getContent(forDownload = false) {
|
||||
const scope = storageScope()
|
||||
|
||||
Reference in new issue
Block a user