From 6bd5365cc22f84c047c1585e3f54571af46f53e5 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sun, 5 Jul 2026 18:52:51 -0400 Subject: feat: renameable directories and files in admin gui --- internal/admin/static/objecteditor.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'internal/admin/static/objecteditor.js') diff --git a/internal/admin/static/objecteditor.js b/internal/admin/static/objecteditor.js index f8ef18a..5444985 100644 --- a/internal/admin/static/objecteditor.js +++ b/internal/admin/static/objecteditor.js @@ -157,7 +157,7 @@ function loadObject(id) { } function renderObjectEditor(id, data) { - var html = '

Object: ' + esc(id) + '

'; + var html = renderRenameableHeader('Object', id); html += '
'; html += '
'; @@ -729,12 +729,13 @@ function addToolRow(secID, key) { function removeToolRow(secID, key, idx) { var sec = SECTIONS.find(function(s) { return s.id === secID; }); if (!sec) return; + ced_syncDOMToData(objectData); var p = cardPath(sec); var arr = objectData[p] && objectData[p][key]; if (!arr) return; arr.splice(idx, 1); if (arr.length === 0) delete objectData[p][key]; - renderCurrent(); + renderObjectEditor(objectID, objectData); } function fetchToolTypes() { @@ -760,12 +761,13 @@ function toggleCardWidth(id) { function removeSection(id) { var sec = SECTIONS.find(function(s) { return s.id === id; }); if (!sec) return; + ced_syncDOMToData(objectData); if (sec.path) { delete objectData[sec.path]; } else if (id === 'steal') { delete objectData.steal; } - renderCurrent(); + renderObjectEditor(objectID, objectData); } function addSection() { @@ -812,9 +814,10 @@ function addArrayItem(cardID) { function removeArrayItem(cardID, idx) { var sec = SECTIONS.find(function(s) { return s.id === cardID; }); if (!sec || !sec.isArray) return; + ced_syncDOMToData(objectData); var arr = objectData[sec.path] || []; arr.splice(idx, 1); - renderCurrent(); + renderObjectEditor(objectID, objectData); } function addSubRow(cardID, subKey) { @@ -837,10 +840,11 @@ function addSubRow(cardID, subKey) { function removeSubRow(cardID, subKey, idx) { var sec = SECTIONS.find(function(s) { return s.id === cardID; }); if (!sec) return; + ced_syncDOMToData(objectData); var sectionRoot = objectData[sec.path || ''] || objectData; var arr = sectionRoot[subKey] || []; arr.splice(idx, 1); - renderCurrent(); + renderObjectEditor(objectID, objectData); } function addKVRow(cardID, subKey) { @@ -884,10 +888,11 @@ function hideUseInterField(idx, key) { window._useInterVis = window._useInterVis || {}; if (!window._useInterVis[idx]) window._useInterVis[idx] = {}; window._useInterVis[idx][key] = false; + ced_syncDOMToData(objectData); if (objectData.use_interactions && objectData.use_interactions[idx]) { objectData.use_interactions[idx][key] = ''; } - renderCurrent(); + renderObjectEditor(objectID, objectData); } function showCoreField(key) { @@ -899,6 +904,7 @@ function showCoreField(key) { function hideCoreField(key) { window._coreVis = window._coreVis || {}; window._coreVis[key] = false; + ced_syncDOMToData(objectData); if (key === 'aliases') { objectData.aliases = []; } else if (key === 'inroom_description') { @@ -906,7 +912,7 @@ function hideCoreField(key) { } else if (key === 'removal_item') { objectData.removal_item = ''; } - renderCurrent(); + renderObjectEditor(objectID, objectData); } function showGuardMob() { @@ -918,8 +924,9 @@ function showGuardMob() { function hideGuardMob() { window._stealVis = window._stealVis || {}; window._stealVis.guard_mob = false; + ced_syncDOMToData(objectData); if (objectData.steal) objectData.steal.guard_mob = ''; - renderCurrent(); + renderObjectEditor(objectID, objectData); } function toggleUseInterHelp() { -- cgit v1.2.3