Update src/app/layout.tsx
This commit is contained in:
@@ -183,7 +183,7 @@ export default function RootLayout({
|
||||
|
||||
const buttonClasses = ['btn', 'button', 'cta', 'action-button'];
|
||||
const hasButtonClass = buttonClasses.some(cls =>
|
||||
element.classList.contains(cls) || element.classList.contains(`btn-${cls}`)
|
||||
element.classList.contains(cls) || element.classList.contains(\`btn-\${cls}\`)
|
||||
);
|
||||
|
||||
if (hasButtonClass && element.textContent && element.textContent.trim().length > 0) {
|
||||
@@ -237,8 +237,7 @@ export default function RootLayout({
|
||||
try {
|
||||
const urlObj = new URL(url);
|
||||
return urlObj.pathname;
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
@@ -632,17 +631,17 @@ export default function RootLayout({
|
||||
const rect = element.getBoundingClientRect();
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'webild-hover-overlay';
|
||||
overlay.style.cssText = `
|
||||
overlay.style.cssText = \`
|
||||
position: fixed !important;
|
||||
top: ${rect.top - 2}px !important;
|
||||
left: ${rect.left - 2}px !important;
|
||||
width: ${rect.width + 4}px !important;
|
||||
height: ${rect.height + 4}px !important;
|
||||
top: \${rect.top - 2}px !important;
|
||||
left: \${rect.left - 2}px !important;
|
||||
width: \${rect.width + 4}px !important;
|
||||
height: \${rect.height + 4}px !important;
|
||||
background-color: rgba(90, 113, 230, 0.15) !important;
|
||||
pointer-events: none !important;
|
||||
z-index: 999998 !important;
|
||||
transition: all 0.15s ease !important;
|
||||
`;
|
||||
\`;
|
||||
document.body.appendChild(overlay);
|
||||
return overlay;
|
||||
};
|
||||
@@ -705,11 +704,11 @@ export default function RootLayout({
|
||||
elementTypeLabel.classList.add('label-bottom');
|
||||
}
|
||||
|
||||
elementTypeLabel.style.cssText = `
|
||||
left: ${labelLeft}px !important;
|
||||
top: ${labelTop}px !important;
|
||||
elementTypeLabel.style.cssText = \`
|
||||
left: \${labelLeft}px !important;
|
||||
top: \${labelTop}px !important;
|
||||
transform: none !important;
|
||||
`;
|
||||
\`;
|
||||
};
|
||||
|
||||
const removeElementTypeLabel = () => {
|
||||
@@ -963,7 +962,7 @@ export default function RootLayout({
|
||||
const getStorageKey = () => {
|
||||
const url = new URL(window.location.href);
|
||||
const pathParts = url.pathname.split('/').filter(Boolean);
|
||||
return `webild-changes-${pathParts.join('-')}`;
|
||||
return \`webild-changes-\${pathParts.join('-')}\`;
|
||||
};
|
||||
|
||||
const saveChangeToStorage = (change) => {
|
||||
@@ -1188,7 +1187,7 @@ export default function RootLayout({
|
||||
|
||||
if (isBackground) {
|
||||
oldValue = window.getComputedStyle(element).backgroundImage;
|
||||
element.style.backgroundImage = `url('${newSrc}')`;
|
||||
element.style.backgroundImage = \`url('\${newSrc}')\`;
|
||||
replaced = true;
|
||||
} else if (element.tagName.toLowerCase() === 'img') {
|
||||
oldValue = element.src;
|
||||
@@ -1198,7 +1197,7 @@ export default function RootLayout({
|
||||
const hasBackgroundImage = window.getComputedStyle(element).backgroundImage !== 'none';
|
||||
if (hasBackgroundImage) {
|
||||
oldValue = window.getComputedStyle(element).backgroundImage;
|
||||
element.style.backgroundImage = `url('${newSrc}')`;
|
||||
element.style.backgroundImage = \`url('\${newSrc}')\`;
|
||||
replaced = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user