Skip to content

Commit

Permalink
fix locations when their room is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragzouken committed May 30, 2024
1 parent ba7d80c commit 9585209
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/scripts/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2355,6 +2355,13 @@ class BipsiEditor extends EventTarget {
return this.stateManager.makeChange(async (data) => {
const { room } = this.getSelections(data);
arrayDiscard(data.rooms, room);

// replace location references to this room
const fallback = data.rooms[0].id;
allEvents(data)
.flatMap((event) => event.fields)
.filter((field) => field.type === "location" && field.data.room === room.id)
.forEach((field) => field.data.room = fallback);
});
}

Expand Down

0 comments on commit 9585209

Please sign in to comment.