Update src/app/layout.tsx
This commit is contained in:
@@ -15,11 +15,11 @@ export const metadata: Metadata = {
|
|||||||
openGraph: {
|
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: [
|
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"},
|
type: "website"},
|
||||||
twitter: {
|
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: {
|
robots: {
|
||||||
index: true,
|
index: true,
|
||||||
@@ -35,15 +35,12 @@ export default function RootLayout({
|
|||||||
return (
|
return (
|
||||||
<html lang="en" suppressHydrationWarning>
|
<html lang="en" suppressHydrationWarning>
|
||||||
<ServiceWrapper>
|
<ServiceWrapper>
|
||||||
<body
|
<body className={`${notoSans.variable} antialiased`}>
|
||||||
className={`${notoSans.variable} antialiased`}
|
|
||||||
>
|
|
||||||
<Tag />
|
<Tag />
|
||||||
{children}
|
{children}
|
||||||
|
<script
|
||||||
<script
|
dangerouslySetInnerHTML={{
|
||||||
dangerouslySetInnerHTML={{
|
__html: `
|
||||||
__html: `
|
|
||||||
(function() {
|
(function() {
|
||||||
if (window.self === window.top) return;
|
if (window.self === window.top) return;
|
||||||
|
|
||||||
@@ -167,7 +164,7 @@ export default function RootLayout({
|
|||||||
|
|
||||||
const backgroundImage = computedStyle.backgroundImage;
|
const backgroundImage = computedStyle.backgroundImage;
|
||||||
if (backgroundImage && backgroundImage !== 'none') {
|
if (backgroundImage && backgroundImage !== 'none') {
|
||||||
const urlMatch = backgroundImage.match(/url(['"]?([^'")]+)['"]?/);
|
const urlMatch = backgroundImage.match(/url(['\"]?([^'\"\)]+)['\"]?/);
|
||||||
if (urlMatch && urlMatch[1] && !urlMatch[1].includes('gradient')) {
|
if (urlMatch && urlMatch[1] && !urlMatch[1].includes('gradient')) {
|
||||||
const area = element.offsetWidth * element.offsetHeight;
|
const area = element.offsetWidth * element.offsetHeight;
|
||||||
const hasReasonableSize = area > 1000;
|
const hasReasonableSize = area > 1000;
|
||||||
@@ -337,7 +334,7 @@ export default function RootLayout({
|
|||||||
const computedStyle = window.getComputedStyle(element);
|
const computedStyle = window.getComputedStyle(element);
|
||||||
const backgroundImage = computedStyle.backgroundImage;
|
const backgroundImage = computedStyle.backgroundImage;
|
||||||
if (backgroundImage && backgroundImage !== 'none') {
|
if (backgroundImage && backgroundImage !== 'none') {
|
||||||
const urlMatch = backgroundImage.match(/url(['"]?([^'")]+)['"]?/);
|
const urlMatch = backgroundImage.match(/url(['\"]?([^'\"\)]+)['\"]?/);
|
||||||
if (urlMatch) {
|
if (urlMatch) {
|
||||||
const originalBgSrc = extractOriginalUrl(urlMatch[1]);
|
const originalBgSrc = extractOriginalUrl(urlMatch[1]);
|
||||||
if (tagName !== 'img') {
|
if (tagName !== 'img') {
|
||||||
@@ -508,15 +505,12 @@ export default function RootLayout({
|
|||||||
}, '*');
|
}, '*');
|
||||||
|
|
||||||
const handleBeforeInput = (e) => {
|
const handleBeforeInput = (e) => {
|
||||||
// Prevent deletion if it would leave the element empty
|
|
||||||
const currentText = element.textContent || '';
|
const currentText = element.textContent || '';
|
||||||
const inputType = e.inputType;
|
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) {
|
if ((inputType === 'deleteContentBackward' || inputType === 'deleteContentForward' || inputType === 'deleteByCut') && currentText.length <= 1) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
element.textContent = ' ';
|
element.textContent = ' ';
|
||||||
// Move cursor to the beginning
|
|
||||||
const range = document.createRange();
|
const range = document.createRange();
|
||||||
const sel = window.getSelection();
|
const sel = window.getSelection();
|
||||||
range.setStart(element.firstChild || element, 0);
|
range.setStart(element.firstChild || element, 0);
|
||||||
@@ -530,11 +524,9 @@ export default function RootLayout({
|
|||||||
const elementInfo = getElementInfo(element);
|
const elementInfo = getElementInfo(element);
|
||||||
let currentText = element.textContent;
|
let currentText = element.textContent;
|
||||||
|
|
||||||
// Ensure there's always at least a space to keep the element editable
|
|
||||||
if (currentText === '' || currentText === null || currentText.length === 0) {
|
if (currentText === '' || currentText === null || currentText.length === 0) {
|
||||||
element.textContent = ' ';
|
element.textContent = ' ';
|
||||||
currentText = ' ';
|
currentText = ' ';
|
||||||
// Move cursor to the beginning
|
|
||||||
try {
|
try {
|
||||||
const range = document.createRange();
|
const range = document.createRange();
|
||||||
const sel = window.getSelection();
|
const sel = window.getSelection();
|
||||||
@@ -543,7 +535,6 @@ export default function RootLayout({
|
|||||||
sel.removeAllRanges();
|
sel.removeAllRanges();
|
||||||
sel.addRange(range);
|
sel.addRange(range);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Ignore cursor positioning errors
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -644,10 +635,8 @@ export default function RootLayout({
|
|||||||
const elementInfo = getElementInfo(element);
|
const elementInfo = getElementInfo(element);
|
||||||
let finalText = element.textContent;
|
let finalText = element.textContent;
|
||||||
|
|
||||||
// Trim the final text and convert space-only to empty string for saving
|
|
||||||
if (finalText === ' ' || finalText.trim() === '') {
|
if (finalText === ' ' || finalText.trim() === '') {
|
||||||
finalText = '';
|
finalText = '';
|
||||||
// Update the actual element text to empty for display
|
|
||||||
element.textContent = '';
|
element.textContent = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1290,7 +1279,7 @@ export default function RootLayout({
|
|||||||
|
|
||||||
let cleanOldValue = oldValue;
|
let cleanOldValue = oldValue;
|
||||||
if (oldValue.includes('url(')) {
|
if (oldValue.includes('url(')) {
|
||||||
const urlMatch = oldValue.match(/url(['"]?([^'")]+)['"]?/);
|
const urlMatch = oldValue.match(/url(['\"]?([^'\"\)]+)['\"]?/);
|
||||||
if (urlMatch) {
|
if (urlMatch) {
|
||||||
cleanOldValue = urlMatch[1];
|
cleanOldValue = urlMatch[1];
|
||||||
}
|
}
|
||||||
@@ -1405,10 +1394,10 @@ export default function RootLayout({
|
|||||||
|
|
||||||
window.parent.postMessage({ type: 'webild-editor-ready' }, '*');
|
window.parent.postMessage({ type: 'webild-editor-ready' }, '*');
|
||||||
})();
|
})();
|
||||||
`
|
`,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<script
|
<script
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: `
|
__html: `
|
||||||
|
|||||||
Reference in New Issue
Block a user