mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-04 12:32:59 +00:00
egesg
This commit is contained in:
+16
-8
@@ -131,6 +131,19 @@
|
|||||||
const bannerTextContent = banner.Text || banner.text || '';
|
const bannerTextContent = banner.Text || banner.text || '';
|
||||||
const bannerStyle = banner.Style || {};
|
const bannerStyle = banner.Style || {};
|
||||||
|
|
||||||
|
// Process the content to handle HTML tags
|
||||||
|
const processHtmlContent = (html) => {
|
||||||
|
// First decode HTML entities
|
||||||
|
const txt = document.createElement('textarea');
|
||||||
|
txt.innerHTML = html;
|
||||||
|
const decoded = txt.value;
|
||||||
|
|
||||||
|
// Then ensure proper HTML structure
|
||||||
|
const parser = new DOMParser();
|
||||||
|
const doc = parser.parseFromString(decoded, 'text/html');
|
||||||
|
return doc.body.innerHTML;
|
||||||
|
};
|
||||||
|
|
||||||
// Create banner content
|
// Create banner content
|
||||||
let content = `
|
let content = `
|
||||||
<div class="banner-content" style="
|
<div class="banner-content" style="
|
||||||
@@ -142,6 +155,8 @@
|
|||||||
${bannerStyle.ContainerStyle || ''}
|
${bannerStyle.ContainerStyle || ''}
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
">
|
">
|
||||||
<div class="banner-html-content" style="
|
<div class="banner-html-content" style="
|
||||||
color: ${bannerStyle.TextColor || textColor};
|
color: ${bannerStyle.TextColor || textColor};
|
||||||
@@ -149,7 +164,7 @@
|
|||||||
text-align: ${bannerStyle.TextAlign || 'left'};
|
text-align: ${bannerStyle.TextAlign || 'left'};
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
">
|
">
|
||||||
${bannerTextContent.replace(/</g, '<').replace(/>/g, '>')}
|
${processHtmlContent(bannerTextContent)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
@@ -293,13 +308,6 @@
|
|||||||
bannerContentEl.innerHTML = content;
|
bannerContentEl.innerHTML = content;
|
||||||
bannerContainer.style.display = 'block';
|
bannerContainer.style.display = 'block';
|
||||||
|
|
||||||
// Decode HTML entities in the content
|
|
||||||
const htmlElements = bannerContentEl.getElementsByClassName('banner-html-content');
|
|
||||||
if (htmlElements.length > 0) {
|
|
||||||
htmlElements[0].innerHTML = new DOMParser().parseFromString(
|
|
||||||
htmlElements[0].textContent, 'text/html').documentElement.textContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the banner link if it exists
|
// Update the banner link if it exists
|
||||||
if (bannerLinkValue) {
|
if (bannerLinkValue) {
|
||||||
let existingLink = bannerContainer.querySelector('a.banner-link');
|
let existingLink = bannerContainer.querySelector('a.banner-link');
|
||||||
|
|||||||
Reference in New Issue
Block a user