feat(canvas): 画布同步 - 新增操作事务、预演保存与并发恢复能力

This commit is contained in:
ddcat666
2026-10-11 22:19:20 +08:00
parent 6dedc5973c
commit 5f359f2b1d
63 changed files with 3235 additions and 6193 deletions

View File

@@ -58,8 +58,19 @@ func cloudAgentNodeSnapshotMatches(doc map[string]any, nodeID, snapshotHash stri
func cloudAgentCanvasHash(doc map[string]any) string {
content := make(map[string]any, len(doc))
for key, value := range doc {
if key != "viewport" && key != "updatedAt" {
content[key] = value
switch key {
case "id", "viewport", "updatedAt", "revision", "createdAt":
continue
case "title", "projectId":
if text, ok := value.(string); ok && strings.TrimSpace(text) == "" {
continue
}
}
content[key] = value
}
for _, key := range []string{"nodes", "connections"} {
if value, exists := content[key]; !exists || value == nil {
content[key] = []any{}
}
}
return creationHash(content)