Update src/app/layout.tsx
This commit is contained in:
@@ -15,11 +15,11 @@ export const metadata: Metadata = {
|
||||
openGraph: {
|
||||
title: "Nano Mango - Unique & Sustainable Cups Store", description: "Discover Nano Mango's exquisite collection of unique and sustainable cups for every beverage. Elevate your sipping experience with our beautifully crafted designs.", url: "https://nanomango.com", siteName: "Nano Mango", images: [
|
||||
{
|
||||
url: "https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_34my1kGeblbsCcwUUCcjBY9WFkg/uploaded-1770649506170-pxkn8ubj.mp4", alt: "Assortment of stylish cups and mugs from Nano Mango"},
|
||||
url: "/og-image.jpg", alt: "Assortment of stylish cups and mugs from Nano Mango"},
|
||||
],
|
||||
type: "website"},
|
||||
twitter: {
|
||||
card: "summary_large_image", title: "Nano Mango - Unique & Sustainable Cups Store", description: "Discover Nano Mango's exquisite collection of unique and sustainable cups for every beverage. Elevate your sipping experience with our beautifully crafted designs.", images: ["https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_34my1kGeblbsCcwUUCcjBY9WFkg/uploaded-1770649506170-pxkn8ubj.mp4"],
|
||||
card: "summary_large_image", title: "Nano Mango - Unique & Sustainable Cups Store", description: "Discover Nano Mango's exquisite collection of unique and sustainable cups for every beverage. Elevate your sipping experience with our beautifully crafted designs.", images: ["/twitter-image.jpg"],
|
||||
},
|
||||
robots: {
|
||||
index: true,
|
||||
@@ -35,15 +35,12 @@ export default function RootLayout({
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<ServiceWrapper>
|
||||
<body
|
||||
className={`${notoSans.variable} antialiased`}
|
||||
>
|
||||
<body className={`${notoSans.variable} antialiased`}>
|
||||
<Tag />
|
||||
{children}
|
||||
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
(function() {
|
||||
if (window.self === window.top) return;
|
||||
|
||||
@@ -167,7 +164,7 @@ export default function RootLayout({
|
||||
|
||||
const backgroundImage = computedStyle.backgroundImage;
|
||||
if (backgroundImage && backgroundImage !== 'none') {
|
||||
const urlMatch = backgroundImage.match(/url(['"]?([^'")]+)['"]?/);
|
||||
const urlMatch = backgroundImage.match(/url(['\"]?([^'\"\)]+)['\"]?/);
|
||||
if (urlMatch && urlMatch[1] && !urlMatch[1].includes('gradient')) {
|
||||
const area = element.offsetWidth * element.offsetHeight;
|
||||
const hasReasonableSize = area > 1000;
|
||||
@@ -337,7 +334,7 @@ export default function RootLayout({
|
||||
const computedStyle = window.getComputedStyle(element);
|
||||
const backgroundImage = computedStyle.backgroundImage;
|
||||
if (backgroundImage && backgroundImage !== 'none') {
|
||||
const urlMatch = backgroundImage.match(/url(['"]?([^'")]+)['"]?/);
|
||||
const urlMatch = backgroundImage.match(/url(['\"]?([^'\"\)]+)['\"]?/);
|
||||
if (urlMatch) {
|
||||
const originalBgSrc = extractOriginalUrl(urlMatch[1]);
|
||||
if (tagName !== 'img') {
|
||||
@@ -508,15 +505,12 @@ export default function RootLayout({
|
||||
}, '*');
|
||||
|
||||
const handleBeforeInput = (e) => {
|
||||
// Prevent deletion if it would leave the element empty
|
||||
const currentText = element.textContent || '';
|
||||
const inputType = e.inputType;
|
||||
|
||||
// Check if this is a delete operation that would leave the element empty
|
||||
if ((inputType === 'deleteContentBackward' || inputType === 'deleteContentForward' || inputType === 'deleteByCut') && currentText.length <= 1) {
|
||||
e.preventDefault();
|
||||
element.textContent = ' ';
|
||||
// Move cursor to the beginning
|
||||
const range = document.createRange();
|
||||
const sel = window.getSelection();
|
||||
range.setStart(element.firstChild || element, 0);
|
||||
@@ -530,11 +524,9 @@ export default function RootLayout({
|
||||
const elementInfo = getElementInfo(element);
|
||||
let currentText = element.textContent;
|
||||
|
||||
// Ensure there's always at least a space to keep the element editable
|
||||
if (currentText === '' || currentText === null || currentText.length === 0) {
|
||||
element.textContent = ' ';
|
||||
currentText = ' ';
|
||||
// Move cursor to the beginning
|
||||
try {
|
||||
const range = document.createRange();
|
||||
const sel = window.getSelection();
|
||||
@@ -543,7 +535,6 @@ export default function RootLayout({
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
} catch (e) {
|
||||
// Ignore cursor positioning errors
|
||||
}
|
||||
}
|
||||
|
||||
@@ -644,10 +635,8 @@ export default function RootLayout({
|
||||
const elementInfo = getElementInfo(element);
|
||||
let finalText = element.textContent;
|
||||
|
||||
// Trim the final text and convert space-only to empty string for saving
|
||||
if (finalText === ' ' || finalText.trim() === '') {
|
||||
finalText = '';
|
||||
// Update the actual element text to empty for display
|
||||
element.textContent = '';
|
||||
}
|
||||
|
||||
@@ -1290,7 +1279,7 @@ export default function RootLayout({
|
||||
|
||||
let cleanOldValue = oldValue;
|
||||
if (oldValue.includes('url(')) {
|
||||
const urlMatch = oldValue.match(/url(['"]?([^'")]+)['"]?/);
|
||||
const urlMatch = oldValue.match(/url(['\"]?([^'\"\)]+)['\"]?/);
|
||||
if (urlMatch) {
|
||||
cleanOldValue = urlMatch[1];
|
||||
}
|
||||
@@ -1405,10 +1394,10 @@ export default function RootLayout({
|
||||
|
||||
window.parent.postMessage({ type: 'webild-editor-ready' }, '*');
|
||||
})();
|
||||
`
|
||||
}}
|
||||
/>
|
||||
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
|
||||
Reference in New Issue
Block a user