mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-20 23:32:14 +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.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<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 href: string | undefined
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
@ -43,11 +44,16 @@
|
|||||||
closeTooltip()
|
closeTooltip()
|
||||||
try {
|
try {
|
||||||
const url = new URL(href)
|
const url = new URL(href)
|
||||||
|
|
||||||
if (url.origin === window.location.origin) {
|
if (url.origin === window.location.origin) {
|
||||||
|
const loc = parseLocation(url)
|
||||||
|
const routes = getMetadata(uiPlugin.metadata.Routes)
|
||||||
|
const app = routes?.get(loc.path[0])
|
||||||
|
|
||||||
|
if (app !== undefined) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
navigate(parseLocation(url))
|
navigate(loc)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getMetadata } from '@hcengineering/platform'
|
import { getMetadata } from '@hcengineering/platform'
|
||||||
import { MarkupMark, MarkupMarkType } from '@hcengineering/text'
|
import { MarkupMark, MarkupMarkType } from '@hcengineering/text'
|
||||||
import { navigate, parseLocation } from '@hcengineering/ui'
|
import uiPlugin, { navigate, parseLocation } from '@hcengineering/ui'
|
||||||
|
|
||||||
import presentation from '../../plugin'
|
import presentation from '../../plugin'
|
||||||
|
|
||||||
@ -29,8 +29,15 @@
|
|||||||
const frontUrl = getMetadata(presentation.metadata.FrontUrl) ?? window.location.origin
|
const frontUrl = getMetadata(presentation.metadata.FrontUrl) ?? window.location.origin
|
||||||
|
|
||||||
if (url.origin === frontUrl) {
|
if (url.origin === frontUrl) {
|
||||||
|
const loc = parseLocation(url)
|
||||||
|
const routes = getMetadata(uiPlugin.metadata.Routes)
|
||||||
|
const app = routes?.get(loc.path[0])
|
||||||
|
|
||||||
|
if (app !== undefined) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
navigate(parseLocation(url))
|
e.stopPropagation()
|
||||||
|
navigate(loc)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user