mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-25 09:50:19 +00:00
Fix remove tag (#2939)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
50b0f3b7c6
commit
fdae734430
@ -59,7 +59,7 @@
|
||||
{value.title}
|
||||
</span>
|
||||
{#if isEditable}
|
||||
<button class="btn-close" on:click|stopPropagation={() => dispatch('remove', value.tag)}>
|
||||
<button class="btn-close" on:click|stopPropagation={() => dispatch('remove', value)}>
|
||||
<Icon icon={IconClose} size={'x-small'} />
|
||||
</button>
|
||||
{/if}
|
||||
|
@ -1,10 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { AnyAttribute, Doc } from '@hcengineering/core'
|
||||
import { IntlString } from '@hcengineering/platform'
|
||||
import { AnyAttribute, Doc, Ref } from '@hcengineering/core'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import type { TagReference, TagElement } from '@hcengineering/tags'
|
||||
import type { TagReference } from '@hcengineering/tags'
|
||||
import tags from '@hcengineering/tags'
|
||||
import { getEventPopupPositionElement, Icon, IconAdd, Label, showPopup } from '@hcengineering/ui'
|
||||
import { Icon, IconAdd, Label, getEventPopupPositionElement, showPopup } from '@hcengineering/ui'
|
||||
import TagReferencePresenter from './TagReferencePresenter.svelte'
|
||||
import TagsEditorPopup from './TagsEditorPopup.svelte'
|
||||
|
||||
@ -24,9 +24,8 @@
|
||||
if (readonly) return
|
||||
showPopup(TagsEditorPopup, { object }, getEventPopupPositionElement(evt))
|
||||
}
|
||||
async function removeTag (tag: Ref<TagElement>): Promise<void> {
|
||||
const tagRef = await client.findOne(tags.class.TagReference, { tag })
|
||||
if (tagRef) await client.remove(tagRef)
|
||||
async function removeTag (tag: TagReference): Promise<void> {
|
||||
if (tag !== undefined) await client.remove(tag)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user