A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: Automatically jump when the href of a Link component within a matching project is not a front-end route
shuai36b1560b4552
diff --git a/ui/src/index.tsx b/ui/src/index.tsxindex 6074ca72..e2930c08 100644--- a/ui/src/index.tsx+++ b/ui/src/index.tsx@@ -60,8 +60,29 @@ const handleImgLoad = (evt: Event | UIEvent) => {}};+/**+ *Automatically jump when the href of a Link component within a matching project is not a front-end route.+ *+ */+const handleClickLink = (evt: Event) => {+ const { target } = evt;++ if (target === null || !(target instanceof Element)) {+ return;+ }+ if (!/A/i.test(target.nodeName)) {+ return;+ }++ if (target.getAttribute('href')?.includes('/answer/api/')) {+ evt.preventDefault();+ window.location.href = target.getAttribute('href') || '';+ }+};+document.addEventListener('error', handleImgLoad, true);document.addEventListener('load', handleImgLoad, true);+document.addEventListener('click', handleClickLink, true);root.render(<React.StrictMode>