mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-25 03:06:50 +02:00
chore: add event listener for button.
This commit is contained in:
@@ -83,21 +83,24 @@ const featureColumns = ref<Feature[][]>([
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const isVisible = ref(true);
|
const isVisible = ref(false);
|
||||||
|
|
||||||
const handleMouseDown = (e: MouseEvent) => {
|
const handleMouseDown = (e: MouseEvent) => {
|
||||||
const target = e.target as HTMLElement;
|
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;
|
isVisible.value = !isVisible.value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.addEventListener('mousedown', handleMouseDown);
|
document.addEventListener('click', handleMouseDown);
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
document.removeEventListener('mousedown', handleMouseDown);
|
document.removeEventListener('click', handleMouseDown);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -120,9 +120,7 @@ function nav() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '💻 Open Editor',
|
text: '💻 Open Editor',
|
||||||
link: 'https://mermaid.live/edit',
|
link: '/',
|
||||||
target: '_blank',
|
|
||||||
rel: 'external',
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,7 @@ hero:
|
|||||||
actions:
|
actions:
|
||||||
- theme: brand
|
- theme: brand
|
||||||
text: Try Playground
|
text: Try Playground
|
||||||
|
link: /
|
||||||
- theme: alt
|
- theme: alt
|
||||||
text: Get started
|
text: Get started
|
||||||
link: /intro/
|
link: /intro/
|
||||||
|
Reference in New Issue
Block a user