function updatePropertiesPanel() { const content = document.getElementById('properties-content'); const empty = document.getElementById('properties-empty'); if (!state.selectedNode) { content.style.display = 'none'; empty.style.display = 'block'; return; } const node = state.nodes.get(state.selectedNode); if (!node) return; const template = nodeTemplates[node.type]; empty.style.display = 'none'; content.style.display = 'block'; let html = `
Node Info
Properties
`; template.fields.forEach(field => { const value = node.fields[field.name] || ''; if (field.type === 'textarea') { html += `
`; } else { html += `
`; } }); html += '
'; content.innerHTML = html; content.querySelectorAll('.property-input:not([readonly]), .property-textarea').forEach(input => { input.addEventListener('change', (e) => { const n = state.nodes.get(e.target.dataset.node); if (n) { n.fields[e.target.dataset.field] = e.target.value; const nodeInput = document.querySelector(`#${n.id} [data-field="${e.target.dataset.field}"]`); if (nodeInput) nodeInput.value = e.target.value; saveToHistory(); } }); }); }