Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBERF-9173 Fix links navigation #7715

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions packages/presentation/src/components/NavLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {}
}
Expand Down
13 changes: 10 additions & 3 deletions packages/presentation/src/components/markup/Mark.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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) {
Expand Down
Loading