Readonly fixes (#9407)

Signed-off-by: Anton Alexeyev <alexeyev.anton@gmail.com>
This commit is contained in:
Anton Alexeyev
2025-06-30 16:23:34 +07:00
committed by GitHub
parent 8d12b2c133
commit 5eccbe6464
34 changed files with 127 additions and 70 deletions
@@ -14,8 +14,8 @@
-->
<script lang="ts">
import { concatLink, Doc, Hierarchy } from '@hcengineering/core'
import presentation, { NavLink, getClient } from '@hcengineering/presentation'
import { AnyComponent, getPanelURI, locationToUrl } from '@hcengineering/ui'
import presentation, { NavLink, getClient, createQuery, MessageBox } from '@hcengineering/presentation'
import { AnyComponent, getPanelURI, locationToUrl, showPopup } from '@hcengineering/ui'
import view from '../plugin'
import { getObjectLinkFragment, restrictionStore } from '../utils'
import { getMetadata } from '@hcengineering/platform'
@@ -37,11 +37,20 @@
export let noSelect: boolean = true
export let title: string | undefined = undefined
const docQuery = createQuery()
const client = getClient()
const hierarchy = client.getHierarchy()
let broken: boolean = false
let _disabled = disabled || $restrictionStore.disableNavigation
$: _disabled = disabled || $restrictionStore.disableNavigation
const client = getClient()
const hierarchy = client.getHierarchy()
$: if (object?._class != null && object?._id != null && hierarchy.hasClass(object?._class)) {
docQuery.query(object?._class, { _id: object?._id }, (r) => {
broken = r.shift() === undefined
})
}
let href: string | undefined =
object !== undefined
@@ -61,23 +70,39 @@
}
$: if (object !== undefined) getHref(object)
function onBrokenLinkClick (event: MouseEvent): void {
showPopup(MessageBox, {
label: presentation.string.UnableToFollowMention,
message: presentation.string.AccessDenied,
canSubmit: false
})
}
</script>
<NavLink
disabled={_disabled}
{onClick}
{noUnderline}
{inline}
{shrink}
{href}
{colorInherit}
{accent}
{noOverflow}
{inlineReference}
{transparent}
{inlineBlock}
{noSelect}
{title}
>
<slot />
</NavLink>
{#if broken}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<span class="antiMention" class:transparent class:broken on:click={onBrokenLinkClick}>
<slot />
</span>
{:else}
<NavLink
disabled={_disabled}
{onClick}
{noUnderline}
{inline}
{shrink}
{href}
{colorInherit}
{accent}
{noOverflow}
{inlineReference}
{transparent}
{inlineBlock}
{noSelect}
{title}
>
<slot />
</NavLink>
{/if}
@@ -1,5 +1,6 @@
<script lang="ts">
import { Notification, NotificationToast } from '@hcengineering/ui'
import { Button, Notification, NotificationToast } from '@hcengineering/ui'
import view from '@hcengineering/view'
export let onRemove: () => void
export let notification: Notification
@@ -9,4 +10,10 @@
<svelte:fragment slot="content">
{notification.subTitle}
</svelte:fragment>
<svelte:fragment slot="buttons">
<div style="width: auto" />
<a href="https://huly.io/signup" target="_blank">
<Button label={view.string.ReadOnlySignUp} stopPropagation={false} />
</a>
</svelte:fragment>
</NotificationToast>