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/itemeditor.js | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
(limited to 'internal/admin/static/itemeditor.js')
diff --git a/internal/admin/static/itemeditor.js b/internal/admin/static/itemeditor.js
index 5ffb0cb..ac76f94 100644
--- a/internal/admin/static/itemeditor.js
+++ b/internal/admin/static/itemeditor.js
@@ -174,7 +174,7 @@ function loadItemEditor(id) {
}
function renderItemEditor(id, data) {
- var html = '
Item: ' + esc(id) + '
';
+ var html = renderRenameableHeader('Item', id);
html += '';
html += '
';
@@ -460,8 +460,9 @@ function addEquipBlock(blockKey) {
}
function removeEquipBlock(blockKey) {
+ ced_syncDOMToData(itemData);
if (itemData.equipment) delete itemData.equipment[blockKey];
- renderCurrent();
+ renderItemEditor(itemID, itemData);
}
// =========================================================================
@@ -902,6 +903,7 @@ function toggleCardWidth(id) {
function removeSection(id) {
var sec = SECTIONS.find(function(s) { return s.id === id; });
if (!sec) return;
+ ced_syncDOMToData(itemData);
if (sec.path) {
delete itemData[sec.path];
} else {
@@ -910,7 +912,7 @@ function removeSection(id) {
if (sec.subtables) sec.subtables.forEach(function(st) { delete itemData[st.key]; });
}
delete addedSections[id];
- renderCurrent();
+ renderItemEditor(itemID, itemData);
}
function addSection() {
@@ -952,9 +954,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(itemData);
var arr = itemData[sec.path] || [];
arr.splice(idx, 1);
- renderCurrent();
+ renderItemEditor(itemID, itemData);
}
// =========================================================================
@@ -991,6 +994,7 @@ function addSubRow(cardID, subKey) {
function removeSubRow(cardID, subKey, idx) {
var sec = SECTIONS.find(function(s) { return s.id === cardID; });
if (!sec) return;
+ ced_syncDOMToData(itemData);
var p = cardPath(sec);
var sectionRoot = p ? (itemData[p] || {}) : itemData;
var raw = sectionRoot[subKey];
@@ -1004,7 +1008,7 @@ function removeSubRow(cardID, subKey, idx) {
}
arr.splice(idx, 1);
sectionRoot[subKey] = arr;
- renderCurrent();
+ renderItemEditor(itemID, itemData);
}
// =========================================================================
@@ -1044,13 +1048,14 @@ function addSubSubRow(cardID, subKey, rowIdx, subSubKey) {
function removeSubSubRow(cardID, subKey, rowIdx, subSubKey, subSubIdx) {
var sec = SECTIONS.find(function(s) { return s.id === cardID; });
if (!sec) return;
+ ced_syncDOMToData(itemData);
var p = cardPath(sec);
var sectionRoot = p ? (itemData[p] || {}) : itemData;
var arr = sectionRoot[subKey] || [];
if (rowIdx >= arr.length) return;
var subArr = arr[rowIdx][subSubKey] || [];
subArr.splice(subSubIdx, 1);
- renderCurrent();
+ renderItemEditor(itemID, itemData);
}
// =========================================================================
--
cgit v1.2.3