diff --git a/elementor/templates/elementor_builder.html b/elementor/templates/elementor_builder.html index 96c9ea8..285cd54 100644 --- a/elementor/templates/elementor_builder.html +++ b/elementor/templates/elementor_builder.html @@ -277,7 +277,7 @@ - +
Listo
@@ -503,7 +503,15 @@ const state = { default: return {}; } } - function escapeHtml(str){return String(str||"").replace(/&/g,"&").replace(//g,">").replace(/\"/g,""").replace(/'/g,"'");} + function repairMojibake(text){ + const raw = String(text || ""); + if (!/[ÃÂ]/.test(raw)) return raw; + try { return decodeURIComponent(escape(raw)); } catch(_e) { return raw; } + } + function escapeHtml(str){ + const safe = repairMojibake(str); + return String(safe).replace(/&/g,"&").replace(//g,">").replace(/\"/g,""").replace(/'/g,"'"); + } function editable(tag, field, text, placeholder, multiline, style){ const ph = placeholder ? ` data-placeholder="${escapeHtml(placeholder)}"` : ` data-placeholder=""`; const ml = multiline ? ` data-multiline="true"` : ""; @@ -1086,7 +1094,7 @@ const state = { const rect = container.getBoundingClientRect(); if (!rect || !rect.width) return null; const ratio = (clientX - rect.left) / rect.width; - return ratio > 0.38 && ratio < 0.62; + return ratio > 0.33 && ratio < 0.67; } function getDropIndex(container,y){ const blocks=[...container.querySelectorAll(".block")]; @@ -1625,7 +1633,25 @@ const state = { bindDrop(logoDrop, logoFile, (data)=>{ s.logo_url = data; }, "Logo cargado"); bindDrop(bgDrop, bgFile, (data)=>{ s.bg_image_url = data; }, "Fondo cargado"); } - function wireFreeDragToggle(){ return; } + function wireFreeDragToggle(){ + const btn = document.getElementById("btnFreeDrag"); + if (!btn) return; + const applyLabel = ()=>{ + btn.textContent = state.settings.free_drag ? "Modo libre: ON" : "Modo libre"; + btn.classList.toggle("active", !!state.settings.free_drag); + }; + btn.addEventListener("click", ()=>{ + state.settings.free_drag = !state.settings.free_drag; + if (state.settings.free_drag){ + state.blocks.forEach((b)=>{ + if (!b.pos) b.pos = getDefaultPos(); + }); + } + applyLabel(); + renderPreview(); + }); + applyLabel(); + } function wirePreviewSize(){ const shell=document.querySelector(".preview-shell"); if (!shell) return; @@ -1828,8 +1854,17 @@ const state = { window.location.href = url; }); } - if (FULL_PAGE_MODE && previewBtn && !document.body.classList.contains("preview-mode")){ - previewBtn.click(); + if (FULL_PAGE_MODE && !document.body.classList.contains("preview-mode")){ + document.body.classList.add("preview-mode"); + const shell = document.querySelector(".preview-shell"); + const main = document.querySelector(".main"); + if (main) main.style.padding = "0"; + if (shell){ + shell.style.maxWidth = "100%"; + shell.style.margin = "0"; + shell.classList.remove("size-phone","size-tablet","size-desktop"); + shell.classList.add("size-desktop"); + } } const pageSelect = document.getElementById("pageSelect"); if (pageSelect){