diff --git a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.css b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.css index 34fb323..28b4274 100644 --- a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.css +++ b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.css @@ -247,7 +247,7 @@ .draggable-table-container .resize-handle.resize-sw { bottom: -4px; left: -4px; cursor: sw-resize; } .draggable-table-container .resize-handle.resize-se { bottom: -4px; right: -4px; cursor: se-resize; } /* Draggable table container (mirrors images) */ -.draggable-table-container { position: absolute; cursor: move; user-select: none; z-index: 1000; border: 2px dashed #667eea; border-radius: 8px; background: #ffffff; } +.draggable-table-container { position: absolute; cursor: move; user-select: none; z-index: 1000; border: 2px solid transparent; border-radius: 8px; background: #ffffff; } .draggable-table-container .resize-handle { opacity: 1; } .asgar1-preview .cover-hero { position: relative; height: 180px; overflow: hidden; border-radius: 10px; margin: 12px; background: #222; background-size: cover; background-position: center; } .asgar1-preview .cover-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,0.15), rgba(0,0,0,0.35)); } @@ -7679,7 +7679,7 @@ late particularay .draggable-element:hover, .draggable-element.selected { - border-color: #C0A062; /* Gold accent theme */ + border: 2px solid transparent !important; /* Keep transparent border */ background: rgba(102, 126, 234, 0.1); box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3); } @@ -8536,20 +8536,27 @@ button, .btn, .toolbar-button, .export-pdf-btn { z-index: 1000; min-width: 100px; min-height: 100px; - border: 2px dashed #667eea; - border-radius: 8px; - background: rgba(102, 126, 234, 0.1); - padding: 5px; + border: none !important; + border-radius: 4px; + background: transparent; + padding: 0; transition: all 0.2s ease; transform: translate3d(0, 0, 0); + box-shadow: none; +} +.draggable-image-container img { + display: block; + width: 100%; + height: 100%; + object-fit: cover; + border-radius: 4px; } -.draggable-image-container img { display: block; } .draggable-image-container:hover { - border-color: #764ba2; - background: rgba(102, 126, 234, 0.15); - transform: translate3d(0, -2px, 0); - box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2); + border: none !important; + background: transparent; + transform: translate3d(0, 0, 0); + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); } /* Minimal frame variant to avoid visual/positional shifts when wrapping existing images */ @@ -8558,9 +8565,9 @@ button, .btn, .toolbar-button, .export-pdf-btn { .draggable-image-container.no-frame.dragging { border: none; background: transparent; box-shadow: none; transform: none; } .draggable-image-container.dragging { - border-color: #764ba2; - background: rgba(102, 126, 234, 0.2); - box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3); + border: none !important; + background: transparent; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); transform: scale(1.02); transition: none; z-index: 1001; @@ -8658,15 +8665,15 @@ button, .btn, .toolbar-button, .export-pdf-btn { /* Dragging state */ .draggable-image-container.dragging { - border-color: #764ba2; - background: rgba(102, 126, 234, 0.2); - box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3); + border: none !important; + background: transparent; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); } /* Resizing state */ .draggable-image-container.resizing { - border-color: #ff6b6b; - background: rgba(255, 107, 107, 0.1); + border: none !important; + background: transparent; } /* Text Alignment Section - Fixed Width */ @@ -10431,8 +10438,8 @@ img[draggable="true"] { } .draggable-image-container.selected { - border-color: #C0A062; /* Gold accent theme */ - box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2); + border: none !important; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); } .draggable-image-container img { @@ -10499,7 +10506,7 @@ img[draggable="true"] { overflow: hidden; } .draggable-table-container.selected { - border-color: #C0A062; /* Gold accent theme */ + border: 2px solid transparent !important; /* Keep transparent border */ box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2); } diff --git a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html index 2cf65f4..77ecd50 100644 --- a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html +++ b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.html @@ -846,37 +846,76 @@
diff --git a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.js b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.js index fd3e9b1..0aae682 100644 --- a/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.js +++ b/force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.js @@ -1399,6 +1399,16 @@ export default class PropertyTemplateSelector extends LightningElement { if (editorFrame && editorFrame.innerHTML) { htmlContent = editorFrame.innerHTML; + // Check if there are draggable elements - if so, don't regenerate template + const tempDiv = document.createElement("div"); + tempDiv.innerHTML = htmlContent; + const draggableElements = tempDiv.querySelectorAll( + ".draggable-element, .draggable-image-container, .draggable-table-container" + ); + if (draggableElements.length === 0 && htmlContent.length < 100) { + // Only regenerate if truly empty and no draggable elements + htmlContent = this.createCompleteTemplateHTML(); + } } else { // Fallback: generate template HTML if editor is empty htmlContent = this.createCompleteTemplateHTML(); @@ -1502,15 +1512,92 @@ export default class PropertyTemplateSelector extends LightningElement { } // Clean HTML content for PDF generation by removing editor controls cleanHtmlForPdf(htmlContent) { - // Wrap editor content so we can sanitize before PDF - const tempDiv = document.createElement("div"); - tempDiv.innerHTML = htmlContent; + // Use string manipulation to preserve inline styles better + let cleanedHtml = htmlContent; - // Remove preview-only UI like no-image placeholders - const previewOnly = tempDiv.querySelectorAll( - '[data-preview-only="true"], .floating-placeholder, .placeholder-badge, .placeholder-bubble' + // Remove preview-only UI elements using regex + cleanedHtml = cleanedHtml.replace( + /<[^>]*(?:data-preview-only="true"|class="[^"]*(?:floating-placeholder|placeholder-badge|placeholder-bubble)[^"]*")[^>]*>.*?<\/[^>]*>/gi, + '' ); - previewOnly.forEach((el) => el.remove()); + + // Remove resize handles using regex + cleanedHtml = cleanedHtml.replace( + /${descriptionEnglish}
+${l}
`).join(""); + const html = lines.map((l) => `Description: ${l}
`).join(""); this.insertHtmlAtCursor(html); } + // Additional property insertion methods + insertPropertyBedrooms() { + const bedrooms = this.propertyData.bedrooms || this.propertyData.Bedrooms__c || "0"; + this.insertTextAtCursor(`Bedrooms: ${bedrooms}`); + } + + insertPropertyStatus() { + const status = this.propertyData.status || this.propertyData.Status__c || "Available"; + this.insertTextAtCursor(`Status: ${status}`); + } + + insertPropertyCity() { + const city = this.propertyData.city || this.propertyData.City__c || "City"; + this.insertTextAtCursor(`City: ${city}`); + } + + insertPropertyCommunity() { + const community = this.propertyData.community || this.propertyData.Community__c || "Community"; + this.insertTextAtCursor(`Community: ${community}`); + } + + insertPropertyFloor() { + const floor = this.propertyData.floor || this.propertyData.Floor__c || "N/A"; + this.insertTextAtCursor(`Floor: ${floor}`); + } + + insertPropertyBuildYear() { + const buildYear = this.propertyData.buildYear || this.propertyData.yearBuilt || this.propertyData.Build_Year__c || "N/A"; + this.insertTextAtCursor(`Build Year: ${buildYear}`); + } + + insertPropertyParking() { + const parking = this.propertyData.parking || this.propertyData.parkingSpaces || this.propertyData.Parking_Spaces__c || "N/A"; + this.insertTextAtCursor(`Parking: ${parking}`); + } + + insertPropertyFurnished() { + const furnished = this.propertyData.furnished || this.propertyData.furnishing || this.propertyData.Furnished__c || "N/A"; + this.insertTextAtCursor(`Furnished: ${furnished}`); + } + + insertPropertyOfferingType() { + const offeringType = this.propertyData.offeringType || this.propertyData.Offering_Type__c || "N/A"; + this.insertTextAtCursor(`Offering Type: ${offeringType}`); + } + + insertPropertyRentPrice() { + const rentPrice = this.propertyData.rentPriceMin || this.propertyData.Rent_Price_min__c || "N/A"; + this.insertTextAtCursor(`Rent Price: ${rentPrice}`); + } + + insertPropertySalePrice() { + const salePrice = this.propertyData.salePriceMin || this.propertyData.Sale_Price_min__c || "N/A"; + this.insertTextAtCursor(`Sale Price: ${salePrice}`); + } + + insertPropertyContactName() { + const contactName = this.propertyData.contactName || this.propertyData.Contact_Name__c || "Contact Name"; + this.insertTextAtCursor(`Contact: ${contactName}`); + } + + insertPropertyContactEmail() { + const contactEmail = this.propertyData.contactEmail || this.propertyData.Contact_Email__c || "contact@example.com"; + this.insertTextAtCursor(`Email: ${contactEmail}`); + } + + insertPropertyContactPhone() { + const contactPhone = this.propertyData.contactPhone || this.propertyData.Contact_Phone__c || "N/A"; + this.insertTextAtCursor(`Phone: ${contactPhone}`); + } + + insertPropertyReferenceNumber() { + const referenceNumber = this.propertyData.referenceNumber || this.propertyData.Reference_Number__c || "REF-001"; + this.insertTextAtCursor(`Reference: ${referenceNumber}`); + } + + insertPropertyTitle() { + const title = this.propertyData.titleEnglish || this.propertyData.Title_English__c || "Property Title"; + this.insertTextAtCursor(`Title: ${title}`); + } + + insertPropertyLocality() { + const locality = this.propertyData.locality || this.propertyData.Locality__c || "Locality"; + this.insertTextAtCursor(`Locality: ${locality}`); + } + + insertPropertyTower() { + const tower = this.propertyData.tower || this.propertyData.Tower__c || "N/A"; + this.insertTextAtCursor(`Tower: ${tower}`); + } + + insertPropertyUnitNumber() { + const unitNumber = this.propertyData.unitNumber || this.propertyData.Unit_Number__c || "N/A"; + this.insertTextAtCursor(`Unit Number: ${unitNumber}`); + } + + insertPropertyRentAvailableFrom() { + const rentAvailableFrom = this.propertyData.rentAvailableFrom || this.propertyData.Rent_Available_From__c || "N/A"; + this.insertTextAtCursor(`Available From: ${rentAvailableFrom}`); + } + + insertPropertyRentAvailableTo() { + const rentAvailableTo = this.propertyData.rentAvailableTo || this.propertyData.Rent_Available_To__c || "N/A"; + this.insertTextAtCursor(`Available To: ${rentAvailableTo}`); + } + // Helper function to insert text at cursor position insertTextAtCursor(text) { const selection = window.getSelection(); @@ -7368,9 +7725,11 @@ ${galleryPagesHTML} imageContainer.style.zIndex = "1000"; imageContainer.style.position = "absolute"; imageContainer.style.overflow = "hidden"; - imageContainer.style.border = "2px solid transparent"; + imageContainer.style.border = "none"; imageContainer.style.cursor = "move"; imageContainer.style.userSelect = "none"; + imageContainer.style.boxSizing = "border-box"; + imageContainer.style.borderRadius = "4px"; // Create image element const img = document.createElement("img"); @@ -7380,6 +7739,9 @@ ${galleryPagesHTML} img.style.height = "100%"; img.style.objectFit = "cover"; img.style.display = "block"; + img.style.border = "none"; + img.style.outline = "none"; + img.style.borderRadius = "4px"; imageContainer.appendChild(img); @@ -7427,7 +7789,7 @@ ${galleryPagesHTML} this.saveUndoState(); this.setupEditorClickHandler(); const imageContainer = document.createElement("div"); - imageContainer.className = "draggable-element"; + imageContainer.className = "draggable-image-container"; imageContainer.style.left = "50px"; imageContainer.style.top = "50px"; imageContainer.style.width = "200px"; @@ -7435,6 +7797,9 @@ ${galleryPagesHTML} imageContainer.style.zIndex = "1000"; imageContainer.style.position = "absolute"; imageContainer.style.overflow = "hidden"; + imageContainer.style.border = "none"; + imageContainer.style.boxSizing = "border-box"; + imageContainer.style.borderRadius = "4px"; const img = document.createElement("img"); img.src = event.target.result; @@ -7443,6 +7808,9 @@ ${galleryPagesHTML} img.style.width = "100%"; img.style.height = "100%"; img.style.objectFit = "cover"; + img.style.border = "none"; + img.style.outline = "none"; + img.style.borderRadius = "4px"; imageContainer.appendChild(img); @@ -8012,7 +8380,7 @@ ${galleryPagesHTML} imageContainer.style.height = "200px"; imageContainer.style.cursor = "move"; imageContainer.style.zIndex = "1000"; - imageContainer.style.border = "2px dashed #667eea"; + imageContainer.style.border = "2px solid transparent"; imageContainer.style.borderRadius = "4px"; imageContainer.style.overflow = "hidden"; @@ -10316,7 +10684,7 @@ ${galleryPagesHTML} textElement.style.minWidth = "150px"; textElement.style.minHeight = "30px"; textElement.style.padding = "8px"; - textElement.style.border = "2px dashed #4f46e5"; + textElement.style.border = "2px solid transparent"; textElement.style.borderRadius = "4px"; textElement.style.backgroundColor = "rgba(255, 255, 255, 0.9)"; textElement.style.zIndex = "1000";