Skip to content

Commit 9585209

Browse files
committed
fix locations when their room is deleted
1 parent ba7d80c commit 9585209

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/scripts/editor/editor.js

+7
Original file line numberDiff line numberDiff line change
@@ -2355,6 +2355,13 @@ class BipsiEditor extends EventTarget {
23552355
return this.stateManager.makeChange(async (data) => {
23562356
const { room } = this.getSelections(data);
23572357
arrayDiscard(data.rooms, room);
2358+
2359+
// replace location references to this room
2360+
const fallback = data.rooms[0].id;
2361+
allEvents(data)
2362+
.flatMap((event) => event.fields)
2363+
.filter((field) => field.type === "location" && field.data.room === room.id)
2364+
.forEach((field) => field.data.room = fallback);
23582365
});
23592366
}
23602367

0 commit comments

Comments
 (0)