From 0e60567a7a0addb9421769ee7be7853bfa8788cb Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sat, 19 Sep 2026 03:15:59 -0400 Subject: refactor: simplifcation, change how rooms are stored in player yaml, remove legacy code --- internal/admin/static/map.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'internal/admin/static') 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) { -- cgit v1.2.3