diff --git a/packages/mermaid/src/docs/.vitepress/components/EditorSelectionModal.vue b/packages/mermaid/src/docs/.vitepress/components/EditorSelectionModal.vue index f41759f75..a53e1c9e7 100644 --- a/packages/mermaid/src/docs/.vitepress/components/EditorSelectionModal.vue +++ b/packages/mermaid/src/docs/.vitepress/components/EditorSelectionModal.vue @@ -83,21 +83,24 @@ const featureColumns = ref([ ], ]); -const isVisible = ref(true); +const isVisible = ref(false); const handleMouseDown = (e: MouseEvent) => { const target = e.target as HTMLElement; - if (target.matches('a[class*="editorModal"]') || target.matches('button[class*="editorModal"]')) { + if ( + (target.tagName === 'A' && target.textContent?.trim() === 'Try Playground') || + (target.tagName === 'SPAN' && target.textContent?.trim() === '💻 Open Editor') + ) { isVisible.value = !isVisible.value; } }; onMounted(() => { - document.addEventListener('mousedown', handleMouseDown); + document.addEventListener('click', handleMouseDown); }); onUnmounted(() => { - document.removeEventListener('mousedown', handleMouseDown); + document.removeEventListener('click', handleMouseDown); }); diff --git a/packages/mermaid/src/docs/.vitepress/config.ts b/packages/mermaid/src/docs/.vitepress/config.ts index cd66316a3..9771ae6f2 100644 --- a/packages/mermaid/src/docs/.vitepress/config.ts +++ b/packages/mermaid/src/docs/.vitepress/config.ts @@ -120,9 +120,7 @@ function nav() { }, { text: '💻 Open Editor', - link: 'https://mermaid.live/edit', - target: '_blank', - rel: 'external', + link: '/', }, ]; } diff --git a/packages/mermaid/src/docs/index.md b/packages/mermaid/src/docs/index.md index 5f409f7a0..9b3a6f190 100644 --- a/packages/mermaid/src/docs/index.md +++ b/packages/mermaid/src/docs/index.md @@ -17,6 +17,7 @@ hero: actions: - theme: brand text: Try Playground + link: / - theme: alt text: Get started link: /intro/