aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/static
diff options
context:
space:
mode:
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) {