aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/static/objecteditor.js
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-05 18:52:51 -0400
committerhistoria <[not public]>2026-07-05 18:52:51 -0400
commit6bd5365cc22f84c047c1585e3f54571af46f53e5 (patch)
tree72df0934c72baa1e31817d7db999832c6efb115f /internal/admin/static/objecteditor.js
parent9b54188970c51070d86f4c87e909ea7836c86f07 (diff)
downloadthehouseoficarus-6bd5365cc22f84c047c1585e3f54571af46f53e5.tar.gz
feat: renameable directories and files in admin gui
Diffstat (limited to 'internal/admin/static/objecteditor.js')
-rw-r--r--internal/admin/static/objecteditor.js23
1 files changed, 15 insertions, 8 deletions
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 = '<h2>Object: ' + esc(id) + '</h2>';
+ var html = renderRenameableHeader('Object', id);
html += '<div class="tabs"><button class="tab active" onclick="switchTab(event,\'fields\')">Fields</button>';
html += '<button class="tab" onclick="switchTab(event,\'yaml\')">Raw YAML</button></div>';
@@ -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() {