docs(canvas): explain legacy document and sync state boundaries
This commit is contained in:
@@ -9,10 +9,12 @@ import type { Board } from "./workspace";
|
||||
export function readDemoBoards(workspace: string): Board[] {
|
||||
try {
|
||||
const stored = JSON.parse(localStorage.getItem("endoleap_demo_boards_" + workspace) || "null");
|
||||
// 合法空数组就是空目录,不触发样例回退;version 用 || 补默认,不验证正安全整数。
|
||||
if (Array.isArray(stored)) return stored.map((board) => ({
|
||||
...board, workspace_id: workspace, kind: "board", version: board.version || 1,
|
||||
}));
|
||||
} catch { /* Fall back to the sample pages when browser storage is invalid. */ }
|
||||
// map 中任一条目读取失败也由外围 catch 回退整份样例,不保留此前已映射的部分结果。
|
||||
return [
|
||||
{ id: "morning", title: "城市清晨" },
|
||||
{ id: "ideas", title: "灵感收集" },
|
||||
|
||||
Reference in New Issue
Block a user