fix: JSON-Editor-Refactor aufgeraeumt, Farb-Flip konsistent gezogen

- web/index.html: Orphan-Fragmente aus halb ersetztem createJsonEditUI
  entfernt (drei Stellen: vor createTextEditUI, doppelte
  Funktionsdeklaration, Reste nach Funktionsende). JS parst wieder
  (node --check OK).
- web/index.html: Inline-Styles der JSON-Editor-Inputs auf das dunkle
  Schema (#222/#fff) angeglichen, das in CSS bereits gesetzt war.
- web/serve.py: nicht genutzte self.path-Zuweisung entfernt.

Verifiziert gegen laufenden Server: /, /index.html, /templates.json,
/templates/system/commit_analysis.json, /templates/user/brainstorming.md
jeweils 200. Eine createJsonEditUI-Deklaration, 0 helle / 4 dunkle
Input-Styles, keine Orphans mehr.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michael 2026-04-24 15:55:25 +02:00
parent 8effb63a40
commit f9e239098a
2 changed files with 44 additions and 26 deletions

View file

@ -92,8 +92,8 @@
#edit-content-content textarea,
#edit-modal input,
#edit-modal textarea {
background: #ffffff;
color: #222222; /* Dunkelgrau mit ausreichendem Kontrast gegen weiß (8.6:1) */
background: #222222;
color: #ffffff; /* Weiß auf Dunkelgrau (#222222) */
border: 1px solid #cccccc;
border-radius: 4px;
padding: 8px;
@ -605,39 +605,59 @@ $ python web/serve.py</div>
const isObject = typeof value === 'object' && value !== null;
const isArray = Array.isArray(value);
const label = document.createElement('label');
label.htmlFor = `edit-${fullKey.replace(/[.\s]/g, '-')}`;
label.textContent = fullKey + (isObject ? ' (Objekt) ♦' : isArray ? ' (Array) ♦' : '');
label.style.cssText = 'font-weight: 600; color: var(--text-primary); margin-bottom: 4px; font-size: 14px; margin-top: 8px;';
formDiv.appendChild(label);
if (isObject && !isArray) {
const label = document.createElement('label');
label.htmlFor = `edit-${fullKey.replace(/[.\s]/g, '-')}`;
label.textContent = fullKey + ' (Objekt) ♦';
label.style.cssText = 'font-weight: 600; color: var(--text-primary); margin-bottom: 4px; font-size: 14px; margin-top: 8px;';
formDiv.appendChild(label);
const input = document.createElement('textarea');
input.value = JSON.stringify(value, null, 2);
input.dataset.key = fullKey;
input.rows = Object.keys(value).length > 10 ? 10 : Object.keys(value).length;
input.style.cssText = 'width: 100%; padding: 8px; background: #ffffff; color: #222222; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px; resize: vertical;';
input.style.cssText = 'width: 100%; padding: 8px; background: #222222; color: #ffffff; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px; resize: vertical;';
formDiv.appendChild(input);
} else if (isArray) {
return;
}
if (isArray) {
const label = document.createElement('label');
label.htmlFor = `edit-${fullKey.replace(/[.\s]/g, '-')}`;
label.textContent = fullKey + ' (Array) ♦';
label.style.cssText = 'font-weight: 600; color: var(--text-primary); margin-bottom: 4px; font-size: 14px; margin-top: 8px;';
formDiv.appendChild(label);
const input = document.createElement('textarea');
input.value = JSON.stringify(value);
input.dataset.key = fullKey;
input.rows = Math.min(value.length, 5);
input.style.cssText = 'width: 100%; padding: 8px; background: #ffffff; color: #222222; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px; resize: vertical;';
formDiv.appendChild(input);
} else {
const type = typeof value === 'boolean' ? 'checkbox' : typeof value === 'number' ? 'number' : 'text';
const input = document.createElement('input');
input.type = type;
input.value = value;
input.dataset.key = fullKey;
input.dataset.type = typeof value;
const displayValue = typeof value === 'boolean' ? value : String(value);
if (type === 'checkbox') input.checked = value;
else input.value = displayValue;
input.style.cssText = 'width: 100%; padding: 8px; background: #ffffff; color: #222222; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px;';
input.style.cssText = 'width: 100%; padding: 8px; background: #222222; color: #ffffff; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px; resize: vertical;';
formDiv.appendChild(input);
return;
}
const fieldContainer = document.createElement('div');
fieldContainer.style.cssText = 'background: var(--bg-input); padding: 8px; border-radius: 4px; border: 1px solid transparent;';
const label = document.createElement('label');
label.htmlFor = `edit-${fullKey.replace(/[.\s]/g, '-')}`;
label.textContent = fullKey;
label.style.cssText = 'font-weight: 600; color: var(--text-primary); display: block; margin-bottom: 4px; font-size: 14px; margin-top: 0;';
fieldContainer.appendChild(label);
const type = typeof value === 'boolean' ? 'checkbox' : typeof value === 'number' ? 'number' : 'text';
const input = document.createElement('input');
input.type = type;
input.value = value;
input.dataset.key = fullKey;
input.dataset.type = typeof value;
const displayValue = typeof value === 'boolean' ? value : String(value);
if (type === 'checkbox') input.checked = value;
else input.value = displayValue;
input.style.cssText = 'width: 100%; padding: 8px; background: #222222; color: #ffffff; border: 1px solid #cccccc; border-radius: 4px; font-family: var(--mono); font-size: 13px;';
fieldContainer.appendChild(input);
formDiv.appendChild(fieldContainer);
});
}
@ -908,7 +928,7 @@ $ python web/serve.py</div>
</div>
<p>${t.description || 'Keine Beschreibung'}</p>
<div class="tags">
${t.tags.map(tag => `<span class="tag">#${tag}</span>`).join('')}
${t.tags.map(tag => `<span class="tag">${tag.startsWith('#') ? tag : '#' + tag}</span>`).join('')}
</div>
<div class="actions">
<button class="btn btn-icon" onclick="viewTemplate('${t.path}')">Anzeigen</button>

View file

@ -92,8 +92,6 @@ class Handler(http.server.SimpleHTTPRequestHandler):
if os.path.exists(file_path) and not os.path.isdir(file_path):
try:
self.path = file_path
# Einfach die Datei senden
with open(file_path, 'rb') as f:
self.send_response(200)
self.send_header('Content-type', 'text/plain' if file_path.endswith('.md') else 'application/json')