mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-20 07:10:02 +00:00
Fix attachments in drafts (#2451)
Signed-off-by: Denis Maslennikov <denis.maslennikov@gmail.com>
This commit is contained in:
parent
12292dbf46
commit
69a229efef
@ -14,7 +14,12 @@ export const draftStore = writable<Record<string, any>>(fetchMetadataLocalStorag
|
|||||||
*/
|
*/
|
||||||
export function updateDraftStore (id: string, draft: any): void {
|
export function updateDraftStore (id: string, draft: any): void {
|
||||||
draftStore.update((drafts) => {
|
draftStore.update((drafts) => {
|
||||||
|
if (draft === undefined) {
|
||||||
drafts[id] = draft
|
drafts[id] = draft
|
||||||
|
} else {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||||
|
delete drafts[id]
|
||||||
|
}
|
||||||
setMetadataLocalStorage(presentation.metadata.Draft, drafts)
|
setMetadataLocalStorage(presentation.metadata.Draft, drafts)
|
||||||
return drafts
|
return drafts
|
||||||
})
|
})
|
||||||
|
@ -142,7 +142,7 @@
|
|||||||
</Scroller>
|
</Scroller>
|
||||||
{#if showCommenInput}
|
{#if showCommenInput}
|
||||||
<div class="ref-input">
|
<div class="ref-input">
|
||||||
<Component is={chunter.component.CommentInput} props={{ object, shouldUseDraft: true }} />
|
<Component is={chunter.component.CommentInput} props={{ object, shouldSaveDraft: true }} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@ -164,7 +164,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{#if showCommenInput}
|
{#if showCommenInput}
|
||||||
<div class="ref-input">
|
<div class="ref-input">
|
||||||
<Component is={chunter.component.CommentInput} props={{ object, shouldUseDraft: true }} />
|
<Component is={chunter.component.CommentInput} props={{ object, shouldSaveDraft: true }} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="p-activity select-text" id={activity.string.Activity}>
|
<div class="p-activity select-text" id={activity.string.Activity}>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
import { createQuery, getClient, draftStore, updateDraftStore } from '@hcengineering/presentation'
|
||||||
import { ReferenceInput } from '@hcengineering/text-editor'
|
import { ReferenceInput } from '@hcengineering/text-editor'
|
||||||
import { deleteFile, uploadFile } from '../utils'
|
import { deleteFile, uploadFile } from '../utils'
|
||||||
import attachment from '../plugin'
|
import attachment from '../plugin'
|
||||||
@ -28,7 +28,8 @@
|
|||||||
export let _class: Ref<Class<Doc>>
|
export let _class: Ref<Class<Doc>>
|
||||||
export let content: string = ''
|
export let content: string = ''
|
||||||
export let showSend = true
|
export let showSend = true
|
||||||
export let shouldUseDraft: boolean = false
|
export let shouldSaveDraft: boolean = false
|
||||||
|
export let attachments: Map<Ref<Attachment>, Attachment> = new Map<Ref<Attachment>, Attachment>()
|
||||||
export function submit (): void {
|
export function submit (): void {
|
||||||
refInput.submit()
|
refInput.submit()
|
||||||
}
|
}
|
||||||
@ -41,14 +42,29 @@
|
|||||||
const client = getClient()
|
const client = getClient()
|
||||||
const query = createQuery()
|
const query = createQuery()
|
||||||
|
|
||||||
let attachments: Map<Ref<Attachment>, Attachment> = new Map<Ref<Attachment>, Attachment>()
|
let draftAttachments: Record<Ref<Attachment>, Attachment> | undefined = undefined
|
||||||
let originalAttachments: Set<Ref<Attachment>> = new Set<Ref<Attachment>>()
|
let originalAttachments: Set<Ref<Attachment>> = new Set<Ref<Attachment>>()
|
||||||
const newAttachments: Set<Ref<Attachment>> = new Set<Ref<Attachment>>()
|
const newAttachments: Set<Ref<Attachment>> = new Set<Ref<Attachment>>()
|
||||||
const removedAttachments: Set<Attachment> = new Set<Attachment>()
|
const removedAttachments: Set<Attachment> = new Set<Attachment>()
|
||||||
|
|
||||||
let refContainer: HTMLElement
|
let refContainer: HTMLElement
|
||||||
|
|
||||||
$: objectId &&
|
$: objectId && updateAttachments(objectId)
|
||||||
|
|
||||||
|
async function updateAttachments (objectId: Ref<Doc>) {
|
||||||
|
draftAttachments = $draftStore[objectId]
|
||||||
|
if (draftAttachments && shouldSaveDraft) {
|
||||||
|
attachments.clear()
|
||||||
|
newAttachments.clear()
|
||||||
|
Object.entries(draftAttachments).map((file) => {
|
||||||
|
return attachments.set(file[0] as Ref<Attachment>, file[1])
|
||||||
|
})
|
||||||
|
Object.entries(draftAttachments).map((file) => {
|
||||||
|
return newAttachments.add(file[0] as Ref<Attachment>)
|
||||||
|
})
|
||||||
|
originalAttachments.clear()
|
||||||
|
removedAttachments.clear()
|
||||||
|
} else {
|
||||||
query.query(
|
query.query(
|
||||||
attachment.class.Attachment,
|
attachment.class.Attachment,
|
||||||
{
|
{
|
||||||
@ -59,6 +75,15 @@
|
|||||||
attachments = new Map(res.map((p) => [p._id, p]))
|
attachments = new Map(res.map((p) => [p._id, p]))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveDraft () {
|
||||||
|
if (objectId && shouldSaveDraft) {
|
||||||
|
draftAttachments = Object.fromEntries(attachments)
|
||||||
|
updateDraftStore(objectId, draftAttachments)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function createAttachment (file: File) {
|
async function createAttachment (file: File) {
|
||||||
try {
|
try {
|
||||||
@ -81,9 +106,7 @@
|
|||||||
})
|
})
|
||||||
newAttachments.add(_id)
|
newAttachments.add(_id)
|
||||||
attachments = attachments
|
attachments = attachments
|
||||||
if (shouldUseDraft) {
|
saveDraft()
|
||||||
await createAttachments()
|
|
||||||
}
|
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setPlatformStatus(unknownError(err))
|
setPlatformStatus(unknownError(err))
|
||||||
}
|
}
|
||||||
@ -115,10 +138,11 @@
|
|||||||
async function removeAttachment (attachment: Attachment): Promise<void> {
|
async function removeAttachment (attachment: Attachment): Promise<void> {
|
||||||
removedAttachments.add(attachment)
|
removedAttachments.add(attachment)
|
||||||
attachments.delete(attachment._id)
|
attachments.delete(attachment._id)
|
||||||
if (shouldUseDraft) {
|
if (shouldSaveDraft) {
|
||||||
await createAttachments()
|
await createAttachments()
|
||||||
}
|
}
|
||||||
attachments = attachments
|
attachments = attachments
|
||||||
|
saveDraft()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteAttachment (attachment: Attachment): Promise<void> {
|
async function deleteAttachment (attachment: Attachment): Promise<void> {
|
||||||
@ -137,7 +161,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
if (!saved) {
|
if (!saved && !shouldSaveDraft) {
|
||||||
newAttachments.forEach(async (p) => {
|
newAttachments.forEach(async (p) => {
|
||||||
const attachment = attachments.get(p)
|
const attachment = attachments.get(p)
|
||||||
if (attachment !== undefined) {
|
if (attachment !== undefined) {
|
||||||
@ -147,6 +171,20 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export function removeDraft (removeFiles: boolean) {
|
||||||
|
if (objectId) {
|
||||||
|
updateDraftStore(objectId, undefined)
|
||||||
|
}
|
||||||
|
if (removeFiles) {
|
||||||
|
newAttachments.forEach(async (p) => {
|
||||||
|
const attachment = attachments.get(p)
|
||||||
|
if (attachment !== undefined) {
|
||||||
|
await deleteFile(attachment.file)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function createAttachments (): Promise<void> {
|
export function createAttachments (): Promise<void> {
|
||||||
saved = true
|
saved = true
|
||||||
const promises: Promise<any>[] = []
|
const promises: Promise<any>[] = []
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import { Attachment } from '@hcengineering/attachment'
|
import { Attachment } from '@hcengineering/attachment'
|
||||||
import { Account, Class, Doc, generateId, Ref, Space } from '@hcengineering/core'
|
import { Account, Class, Doc, generateId, Ref, Space } from '@hcengineering/core'
|
||||||
import { IntlString, setPlatformStatus, unknownError } from '@hcengineering/platform'
|
import { IntlString, setPlatformStatus, unknownError } from '@hcengineering/platform'
|
||||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
import { createQuery, getClient, draftStore, updateDraftStore } from '@hcengineering/presentation'
|
||||||
import { StyledTextBox } from '@hcengineering/text-editor'
|
import { StyledTextBox } from '@hcengineering/text-editor'
|
||||||
import { IconSize } from '@hcengineering/ui'
|
import { IconSize } from '@hcengineering/ui'
|
||||||
import { createEventDispatcher, onDestroy } from 'svelte'
|
import { createEventDispatcher, onDestroy } from 'svelte'
|
||||||
@ -37,6 +37,7 @@
|
|||||||
export let focusable: boolean = false
|
export let focusable: boolean = false
|
||||||
export let fakeAttach: 'fake' | 'hidden' | 'normal' = 'normal'
|
export let fakeAttach: 'fake' | 'hidden' | 'normal' = 'normal'
|
||||||
export let refContainer: HTMLElement | undefined = undefined
|
export let refContainer: HTMLElement | undefined = undefined
|
||||||
|
export let shouldSaveDraft: boolean = false
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
@ -62,6 +63,7 @@
|
|||||||
let refInput: StyledTextBox
|
let refInput: StyledTextBox
|
||||||
|
|
||||||
let inputFile: HTMLInputElement
|
let inputFile: HTMLInputElement
|
||||||
|
let draftAttachments: Record<Ref<Attachment>, Attachment> | undefined = undefined
|
||||||
let saved = false
|
let saved = false
|
||||||
|
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
@ -71,7 +73,22 @@
|
|||||||
const newAttachments: Set<Ref<Attachment>> = new Set<Ref<Attachment>>()
|
const newAttachments: Set<Ref<Attachment>> = new Set<Ref<Attachment>>()
|
||||||
const removedAttachments: Set<Attachment> = new Set<Attachment>()
|
const removedAttachments: Set<Attachment> = new Set<Attachment>()
|
||||||
|
|
||||||
$: objectId &&
|
$: objectId && updateAttachments(objectId)
|
||||||
|
|
||||||
|
async function updateAttachments (objectId: Ref<Doc>) {
|
||||||
|
draftAttachments = $draftStore[objectId]
|
||||||
|
if (draftAttachments && shouldSaveDraft) {
|
||||||
|
attachments.clear()
|
||||||
|
newAttachments.clear()
|
||||||
|
Object.entries(draftAttachments).map((file) => {
|
||||||
|
return attachments.set(file[0] as Ref<Attachment>, file[1])
|
||||||
|
})
|
||||||
|
Object.entries(draftAttachments).map((file) => {
|
||||||
|
return newAttachments.add(file[0] as Ref<Attachment>)
|
||||||
|
})
|
||||||
|
originalAttachments.clear()
|
||||||
|
removedAttachments.clear()
|
||||||
|
} else {
|
||||||
query.query(
|
query.query(
|
||||||
attachment.class.Attachment,
|
attachment.class.Attachment,
|
||||||
{
|
{
|
||||||
@ -82,6 +99,15 @@
|
|||||||
attachments = new Map(res.map((p) => [p._id, p]))
|
attachments = new Map(res.map((p) => [p._id, p]))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveDraft () {
|
||||||
|
if (objectId && shouldSaveDraft) {
|
||||||
|
draftAttachments = Object.fromEntries(attachments)
|
||||||
|
updateDraftStore(objectId, draftAttachments)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function createAttachment (file: File) {
|
async function createAttachment (file: File) {
|
||||||
if (space === undefined || objectId === undefined || _class === undefined) return
|
if (space === undefined || objectId === undefined || _class === undefined) return
|
||||||
@ -105,6 +131,7 @@
|
|||||||
})
|
})
|
||||||
newAttachments.add(_id)
|
newAttachments.add(_id)
|
||||||
attachments = attachments
|
attachments = attachments
|
||||||
|
saveDraft()
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setPlatformStatus(unknownError(err))
|
setPlatformStatus(unknownError(err))
|
||||||
}
|
}
|
||||||
@ -139,6 +166,7 @@
|
|||||||
removedAttachments.add(attachment)
|
removedAttachments.add(attachment)
|
||||||
attachments.delete(attachment._id)
|
attachments.delete(attachment._id)
|
||||||
attachments = attachments
|
attachments = attachments
|
||||||
|
saveDraft()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteAttachment (attachment: Attachment): Promise<void> {
|
async function deleteAttachment (attachment: Attachment): Promise<void> {
|
||||||
@ -157,7 +185,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
if (!saved) {
|
if (!saved && !shouldSaveDraft) {
|
||||||
newAttachments.forEach(async (p) => {
|
newAttachments.forEach(async (p) => {
|
||||||
const attachment = attachments.get(p)
|
const attachment = attachments.get(p)
|
||||||
if (attachment !== undefined) {
|
if (attachment !== undefined) {
|
||||||
@ -167,6 +195,20 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export function removeDraft (removeFiles: boolean) {
|
||||||
|
if (objectId) {
|
||||||
|
updateDraftStore(objectId, undefined)
|
||||||
|
}
|
||||||
|
if (removeFiles) {
|
||||||
|
newAttachments.forEach(async (p) => {
|
||||||
|
const attachment = attachments.get(p)
|
||||||
|
if (attachment !== undefined) {
|
||||||
|
await deleteFile(attachment.file)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function createAttachments (): Promise<void> {
|
export function createAttachments (): Promise<void> {
|
||||||
saved = true
|
saved = true
|
||||||
const promises: Promise<any>[] = []
|
const promises: Promise<any>[] = []
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
import chunter from '../plugin'
|
import chunter from '../plugin'
|
||||||
|
|
||||||
export let object: Doc
|
export let object: Doc
|
||||||
export let shouldUseDraft: boolean = false
|
export let shouldSaveDraft: boolean = false
|
||||||
|
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
const _class = chunter.class.Comment
|
const _class = chunter.class.Comment
|
||||||
@ -37,7 +37,7 @@
|
|||||||
$: updateCommentFromDraft(draftComment)
|
$: updateCommentFromDraft(draftComment)
|
||||||
|
|
||||||
async function updateDraft (object: Doc) {
|
async function updateDraft (object: Doc) {
|
||||||
if (!shouldUseDraft) {
|
if (!shouldSaveDraft) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
draftComment = $draftStore[object._id]
|
draftComment = $draftStore[object._id]
|
||||||
@ -47,7 +47,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateCommentFromDraft (draftComment: Comment | undefined) {
|
async function updateCommentFromDraft (draftComment: Comment | undefined) {
|
||||||
if (!shouldUseDraft) {
|
if (!shouldSaveDraft) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
inputContent = draftComment ? draftComment.message : ''
|
inputContent = draftComment ? draftComment.message : ''
|
||||||
@ -59,12 +59,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function saveDraft (object: Doc) {
|
async function saveDraft (object: Doc) {
|
||||||
if (draftComment) {
|
|
||||||
draftComment._id = _id
|
|
||||||
$draftStore[object._id] = draftComment
|
|
||||||
} else {
|
|
||||||
delete $draftStore[object._id]
|
|
||||||
}
|
|
||||||
updateDraftStore(object._id, draftComment)
|
updateDraftStore(object._id, draftComment)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +80,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onUpdate (event: CustomEvent) {
|
async function onUpdate (event: CustomEvent) {
|
||||||
if (!shouldUseDraft) {
|
if (!shouldSaveDraft) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const { message, attachments } = event.detail
|
const { message, attachments } = event.detail
|
||||||
@ -133,6 +127,7 @@
|
|||||||
_id = generateId()
|
_id = generateId()
|
||||||
draftComment = undefined
|
draftComment = undefined
|
||||||
await saveDraft(object)
|
await saveDraft(object)
|
||||||
|
commentInputBox.removeDraft(false)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -142,7 +137,7 @@
|
|||||||
{_class}
|
{_class}
|
||||||
space={object.space}
|
space={object.space}
|
||||||
bind:objectId={_id}
|
bind:objectId={_id}
|
||||||
shouldUseDraft
|
{shouldSaveDraft}
|
||||||
on:message={onMessage}
|
on:message={onMessage}
|
||||||
on:update={onUpdate}
|
on:update={onUpdate}
|
||||||
/>
|
/>
|
||||||
|
@ -82,7 +82,6 @@
|
|||||||
import SetParentIssueActionPopup from './SetParentIssueActionPopup.svelte'
|
import SetParentIssueActionPopup from './SetParentIssueActionPopup.svelte'
|
||||||
import SprintSelector from './sprints/SprintSelector.svelte'
|
import SprintSelector from './sprints/SprintSelector.svelte'
|
||||||
import IssueTemplateChilds from './templates/IssueTemplateChilds.svelte'
|
import IssueTemplateChilds from './templates/IssueTemplateChilds.svelte'
|
||||||
import attachment from '@hcengineering/attachment-resources/src/plugin'
|
|
||||||
import IssueNotification from './issues/IssueNotification.svelte'
|
import IssueNotification from './issues/IssueNotification.svelte'
|
||||||
|
|
||||||
export let space: Ref<Team>
|
export let space: Ref<Team>
|
||||||
@ -97,7 +96,7 @@
|
|||||||
export let originalIssue: Issue | undefined
|
export let originalIssue: Issue | undefined
|
||||||
export let onDraftChanged: () => void
|
export let onDraftChanged: () => void
|
||||||
|
|
||||||
const draft: IssueDraft | undefined = getUserDraft(tracker.class.IssueDraft)
|
const draft: IssueDraft | undefined = shouldSaveDraft ? getUserDraft(tracker.class.IssueDraft) : undefined
|
||||||
|
|
||||||
let issueStatuses: WithLookup<IssueStatus>[] | undefined
|
let issueStatuses: WithLookup<IssueStatus>[] | undefined
|
||||||
let labels: TagReference[] = draft?.labels || []
|
let labels: TagReference[] = draft?.labels || []
|
||||||
@ -106,7 +105,7 @@
|
|||||||
let currentTeam: Team | undefined
|
let currentTeam: Team | undefined
|
||||||
|
|
||||||
function toIssue (initials: AttachedData<Issue>, draft: IssueDraft | undefined): AttachedData<Issue> {
|
function toIssue (initials: AttachedData<Issue>, draft: IssueDraft | undefined): AttachedData<Issue> {
|
||||||
if (draft == null) {
|
if (draft === undefined) {
|
||||||
return { ...initials }
|
return { ...initials }
|
||||||
}
|
}
|
||||||
const { labels, subIssues, ...issue } = draft
|
const { labels, subIssues, ...issue } = draft
|
||||||
@ -125,6 +124,7 @@
|
|||||||
priority,
|
priority,
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
comments: 0,
|
comments: 0,
|
||||||
|
attachments: 0,
|
||||||
subIssues: 0,
|
subIssues: 0,
|
||||||
parents: [],
|
parents: [],
|
||||||
reportedTime: 0,
|
reportedTime: 0,
|
||||||
@ -295,8 +295,6 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await descriptionBox?.createAttachments()
|
|
||||||
|
|
||||||
let newDraft: Data<IssueDraft> | undefined = createDraftFromObject()
|
let newDraft: Data<IssueDraft> | undefined = createDraftFromObject()
|
||||||
const isEmpty = await isDraftEmpty(newDraft)
|
const isEmpty = await isDraftEmpty(newDraft)
|
||||||
|
|
||||||
@ -337,6 +335,7 @@
|
|||||||
description: '',
|
description: '',
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
estimation: 0,
|
estimation: 0,
|
||||||
|
attachments: 0,
|
||||||
labels: [],
|
labels: [],
|
||||||
parentIssue: undefined,
|
parentIssue: undefined,
|
||||||
priority: 0,
|
priority: 0,
|
||||||
@ -351,11 +350,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const attachmentResult = await client.findOne(attachment.class.Attachment, { attachedTo: objectId })
|
// if (object.attachments && object.attachments > 0) {
|
||||||
|
// return false
|
||||||
if (attachmentResult) {
|
// }
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (draft.project && draft.project !== defaultIssue.project) {
|
if (draft.project && draft.project !== defaultIssue.project) {
|
||||||
return false
|
return false
|
||||||
@ -395,6 +392,7 @@
|
|||||||
dueDate: object.dueDate,
|
dueDate: object.dueDate,
|
||||||
estimation: object.estimation,
|
estimation: object.estimation,
|
||||||
template: object.template,
|
template: object.template,
|
||||||
|
attachments: object.attachments,
|
||||||
labels,
|
labels,
|
||||||
parentIssue: parentIssue?._id,
|
parentIssue: parentIssue?._id,
|
||||||
team: _space,
|
team: _space,
|
||||||
@ -562,6 +560,7 @@
|
|||||||
objectId = generateId()
|
objectId = generateId()
|
||||||
resetObject()
|
resetObject()
|
||||||
saveDraft()
|
saveDraft()
|
||||||
|
descriptionBox?.removeDraft(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function showMoreActions (ev: Event) {
|
async function showMoreActions (ev: Event) {
|
||||||
@ -672,6 +671,7 @@
|
|||||||
dispatch('close')
|
dispatch('close')
|
||||||
resetObject()
|
resetObject()
|
||||||
saveDraft()
|
saveDraft()
|
||||||
|
descriptionBox?.removeDraft(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -738,6 +738,7 @@
|
|||||||
<AttachmentStyledBox
|
<AttachmentStyledBox
|
||||||
bind:this={descriptionBox}
|
bind:this={descriptionBox}
|
||||||
{objectId}
|
{objectId}
|
||||||
|
{shouldSaveDraft}
|
||||||
_class={tracker.class.Issue}
|
_class={tracker.class.Issue}
|
||||||
space={_space}
|
space={_space}
|
||||||
alwaysEdit
|
alwaysEdit
|
||||||
@ -746,6 +747,11 @@
|
|||||||
bind:content={object.description}
|
bind:content={object.description}
|
||||||
placeholder={tracker.string.IssueDescriptionPlaceholder}
|
placeholder={tracker.string.IssueDescriptionPlaceholder}
|
||||||
on:changeSize={() => dispatch('changeContent')}
|
on:changeSize={() => dispatch('changeContent')}
|
||||||
|
on:attach={(ev) => {
|
||||||
|
if (ev.detail.action === 'saved') {
|
||||||
|
object.attachments = ev.detail.value
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{/key}
|
{/key}
|
||||||
<IssueTemplateChilds bind:children={subIssues} sprint={object.sprint} project={object.project} isScrollable />
|
<IssueTemplateChilds bind:children={subIssues} sprint={object.sprint} project={object.project} isScrollable />
|
||||||
|
@ -222,6 +222,7 @@ export interface IssueDraft extends Doc {
|
|||||||
// Estimation in man days
|
// Estimation in man days
|
||||||
estimation: number
|
estimation: number
|
||||||
parentIssue?: string
|
parentIssue?: string
|
||||||
|
attachments?: number
|
||||||
labels?: TagReference[]
|
labels?: TagReference[]
|
||||||
subIssues?: IssueTemplateChild[]
|
subIssues?: IssueTemplateChild[]
|
||||||
template?: {
|
template?: {
|
||||||
|
Loading…
Reference in New Issue
Block a user