(item)
| 725 | renderConfigEditor(item); |
| 726 | } |
| 727 | function renderConfigEditor(item){ |
| 728 | const def = activeConfigDef(); |
| 729 | const editing = S.admin.selectedIndex >= 0 && item; |
| 730 | const current = item || {}; |
| 731 | $('configEditorTitle').textContent = `${editing ? '编辑' : '新增'}${def.label}`; |
| 732 | $('configEditorHint').textContent = def.hint; |
| 733 | $('configFields').innerHTML = def.fields.map(field => fieldHTML(field, current)).join(''); |
| 734 | $('deleteConfigItemBtn').disabled = !editing; |
| 735 | } |
| 736 | function fieldHTML(field, item){ |
| 737 | const value = item[field.name] ?? field.default ?? ''; |
| 738 | if(field.type === 'checkbox'){ |
no test coverage detected