mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-03 20:12:59 +00:00
egesg
This commit is contained in:
+16
-8
@@ -131,6 +131,19 @@
|
||||
const bannerTextContent = banner.Text || banner.text || '';
|
||||
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
|
||||
let content = `
|
||||
<div class="banner-content" style="
|
||||
@@ -142,6 +155,8 @@
|
||||
${bannerStyle.ContainerStyle || ''}
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
">
|
||||
<div class="banner-html-content" style="
|
||||
color: ${bannerStyle.TextColor || textColor};
|
||||
@@ -149,7 +164,7 @@
|
||||
text-align: ${bannerStyle.TextAlign || 'left'};
|
||||
line-height: 1.5;
|
||||
">
|
||||
${bannerTextContent.replace(/</g, '<').replace(/>/g, '>')}
|
||||
${processHtmlContent(bannerTextContent)}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -293,13 +308,6 @@
|
||||
bannerContentEl.innerHTML = content;
|
||||
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
|
||||
if (bannerLinkValue) {
|
||||
let existingLink = bannerContainer.querySelector('a.banner-link');
|
||||
|
||||
Reference in New Issue
Block a user