|
|
|
@@ -277,7 +277,7 @@
|
|
|
|
<button class="btn secondary icon" id="btnSizePhone" title="Movil"><i class="fa-solid fa-mobile-screen-button"></i></button>
|
|
|
|
<button class="btn secondary icon" id="btnSizePhone" title="Movil"><i class="fa-solid fa-mobile-screen-button"></i></button>
|
|
|
|
<button class="btn secondary icon" id="btnSizeTablet" title="Tablet"><i class="fa-solid fa-tablet-screen-button"></i></button>
|
|
|
|
<button class="btn secondary icon" id="btnSizeTablet" title="Tablet"><i class="fa-solid fa-tablet-screen-button"></i></button>
|
|
|
|
<button class="btn secondary icon active" id="btnSizeDesktop" title="Web"><i class="fa-solid fa-display"></i></button>
|
|
|
|
<button class="btn secondary icon active" id="btnSizeDesktop" title="Web"><i class="fa-solid fa-display"></i></button>
|
|
|
|
<button class="btn secondary" id="btnFreeDrag" style="display:none">Modo libre</button>
|
|
|
|
<button class="btn secondary" id="btnFreeDrag">Modo libre</button>
|
|
|
|
<button class="btn secondary" id="btnAlign">Alinear</button>
|
|
|
|
<button class="btn secondary" id="btnAlign">Alinear</button>
|
|
|
|
<button class="btn" id="btnSave">Publicar</button>
|
|
|
|
<button class="btn" id="btnSave">Publicar</button>
|
|
|
|
<div class="save-status" id="saveStatus">Listo</div>
|
|
|
|
<div class="save-status" id="saveStatus">Listo</div>
|
|
|
|
@@ -503,7 +503,15 @@ const state = {
|
|
|
|
default: return {};
|
|
|
|
default: return {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function escapeHtml(str){return String(str||"").replace(/&/g,"&").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,""").replace(/'/g,"'");
|
|
|
|
|
|
|
|
}
|
|
|
|
function editable(tag, field, text, placeholder, multiline, style){
|
|
|
|
function editable(tag, field, text, placeholder, multiline, style){
|
|
|
|
const ph = placeholder ? ` data-placeholder="${escapeHtml(placeholder)}"` : ` data-placeholder=""`;
|
|
|
|
const ph = placeholder ? ` data-placeholder="${escapeHtml(placeholder)}"` : ` data-placeholder=""`;
|
|
|
|
const ml = multiline ? ` data-multiline="true"` : "";
|
|
|
|
const ml = multiline ? ` data-multiline="true"` : "";
|
|
|
|
@@ -1086,7 +1094,7 @@ const state = {
|
|
|
|
const rect = container.getBoundingClientRect();
|
|
|
|
const rect = container.getBoundingClientRect();
|
|
|
|
if (!rect || !rect.width) return null;
|
|
|
|
if (!rect || !rect.width) return null;
|
|
|
|
const ratio = (clientX - rect.left) / rect.width;
|
|
|
|
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){
|
|
|
|
function getDropIndex(container,y){
|
|
|
|
const blocks=[...container.querySelectorAll(".block")];
|
|
|
|
const blocks=[...container.querySelectorAll(".block")];
|
|
|
|
@@ -1625,7 +1633,25 @@ const state = {
|
|
|
|
bindDrop(logoDrop, logoFile, (data)=>{ s.logo_url = data; }, "Logo cargado");
|
|
|
|
bindDrop(logoDrop, logoFile, (data)=>{ s.logo_url = data; }, "Logo cargado");
|
|
|
|
bindDrop(bgDrop, bgFile, (data)=>{ s.bg_image_url = data; }, "Fondo 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(){
|
|
|
|
function wirePreviewSize(){
|
|
|
|
const shell=document.querySelector(".preview-shell");
|
|
|
|
const shell=document.querySelector(".preview-shell");
|
|
|
|
if (!shell) return;
|
|
|
|
if (!shell) return;
|
|
|
|
@@ -1828,8 +1854,17 @@ const state = {
|
|
|
|
window.location.href = url;
|
|
|
|
window.location.href = url;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (FULL_PAGE_MODE && previewBtn && !document.body.classList.contains("preview-mode")){
|
|
|
|
if (FULL_PAGE_MODE && !document.body.classList.contains("preview-mode")){
|
|
|
|
previewBtn.click();
|
|
|
|
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");
|
|
|
|
const pageSelect = document.getElementById("pageSelect");
|
|
|
|
if (pageSelect){
|
|
|
|
if (pageSelect){
|
|
|
|
|