From b101944732b678c82d6231b5766115fb768032a5 Mon Sep 17 00:00:00 2001 From: tlyong1992 Date: Wed, 8 Jun 2022 09:48:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=85=A7=E7=89=87=E9=9B=86=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/NotionPage.js | 10 +++++++++- styles/notion.css | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/components/NotionPage.js b/components/NotionPage.js index 13cbe2b7..ead0d0ba 100644 --- a/components/NotionPage.js +++ b/components/NotionPage.js @@ -61,12 +61,20 @@ const NotionPage = ({ post }) => { const cards = document.getElementsByClassName('notion-collection-card') for (const e of cards) { e.removeAttribute('href') + const links = e.querySelectorAll('.notion-link') + if (links && links.length > 0) { + for (const l of links) { + l.onclick = function() { + window.open('http://' + l.innerText) + } + } + } } } }, 800) addWatch4Dom() - }, []) + }) return