UBERF-9173 Fix links navigation (#7715)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2025-01-20 15:24:39 +07:00 committed by GitHub
parent 46084e0c82
commit 2613e625c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 8 deletions

View File

@ -13,7 +13,8 @@
// limitations under the License.
-->
<script lang="ts">
import { closePopup, closeTooltip, navigate, parseLocation } from '@hcengineering/ui'
import { getMetadata } from '@hcengineering/platform'
import uiPlugin, { closePopup, closeTooltip, navigate, parseLocation } from '@hcengineering/ui'
export let href: string | undefined
export let disabled = false
@ -43,11 +44,16 @@
closeTooltip()
try {
const url = new URL(href)
if (url.origin === window.location.origin) {
e.preventDefault()
e.stopPropagation()
navigate(parseLocation(url))
const loc = parseLocation(url)
const routes = getMetadata(uiPlugin.metadata.Routes)
const app = routes?.get(loc.path[0])
if (app !== undefined) {
e.preventDefault()
e.stopPropagation()
navigate(loc)
}
}
} catch {}
}

View File

@ -15,7 +15,7 @@
<script lang="ts">
import { getMetadata } from '@hcengineering/platform'
import { MarkupMark, MarkupMarkType } from '@hcengineering/text'
import { navigate, parseLocation } from '@hcengineering/ui'
import uiPlugin, { navigate, parseLocation } from '@hcengineering/ui'
import presentation from '../../plugin'
@ -29,8 +29,15 @@
const frontUrl = getMetadata(presentation.metadata.FrontUrl) ?? window.location.origin
if (url.origin === frontUrl) {
e.preventDefault()
navigate(parseLocation(url))
const loc = parseLocation(url)
const routes = getMetadata(uiPlugin.metadata.Routes)
const app = routes?.get(loc.path[0])
if (app !== undefined) {
e.preventDefault()
e.stopPropagation()
navigate(loc)
}
}
}
} catch (err) {