Focus on editor when already creating (#2629)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-02-13 16:45:57 +05:00 committed by GitHub
parent 17421a18b2
commit 67a2053d52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,7 @@
import { Ref, SortingOrder, toIdMap, WithLookup } from '@hcengineering/core' import { Ref, SortingOrder, toIdMap, WithLookup } from '@hcengineering/core'
import { createQuery } from '@hcengineering/presentation' import { createQuery } from '@hcengineering/presentation'
import { Issue, IssueStatus, Team } from '@hcengineering/tracker' import { Issue, IssueStatus, Team } from '@hcengineering/tracker'
import { Button, Chevron, closeTooltip, ExpandCollapse, IconAdd, Label } from '@hcengineering/ui' import { Button, Chevron, closeTooltip, ExpandCollapse, IconAdd, IconArrowRight, Label } from '@hcengineering/ui'
import view, { Viewlet } from '@hcengineering/view' import view, { Viewlet } from '@hcengineering/view'
import { getViewOptions, ViewletSettingButton } from '@hcengineering/view-resources' import { getViewOptions, ViewletSettingButton } from '@hcengineering/view-resources'
import tracker from '../../../plugin' import tracker from '../../../plugin'
@ -27,6 +27,7 @@
export let teams: Map<Ref<Team>, Team> export let teams: Map<Ref<Team>, Team>
export let issueStatuses: Map<Ref<Team>, WithLookup<IssueStatus>[]> export let issueStatuses: Map<Ref<Team>, WithLookup<IssueStatus>[]>
let subIssueEditorRef: HTMLDivElement
let isCollapsed = false let isCollapsed = false
let isCreating = false let isCreating = false
@ -101,7 +102,7 @@
<Button <Button
id="add-sub-issue" id="add-sub-issue"
width="min-content" width="min-content"
icon={hasSubIssues ? IconAdd : undefined} icon={hasSubIssues ? (isCreating ? IconArrowRight : IconAdd) : undefined}
label={hasSubIssues ? undefined : tracker.string.AddSubIssues} label={hasSubIssues ? undefined : tracker.string.AddSubIssues}
labelParams={{ subIssues: 0 }} labelParams={{ subIssues: 0 }}
kind={'transparent'} kind={'transparent'}
@ -109,6 +110,7 @@
showTooltip={{ label: tracker.string.AddSubIssues, props: { subIssues: 1 }, direction: 'bottom' }} showTooltip={{ label: tracker.string.AddSubIssues, props: { subIssues: 1 }, direction: 'bottom' }}
on:click={() => { on:click={() => {
closeTooltip() closeTooltip()
isCreating && subIssueEditorRef && subIssueEditorRef.scrollIntoView({ behavior: 'smooth' })
isCreating = true isCreating = true
isCollapsed = false isCollapsed = false
}} }}
@ -135,7 +137,7 @@
{@const team = teams.get(issue.space)} {@const team = teams.get(issue.space)}
{@const statuses = issueStatuses.get(issue.space)} {@const statuses = issueStatuses.get(issue.space)}
{#if team !== undefined && statuses !== undefined} {#if team !== undefined && statuses !== undefined}
<div class="pt-4"> <div class="pt-4" bind:this={subIssueEditorRef}>
<CreateSubIssue <CreateSubIssue
parentIssue={issue} parentIssue={issue}
issueStatuses={statuses} issueStatuses={statuses}