mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 14:29:25 +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 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);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@@ -120,9 +120,7 @@ function nav() {
|
||||
},
|
||||
{
|
||||
text: '💻 Open Editor',
|
||||
link: 'https://mermaid.live/edit',
|
||||
target: '_blank',
|
||||
rel: 'external',
|
||||
link: '/',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ hero:
|
||||
actions:
|
||||
- theme: brand
|
||||
text: Try Playground
|
||||
link: /
|
||||
- theme: alt
|
||||
text: Get started
|
||||
link: /intro/
|
||||
|
Reference in New Issue
Block a user