mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 11:42:30 +03:00
TSK-435: Fix create issue edit focus lost. (#2396)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
34c3d07e5c
commit
46b70a2e9c
@ -67,6 +67,7 @@ async function loadTranslationsForComponent (plugin: Plugin, locale: string): Pr
|
||||
try {
|
||||
return (await loader(locale)) as Record<string, IntlString> | Status
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
const status = unknownError(err)
|
||||
await setPlatformStatus(status)
|
||||
return status
|
||||
|
@ -124,7 +124,7 @@
|
||||
.ProseMirror {
|
||||
flex-grow: 1;
|
||||
overflow: auto;
|
||||
min-height: 3rem;
|
||||
min-height: inherit !important;
|
||||
max-height: inherit !important;
|
||||
outline: none;
|
||||
line-height: 150%;
|
||||
|
@ -587,7 +587,7 @@
|
||||
<style lang="scss" global>
|
||||
.ProseMirror {
|
||||
flex-grow: 1;
|
||||
min-height: 3rem;
|
||||
min-height: inherit !important;
|
||||
max-height: inherit !important;
|
||||
outline: none;
|
||||
line-height: 150%;
|
||||
|
@ -216,7 +216,7 @@
|
||||
<style lang="scss" global>
|
||||
.ProseMirror {
|
||||
overflow-y: auto;
|
||||
min-height: 3rem;
|
||||
min-height: inherit !important;
|
||||
max-height: inherit !important;
|
||||
outline: none;
|
||||
line-height: 150%;
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { NotificationPosition } from './NotificationPosition'
|
||||
import { NotificationSeverity } from './NotificationSeverity'
|
||||
import { AnyComponent } from '../../types'
|
||||
import { AnyComponent, AnySvelteComponent } from '../../types'
|
||||
|
||||
export interface Notification {
|
||||
id: string
|
||||
title: string
|
||||
component: AnyComponent
|
||||
component: AnyComponent | AnySvelteComponent
|
||||
subTitle?: string
|
||||
subTitlePostfix?: string
|
||||
position: NotificationPosition
|
||||
|
@ -95,6 +95,14 @@
|
||||
let labels: TagReference[] = draft?.labels || []
|
||||
let objectId: Ref<Issue> = draft?.issueId || generateId()
|
||||
|
||||
function toIssue (initials: AttachedData<Issue>, draft: IssueDraft | null): AttachedData<Issue> {
|
||||
if (draft == null) {
|
||||
return { ...initials }
|
||||
}
|
||||
const { labels, subIssues, ...issue } = draft
|
||||
return { ...initials, ...issue }
|
||||
}
|
||||
|
||||
let object: AttachedData<Issue> = originalIssue
|
||||
? {
|
||||
...originalIssue,
|
||||
@ -105,7 +113,8 @@
|
||||
reports: 0,
|
||||
childInfo: []
|
||||
}
|
||||
: {
|
||||
: toIssue(
|
||||
{
|
||||
title: '',
|
||||
description: '',
|
||||
assignee,
|
||||
@ -122,9 +131,10 @@
|
||||
reportedTime: 0,
|
||||
estimation: 0,
|
||||
reports: 0,
|
||||
childInfo: [],
|
||||
...(draft || {})
|
||||
}
|
||||
childInfo: []
|
||||
},
|
||||
draft
|
||||
)
|
||||
|
||||
function resetObject (): void {
|
||||
templateId = undefined
|
||||
@ -260,7 +270,7 @@
|
||||
return
|
||||
}
|
||||
|
||||
parentIssue = await client.findOne(tracker.class.Issue, { _id: draft.parentIssue })
|
||||
parentIssue = await client.findOne(tracker.class.Issue, { _id: draft.parentIssue as Ref<Issue> })
|
||||
}
|
||||
|
||||
$: originalIssue && setPropsFromOriginalIssue()
|
||||
@ -288,7 +298,7 @@
|
||||
}
|
||||
|
||||
async function isDraftEmpty (draft: Data<IssueDraft>): Promise<boolean> {
|
||||
const emptyDraft = {
|
||||
const emptyDraft: Partial<IssueDraft> = {
|
||||
assignee: null,
|
||||
description: '',
|
||||
dueDate: null,
|
||||
@ -304,7 +314,7 @@
|
||||
}
|
||||
|
||||
for (const key of Object.keys(emptyDraft)) {
|
||||
if (!deepEqual(emptyDraft[key], draft[key])) {
|
||||
if (!deepEqual((emptyDraft as any)[key], (draft as any)[key])) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -509,6 +519,7 @@
|
||||
}
|
||||
|
||||
const notification: Notification = {
|
||||
id: generateId(),
|
||||
title: tracker.string.IssueCreated,
|
||||
subTitle: getTitle(object.title),
|
||||
severity: NotificationSeverity.Success,
|
||||
@ -695,20 +706,18 @@
|
||||
<ParentIssue issue={parentIssue} on:close={clearParentIssue} />
|
||||
{/if}
|
||||
<EditBox bind:value={object.title} placeholder={tracker.string.IssueTitlePlaceholder} kind={'large-style'} focus />
|
||||
{#key object.description}
|
||||
<AttachmentStyledBox
|
||||
bind:this={descriptionBox}
|
||||
{objectId}
|
||||
_class={tracker.class.Issue}
|
||||
space={_space}
|
||||
alwaysEdit
|
||||
showButtons={false}
|
||||
maxHeight={'20vh'}
|
||||
bind:content={object.description}
|
||||
placeholder={tracker.string.IssueDescriptionPlaceholder}
|
||||
on:changeSize={() => dispatch('changeContent')}
|
||||
/>
|
||||
{/key}
|
||||
<AttachmentStyledBox
|
||||
bind:this={descriptionBox}
|
||||
{objectId}
|
||||
_class={tracker.class.Issue}
|
||||
space={_space}
|
||||
alwaysEdit
|
||||
showButtons={false}
|
||||
maxHeight={'20vh'}
|
||||
bind:content={object.description}
|
||||
placeholder={tracker.string.IssueDescriptionPlaceholder}
|
||||
on:changeSize={() => dispatch('changeContent')}
|
||||
/>
|
||||
<IssueTemplateChilds
|
||||
bind:children={subIssues}
|
||||
sprint={object.sprint}
|
||||
|
@ -18,7 +18,7 @@
|
||||
import IssuePresenter from './IssuePresenter.svelte'
|
||||
import tracker from '../../plugin'
|
||||
|
||||
export let notification: Notification = {}
|
||||
export let notification: Notification
|
||||
export let onRemove: () => void
|
||||
|
||||
const issueQuery = createQuery()
|
||||
|
@ -67,6 +67,7 @@
|
||||
|
||||
function resetToDefaults () {
|
||||
newIssue = getIssueDefaults()
|
||||
labels = []
|
||||
focusIssueTitle?.()
|
||||
}
|
||||
|
||||
|
@ -212,21 +212,21 @@
|
||||
kind="large-style"
|
||||
/>
|
||||
<div class="flex-between mt-6">
|
||||
{#key description}
|
||||
<div class="flex-grow">
|
||||
<AttachmentStyledBox
|
||||
bind:this={descriptionBox}
|
||||
objectId={_id}
|
||||
_class={tracker.class.Issue}
|
||||
space={template.space}
|
||||
alwaysEdit
|
||||
showButtons
|
||||
maxHeight={'card'}
|
||||
bind:content={description}
|
||||
placeholder={tracker.string.IssueDescriptionPlaceholder}
|
||||
/>
|
||||
</div>
|
||||
{/key}
|
||||
<div class="flex-grow">
|
||||
<AttachmentStyledBox
|
||||
bind:this={descriptionBox}
|
||||
objectId={_id}
|
||||
_class={tracker.class.Issue}
|
||||
space={template.space}
|
||||
alwaysEdit
|
||||
showButtons
|
||||
maxHeight={'card'}
|
||||
bind:content={description}
|
||||
placeholder={tracker.string.IssueDescriptionPlaceholder}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
class="tool"
|
||||
on:click={() => {
|
||||
@ -242,6 +242,7 @@
|
||||
<span class="title select-text">{title}</span>
|
||||
<div class="mt-6 description-preview select-text">
|
||||
{#if isDescriptionEmpty}
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div class="placeholder" on:click={edit}>
|
||||
<Label label={tracker.string.IssueDescriptionPlaceholder} />
|
||||
</div>
|
||||
|
@ -14,18 +14,7 @@
|
||||
//
|
||||
|
||||
import { Employee } from '@hcengineering/contact'
|
||||
import type {
|
||||
AttachedDoc,
|
||||
Class,
|
||||
Doc,
|
||||
Markup,
|
||||
Obj,
|
||||
Ref,
|
||||
RelatedDocument,
|
||||
Space,
|
||||
Timestamp,
|
||||
Type
|
||||
} from '@hcengineering/core'
|
||||
import type { AttachedDoc, Class, Doc, Markup, Ref, RelatedDocument, Space, Timestamp, Type } from '@hcengineering/core'
|
||||
import type { Asset, IntlString, Plugin, Resource } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
import type { TagCategory, TagElement } from '@hcengineering/tags'
|
||||
@ -197,7 +186,7 @@ export interface Issue extends AttachedDoc {
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface IssueDraft extends Obj {
|
||||
export interface IssueDraft extends Doc {
|
||||
issueId: Ref<Issue>
|
||||
title: string
|
||||
description: Markup
|
||||
|
@ -15,7 +15,7 @@
|
||||
//
|
||||
|
||||
import { AccountMethod, ACCOUNT_DB } from '@hcengineering/account'
|
||||
import platform, { Request, Response, serialize, setMetadata, Severity, Status } from '@hcengineering/platform'
|
||||
import platform, { Response, serialize, setMetadata, Severity, Status } from '@hcengineering/platform'
|
||||
import serverToken from '@hcengineering/server-token'
|
||||
import toolPlugin from '@hcengineering/server-tool'
|
||||
import cors from '@koa/cors'
|
||||
@ -23,7 +23,7 @@ import { IncomingHttpHeaders } from 'http'
|
||||
import Koa from 'koa'
|
||||
import bodyParser from 'koa-bodyparser'
|
||||
import Router from 'koa-router'
|
||||
import { Db, MongoClient } from 'mongodb'
|
||||
import { MongoClient } from 'mongodb'
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -71,9 +71,7 @@ export function serveAccount (methods: Record<string, AccountMethod>, productId
|
||||
const token = extractToken(ctx.request.headers)
|
||||
|
||||
const request = ctx.request.body as any
|
||||
const method = (
|
||||
methods as { [key: string]: (db: Db, productId: string, request: Request<any>, token?: string) => Response<any> }
|
||||
)[request.method]
|
||||
const method = (methods as { [key: string]: AccountMethod })[request.method]
|
||||
if (method === undefined) {
|
||||
const response: Response<void> = {
|
||||
id: request.id,
|
||||
|
Loading…
Reference in New Issue
Block a user