Skip to content

Commit

Permalink
Merge pull request #6832 from kodadot/beta
Browse files Browse the repository at this point in the history
  • Loading branch information
yangwao authored Aug 20, 2023
2 parents 1474e85 + c948392 commit 63d4be4
Show file tree
Hide file tree
Showing 16 changed files with 370 additions and 683 deletions.
4 changes: 2 additions & 2 deletions components/redirect/RedirectModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const handleRedirect = () => {
</style>

<style lang="scss">
.redirect-modal .modal-content {
width: auto;
.redirect-modal {
z-index: 1000;
}
</style>
8 changes: 4 additions & 4 deletions components/redirect/useRedirectModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
isExternal,
} from '@/utils/url'
import { useEventListener } from '@vueuse/core'
import type { Ref } from 'vue/types'

function isWhiteList(url: string) {
const urlObj = new URL(url)
Expand All @@ -29,17 +30,16 @@ const showModal = (url: string, i18n: VueI18n, modal) => {
modal.open({
component: RedirectModal,
canCancel: ['outside', 'escape'],
rootClass: 'redirect-modal',
rootClass: 'redirect-modal neo-modal',
props: {
url,
i18n,
},
})
}

export const useRedirectModal = (target: string) => {
export const useRedirectModal = (element: Ref<HTMLElement | null>) => {
const { $i18n, $neoModal } = useNuxtApp()
const _dom = computed(() => document.querySelector(target) || document.body)

const handleLink = (event: Event) => {
let ele = event.target as HTMLLinkElement
Expand All @@ -56,7 +56,7 @@ export const useRedirectModal = (target: string) => {
}
}

useEventListener(_dom.value, 'click', handleLink)
useEventListener(element, 'click', handleLink)
}

export default useRedirectModal
5 changes: 4 additions & 1 deletion components/shared/Markdown.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<VueMarkdown
ref="markdown"
:source="source"
:options="highlightOptions"
class="content-markdown" />
Expand All @@ -10,11 +11,13 @@ import VueMarkdown from 'vue-markdown-render'
import hljs from 'highlight.js'
import { useRedirectModal } from '@/components/redirect/useRedirectModal'
const markdown = ref<HTMLElement | null>(null)
defineProps<{
source: string
}>()
useRedirectModal('.content-markdown')
useRedirectModal(markdown)
const highlightOptions = {
html: true,
Expand Down
Loading

0 comments on commit 63d4be4

Please sign in to comment.