diff --git a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html index b5595ec..2cf65f4 100644 --- a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html +++ b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html @@ -33,19 +33,19 @@
123 Luxury Lane, Prestige City, PC 45678
Review and select images for your brochure
+Property description not available.
"; } - // Clean up the description - let formattedDescription = description.trim(); + const raw = String(description).trim(); - // Ensure proper paragraph breaks - formattedDescription = formattedDescription.replace(/\n\s*\n/g, ""); - - // Wrap in paragraph tags if not already wrapped - if (!formattedDescription.startsWith("
")) { - formattedDescription = "
" + formattedDescription + "
"; + // If the description already contains HTML tags, trust it and return as-is + if (/[<][a-zA-Z][^>]*>/.test(raw)) { + return raw; } - // Ensure proper spacing between paragraphs - formattedDescription = formattedDescription.replace(/<\/p>/g, "
"); + const escapeHtml = (str) => + str + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/\"/g, """) + .replace(/'/g, "'"); - return formattedDescription; + const lines = raw.replace(/\r\n?/g, "\n").split("\n"); + + const bulletRe = /^\s*(?:[-*•]|\u2022)\s+(.*)$/; // -,*,• bullets + const numberedRe = /^\s*(\d+)[\.)]\s+(.*)$/; // 1. or 1) + + let htmlParts = []; + let listType = null; // 'ul' | 'ol' + let listBuffer = []; + + const flushList = () => { + if (!listType || listBuffer.length === 0) return; + htmlParts.push( + `<${listType}>` + + listBuffer.map((item) => `
${escapeHtml(trimmed)}
`); + } + + flushList(); + return htmlParts.join(""); } // Generate amenities HTML from property data @@ -2307,6 +2376,55 @@ export default class PropertyTemplateSelector extends LightningElement { .join(""); } + // Generate amenity list items ([Property Description goes here... This section provides a compelling overview of the property's main selling points, its unique character, and the lifestyle it offers. It should be engaging and concise.]
+ ${description}123 Luxury Lane, Prestige City, PC 45678
+${location}
Nestled in the heart of Prestige City, The Grand Oak Villa is a masterpiece of modern architecture and timeless elegance. This expansive 6,200 sq. ft. residence offers unparalleled luxury and privacy.
-With soaring ceilings, bespoke finishes, and panoramic views from every room, this home is designed for those who appreciate the finer things in life. The open-plan living space is perfect for entertaining, featuring a gourmet chef's kitchen, a formal dining area, and a grand living room with a statement fireplace.
+ ${description}