fix(builder): activar free drag persistente para template restaurante

This commit is contained in:
komkida91
2026-03-01 14:11:25 +01:00
parent 6c1ccc0a48
commit 2cc845eb4d

View File

@@ -2942,7 +2942,6 @@ const state = {
} }
async function saveContent(){ async function saveContent(){
if (isSaving) return; if (isSaving) return;
state.settings.free_drag = false;
isSaving = true; isSaving = true;
const btn = document.getElementById("btnSave"); const btn = document.getElementById("btnSave");
if (btn){ if (btn){
@@ -2982,6 +2981,11 @@ const state = {
const keepRubro = normalizeRubro(state.settings.business_rubro || SERVER_RUBRO || "restaurante"); const keepRubro = normalizeRubro(state.settings.business_rubro || SERVER_RUBRO || "restaurante");
state.blocks = []; state.blocks = [];
state.settings = { ...defaultSettings, business_rubro: keepRubro }; state.settings = { ...defaultSettings, business_rubro: keepRubro };
if (BUILDER_MODE === "ub24"){
state.settings.free_drag = false;
} else {
state.settings.free_drag = keepRubro === "restaurante";
}
selectedBlockId = null; selectedBlockId = null;
renderInspector(); renderInspector();
renderPreview(); renderPreview();
@@ -2995,8 +2999,6 @@ const state = {
} }
} }
function init(){ function init(){
// By default we keep section flow layout for stable full-page composition.
state.settings.free_drag = false;
const initialRubro = normalizeRubro(state.settings.business_rubro || SERVER_RUBRO || "restaurante"); const initialRubro = normalizeRubro(state.settings.business_rubro || SERVER_RUBRO || "restaurante");
state.settings.business_rubro = initialRubro; state.settings.business_rubro = initialRubro;
state.blocks = normalizeLoadedBlocks(state.blocks); state.blocks = normalizeLoadedBlocks(state.blocks);
@@ -3009,9 +3011,10 @@ const state = {
} }
if (BUILDER_MODE === "ub24"){ if (BUILDER_MODE === "ub24"){
state.blocks.forEach(b=>{ if (!b.page) b.page = "home"; }); state.blocks.forEach(b=>{ if (!b.page) b.page = "home"; });
}
if (BUILDER_MODE === "ub24"){
state.settings.free_drag = false; state.settings.free_drag = false;
} else {
// Restaurante usa posicionamiento libre para colocar bloques donde el usuario quiera.
state.settings.free_drag = initialRubro === "restaurante";
} }
selectedBlockId = null; selectedBlockId = null;
wireSidebar(); wireSidebar();
@@ -3034,6 +3037,11 @@ const state = {
const t = templates[key]; const t = templates[key];
state.settings = { ...state.settings, ...t.settings }; state.settings = { ...state.settings, ...t.settings };
state.settings.business_rubro = normalizeRubro(key); state.settings.business_rubro = normalizeRubro(key);
if (BUILDER_MODE === "ub24"){
state.settings.free_drag = false;
} else {
state.settings.free_drag = state.settings.business_rubro === "restaurante";
}
state.blocks = t.blocks.map(b=>({ ...b, id: makeId(), page: (BUILDER_MODE==="ub24" ? "home" : b.page) })); state.blocks = t.blocks.map(b=>({ ...b, id: makeId(), page: (BUILDER_MODE==="ub24" ? "home" : b.page) }));
selectedBlockId = null; selectedBlockId = null;
renderInspector(); renderPreview(); renderInspector(); renderPreview();