From e47ddfb593c61df3e02021864cd5816a159922ad Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Fri, 23 Jun 2023 10:04:37 +0800 Subject: [PATCH] mermaid --- components/NotionPage.js | 18 ------------------ components/PrismMac.js | 4 +++- lib/global.js | 4 +++- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/components/NotionPage.js b/components/NotionPage.js index 862af760..f4cb2762 100644 --- a/components/NotionPage.js +++ b/components/NotionPage.js @@ -92,22 +92,4 @@ const mapPageUrl = id => { return '/' + id.replace(/-/g, '') } -// function getMediumZoomMargin() { -// const width = window.innerWidth - -// if (width < 500) { -// return 8 -// } else if (width < 800) { -// return 20 -// } else if (width < 1280) { -// return 30 -// } else if (width < 1600) { -// return 40 -// } else if (width < 1920) { -// return 48 -// } else { -// return 72 -// } -// } - export default NotionPage diff --git a/components/PrismMac.js b/components/PrismMac.js index c8a93c49..5faf3f10 100644 --- a/components/PrismMac.js +++ b/components/PrismMac.js @@ -32,7 +32,9 @@ const PrismMac = () => { renderPrismMac() }) } - renderMermaid() + setTimeout(() => { + renderMermaid() + }, 500) }, []) return <> } diff --git a/lib/global.js b/lib/global.js index 2565cffa..599a14cb 100644 --- a/lib/global.js +++ b/lib/global.js @@ -109,7 +109,9 @@ const initTheme = () => { elements[elements.length - 1].scrollIntoView() // 删除前面的元素,只保留最后一个元素 elements[0].parentNode.removeChild(elements[0]) - elements.pop() + if (Object.prototype.hasOwnProperty.call(elements, 'pop')) { + elements.pop() + } } }, 500) }