fix in db and collaborate

This commit is contained in:
Mateusz Gruszczyński
2026-08-04 14:22:26 +02:00
parent 1a77ccd1bf
commit 8d58549d11
26 changed files with 3009 additions and 298 deletions
+12 -1
View File
@@ -97,6 +97,8 @@ class RoomSocket {
guest_id: this.guestId || null,
color: this.color || null,
diagnostics: this.clientDiagnostics(),
client_id: this.clientId || null,
known_revision_id: this.getKnownRevision?.() ?? null,
});
this.emitDiagnostics();
});
@@ -130,6 +132,7 @@ class RoomSocket {
return;
}
if (message.type === "document") this.onDocument?.(message);
if (message.type === "resync") this.onResync?.(message);
if (message.type === "presence") this.onPresence?.(message.users || []);
if (message.type === "chat") this.onChat?.(message);
if (message.type === "pong") {
@@ -302,7 +305,15 @@ class RoomSocket {
return true;
}
update(content, ownerMap = "[]") { this.send({ type: "update", content, owner_map: ownerMap }); }
update(baseRevisionId, updateId, operation, ownerReplacements = []) {
return this.send({
type: "update",
base_revision_id: baseRevisionId,
update_id: updateId,
operation,
owner_replacements: ownerReplacements,
});
}
chat(text) { this.send({ type: "chat", text }); }
setColor(color) { this.color = color || null; this.send({ type: "set_color", color: this.color }); }