This commit is contained in:
2026-01-19 00:31:50 +01:00
parent c6f710a222
commit 6cae9eaab2
2 changed files with 12 additions and 0 deletions

View File

@@ -26,6 +26,16 @@ export function initCreate(){
apiName.className='w-full border rounded-lg px-3 py-2';
apiName.id='f-api-name';
fields.appendChild(apiName);
const editorSelect = document.createElement('select');
editorSelect.id = 'f-editor-type';
editorSelect.className = 'w-full border rounded-lg px-3 py-2';
editorSelect.innerHTML = `
<option value="grapesjs">GrapesJS</option>
<option value="craftjs">Craft.js</option>
`;
const defaultEditor = (window.__editorDefault || 'grapesjs').toLowerCase();
editorSelect.value = defaultEditor === 'craftjs' ? 'craftjs' : 'grapesjs';
fields.appendChild(editorSelect);
apiName.addEventListener('input', ()=>{
apiTouched = true;
const next = normalizeApiName(apiName.value);
@@ -46,6 +56,7 @@ export function initCreate(){
if(tab==='templates') {
payload.api_name=(document.getElementById('f-api-name')?.value||'').trim();
if(!payload.api_name) return;
payload.editor_type=(document.getElementById('f-editor-type')?.value||'grapesjs');
}
if(tab==='snippets') payload.content=''; else payload.html='';
if(tab==='sections') payload.template_id=document.getElementById('f-template')?.value||null;