From ed671c2ba78c77b1cbc5b769bbbc9f59605e0cb3 Mon Sep 17 00:00:00 2001 From: George Corney Date: Fri, 1 Dec 2023 15:30:31 +0000 Subject: [PATCH] Make cdn links local and change icon --- src/index.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index c955893..bb37c1f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -125,7 +125,7 @@ function DemoScene(props: { let expandButton = document.createElement('div'); expandButton.style.visibility = showUI ? 'visible' : 'hidden'; - expandButton.className = 'expand-button ' + (props.expanded ? 'icon-navicon' : 'icon-expand'); + expandButton.className = 'expand-button ' + (props.expanded ? 'icon-compress' : 'icon-expand'); expandButton.onclick = () => { props.onExpandToggle(!props.expanded); } @@ -234,6 +234,17 @@ function App() { {children} ) + }, + a(props) { + // replace absolute links with local ones + let { href, ...rest } = props; + let pattern = /^https:\/\/cdn-luma.com\/[^#]+#(.*)/; + if (href && pattern.test(href)) { + let before = href; + let match = href.match(pattern); + href = '#' + match![1]; + } + return } }} >{readme}