Skip to content

Commit

Permalink
UBERF-9173 Fix links navigation
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Onnikov <[email protected]>
  • Loading branch information
aonnikov committed Jan 20, 2025
1 parent f184962 commit c3a22f2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
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

0 comments on commit c3a22f2

Please sign in to comment.