From a2d009bcb8671f8fbdcf949e2444e703f308f66a Mon Sep 17 00:00:00 2001 From: Jandl-hostacny Date: Mon, 19 Oct 2026 16:50:27 +0200 Subject: [PATCH] feat: zalamovanie riadkov v nadpisoch, cely nahlad cenovky v zozname sablon - Enter alebo
v nadpise = novy riadok (clanky, recepty, letaky, banner, nazov produktu); polia nadpisov su viacriadkove - nahlad sablony v editore cenoviek uz nie je orezany zhora a zdola Co-Authored-By: Claude Opus 5.5 --- src/components/editor/BadgeEditorModal.tsx | 2 +- src/components/editor/ConfigPanel.tsx | 35 ++++++++++++---------- src/lib/emailRenderer.ts | 21 ++++++++----- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/components/editor/BadgeEditorModal.tsx b/src/components/editor/BadgeEditorModal.tsx index 2025edd..f9aa878 100644 --- a/src/components/editor/BadgeEditorModal.tsx +++ b/src/components/editor/BadgeEditorModal.tsx @@ -722,7 +722,7 @@ export const BadgeEditorModal: React.FC = ({
= ({
- updateData({ title: e.target.value })} - className="w-full text-sm border border-gray-300 rounded-lg p-2" + title="Enter = nový riadok (alebo
)" + className="w-full text-sm border border-gray-300 rounded-lg p-2 resize-y" />
@@ -2020,13 +2021,14 @@ export const ConfigPanel: React.FC = ({
- updateData({ item1: { ...module.data.item1, title: e.target.value } })} - className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white font-bold" + title="Enter = nový riadok (alebo
)" + className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white font-bold resize-y" placeholder="Aktuálne letáky" />
@@ -2065,13 +2067,14 @@ export const ConfigPanel: React.FC = ({
- updateData({ item2: { ...module.data.item2, title: e.target.value } })} - className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white font-bold" + title="Enter = nový riadok (alebo
)" + className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white font-bold resize-y" placeholder="Rozšírený leták" />
@@ -2113,13 +2116,14 @@ export const ConfigPanel: React.FC = ({
- updateData({ item1: { ...module.data.item1, title: e.target.value } })} - className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white font-bold" + title="Enter = nový riadok (alebo
)" + className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white font-bold resize-y" />
@@ -2156,13 +2160,14 @@ export const ConfigPanel: React.FC = ({
- updateData({ item2: { ...module.data.item2, title: e.target.value } })} - className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white font-bold" + title="Enter = nový riadok (alebo
)" + className="w-full text-xs border border-gray-300 rounded p-1.5 bg-white font-bold resize-y" />
diff --git a/src/lib/emailRenderer.ts b/src/lib/emailRenderer.ts index 2219ebe..97a52d8 100644 --- a/src/lib/emailRenderer.ts +++ b/src/lib/emailRenderer.ts @@ -328,8 +328,8 @@ function renderModule(m: any, campaign: NewsletterCampaign): string { ${m.data.title || m.data.description || m.data.buttonText ? ` - ${m.data.title ? `

${escapeHtml(m.data.title)}

` : ''} - ${m.data.description ? `

${escapeHtml(m.data.description)}

` : ''} + ${m.data.title ? `

${escapeWithBreaks(m.data.title)}

` : ''} + ${m.data.description ? `

${escapeWithBreaks(m.data.description)}

` : ''} ${m.data.buttonText ? ` @@ -473,7 +473,7 @@ function renderModule(m: any, campaign: NewsletterCampaign): string { @@ -507,7 +507,7 @@ function renderModule(m: any, campaign: NewsletterCampaign): string {
-

${escapeHtml(it1.title)}

+

${escapeWithBreaks(it1.title)}

@@ -560,7 +560,7 @@ function renderModule(m: any, campaign: NewsletterCampaign): string {
-

${escapeHtml(it2.title)}

+

${escapeWithBreaks(it2.title)}

-

${escapeHtml(it1.title)}

+

${escapeWithBreaks(it1.title)}

@@ -589,7 +589,7 @@ function renderModule(m: any, campaign: NewsletterCampaign): string { -

${escapeHtml(it2.title)}

+

${escapeWithBreaks(it2.title)}

@@ -717,7 +717,7 @@ function renderStackedImageRow(p: ProductItem, imgHtml: string, cellStyle: strin // názov 15px/700 · gramáž 15px/400 (v tom istom riadku) · jednotková cena 11px #555 · poznámka 10px #888 const PRODUCT_TEXT_FONT = "font-family: 'Poppins', Helvetica, Arial, sans-serif;"; function renderProductTextBlock(p: { title?: string; quantity?: string; note?: string }, unitPrice?: string): string { - return `

${escapeHtml(p.title || '')}${p.quantity ? ` ${escapeHtml(p.quantity)}` : ''}

${ + return `

${escapeWithBreaks(p.title || '')}${p.quantity ? ` ${escapeHtml(p.quantity)}` : ''}

${ unitPrice ? `
${escapeHtml(unitPrice)}
` : ''}${ p.note ? ` @@ -1095,6 +1095,13 @@ function renderExactLoyaltyCard(p: any, validity: string, storesOffset: StoresOf `; } +// Text nadpisu so zalomením riadkov: Enter (nový riadok) alebo
v texte =
, inak escapované +function escapeWithBreaks(str: string): string { + return escapeHtml(str) + .replace(/<br\s*\/?>/gi, '
') + .replace(/\r?\n/g, '
'); +} + function escapeHtml(str: string): string { if (!str) return ''; return String(str)