aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/static
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-19 03:15:59 -0400
committerhistoria <[not public]>2026-09-19 03:15:59 -0400
commit0e60567a7a0addb9421769ee7be7853bfa8788cb (patch)
tree7645112db0e4eae95b8a83c1e4f9aab38bede655 /internal/admin/static
parentcc33072eced3d5460512c09c42ec4531c807d7af (diff)
downloadthehouseoficarus-0e60567a7a0addb9421769ee7be7853bfa8788cb.tar.gz
refactor: simplifcation, change how rooms are stored in player yaml, remove legacy code
Diffstat (limited to 'internal/admin/static')
-rw-r--r--internal/admin/static/map.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/internal/admin/static/map.js b/internal/admin/static/map.js
index f8cee51..4c0cae4 100644
--- a/internal/admin/static/map.js
+++ b/internal/admin/static/map.js
@@ -2056,7 +2056,26 @@ async function doSavePanel() {
var el = $('#roomName'); if (el) r.name = el.value;
el = $('#roomColor'); if (el) r.color = el.value;
- el = $('#roomDesc'); if (el && el.value) r.description = [{text: el.value}];
+ // Only rewrite description when the textarea actually changed. The
+ // textarea is populated by joining every variant, so unconditionally
+ // assigning a single variant here destroyed conditional descriptions on
+ // any unrelated panel save (rename, block_transport toggle, ...).
+ el = $('#roomDesc');
+ if (el) {
+ var origDesc = '';
+ if (Array.isArray(r.description)) {
+ origDesc = r.description.map(function(d) { return d.text || ''; }).join('\n\n');
+ } else if (typeof r.description === 'string') {
+ origDesc = r.description;
+ }
+ if (el.value !== origDesc) {
+ var hasConditional = Array.isArray(r.description) && r.description.some(function(d) { return d.condition; });
+ if (hasConditional && !confirm('This room has conditional descriptions. Saving the edited text will replace them all with one description. Continue?')) {
+ return;
+ }
+ r.description = el.value ? [{text: el.value}] : [];
+ }
+ }
el = $('#roomBlockTransport'); if (el) r.block_transport = el.checked;
if (currentRoomData && currentRoomData.room) {