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:
parent
8effb63a40
commit
f9e239098a
2 changed files with 44 additions and 26 deletions
|
|
@ -92,8 +92,8 @@
|
||||||
#edit-content-content textarea,
|
#edit-content-content textarea,
|
||||||
#edit-modal input,
|
#edit-modal input,
|
||||||
#edit-modal textarea {
|
#edit-modal textarea {
|
||||||
background: #ffffff;
|
background: #222222;
|
||||||
color: #222222; /* Dunkelgrau mit ausreichendem Kontrast gegen weiß (8.6:1) */
|
color: #ffffff; /* Weiß auf Dunkelgrau (#222222) */
|
||||||
border: 1px solid #cccccc;
|
border: 1px solid #cccccc;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
|
|
@ -605,27 +605,47 @@ $ python web/serve.py</div>
|
||||||
const isObject = typeof value === 'object' && value !== null;
|
const isObject = typeof value === 'object' && value !== null;
|
||||||
const isArray = Array.isArray(value);
|
const isArray = Array.isArray(value);
|
||||||
|
|
||||||
|
if (isObject && !isArray) {
|
||||||
const label = document.createElement('label');
|
const label = document.createElement('label');
|
||||||
label.htmlFor = `edit-${fullKey.replace(/[.\s]/g, '-')}`;
|
label.htmlFor = `edit-${fullKey.replace(/[.\s]/g, '-')}`;
|
||||||
label.textContent = fullKey + (isObject ? ' (Objekt) ♦' : isArray ? ' (Array) ♦' : '');
|
label.textContent = fullKey + ' (Objekt) ♦';
|
||||||
label.style.cssText = 'font-weight: 600; color: var(--text-primary); margin-bottom: 4px; font-size: 14px; margin-top: 8px;';
|
label.style.cssText = 'font-weight: 600; color: var(--text-primary); margin-bottom: 4px; font-size: 14px; margin-top: 8px;';
|
||||||
formDiv.appendChild(label);
|
formDiv.appendChild(label);
|
||||||
|
|
||||||
if (isObject && !isArray) {
|
|
||||||
const input = document.createElement('textarea');
|
const input = document.createElement('textarea');
|
||||||
input.value = JSON.stringify(value, null, 2);
|
input.value = JSON.stringify(value, null, 2);
|
||||||
input.dataset.key = fullKey;
|
input.dataset.key = fullKey;
|
||||||
input.rows = Object.keys(value).length > 10 ? 10 : Object.keys(value).length;
|
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);
|
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');
|
const input = document.createElement('textarea');
|
||||||
input.value = JSON.stringify(value);
|
input.value = JSON.stringify(value);
|
||||||
input.dataset.key = fullKey;
|
input.dataset.key = fullKey;
|
||||||
input.rows = Math.min(value.length, 5);
|
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;';
|
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);
|
formDiv.appendChild(input);
|
||||||
} else {
|
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 type = typeof value === 'boolean' ? 'checkbox' : typeof value === 'number' ? 'number' : 'text';
|
||||||
const input = document.createElement('input');
|
const input = document.createElement('input');
|
||||||
input.type = type;
|
input.type = type;
|
||||||
|
|
@ -635,9 +655,9 @@ $ python web/serve.py</div>
|
||||||
const displayValue = typeof value === 'boolean' ? value : String(value);
|
const displayValue = typeof value === 'boolean' ? value : String(value);
|
||||||
if (type === 'checkbox') input.checked = value;
|
if (type === 'checkbox') input.checked = value;
|
||||||
else input.value = displayValue;
|
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;';
|
||||||
formDiv.appendChild(input);
|
fieldContainer.appendChild(input);
|
||||||
}
|
formDiv.appendChild(fieldContainer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -908,7 +928,7 @@ $ python web/serve.py</div>
|
||||||
</div>
|
</div>
|
||||||
<p>${t.description || 'Keine Beschreibung'}</p>
|
<p>${t.description || 'Keine Beschreibung'}</p>
|
||||||
<div class="tags">
|
<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>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button class="btn btn-icon" onclick="viewTemplate('${t.path}')">Anzeigen</button>
|
<button class="btn btn-icon" onclick="viewTemplate('${t.path}')">Anzeigen</button>
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,6 @@ class Handler(http.server.SimpleHTTPRequestHandler):
|
||||||
|
|
||||||
if os.path.exists(file_path) and not os.path.isdir(file_path):
|
if os.path.exists(file_path) and not os.path.isdir(file_path):
|
||||||
try:
|
try:
|
||||||
self.path = file_path
|
|
||||||
# Einfach die Datei senden
|
|
||||||
with open(file_path, 'rb') as f:
|
with open(file_path, 'rb') as f:
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-type', 'text/plain' if file_path.endswith('.md') else 'application/json')
|
self.send_header('Content-type', 'text/plain' if file_path.endswith('.md') else 'application/json')
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue