mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 11:50:56 +00:00
UBERF-9173 Fix links navigation (#7715)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
46084e0c82
commit
2613e625c9
@ -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 {}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user