diff --git a/plugins/attachment-resources/src/components/AttachmentRefInput.svelte b/plugins/attachment-resources/src/components/AttachmentRefInput.svelte index ce4f54ab0b..a0d181d773 100644 --- a/plugins/attachment-resources/src/components/AttachmentRefInput.svelte +++ b/plugins/attachment-resources/src/components/AttachmentRefInput.svelte @@ -44,6 +44,8 @@ const newAttachments: Set> = new Set>() const removedAttachments: Set = new Set() + let refContainer: HTMLElement + $: objectId && query.query( attachment.class.Attachment, @@ -154,6 +156,18 @@ } function pasteAction (evt: ClipboardEvent): void { + let t: HTMLElement | null = evt.target as HTMLElement + let allowed = false + while (t != null) { + t = t.parentElement + if (t === refContainer) { + allowed = true + } + } + if (!allowed) { + return + } + const items = evt.clipboardData?.items ?? [] for (const index in items) { const item = items[index] @@ -169,46 +183,48 @@ - -
{}} - on:dragleave={() => {}} - on:drop|preventDefault|stopPropagation={fileDrop} -> - {#if attachments.size} -
- {#each Array.from(attachments.values()) as attachment} -
- { - if (result !== undefined) removeAttachment(attachment) - }} - /> -
- {/each} -
- {/if} - 0} - on:attach={() => { - inputFile.click() - }} +
+ +
{}} + on:dragleave={() => {}} + on:drop|preventDefault|stopPropagation={fileDrop} + > + {#if attachments.size} +
+ {#each Array.from(attachments.values()) as attachment} +
+ { + if (result !== undefined) removeAttachment(attachment) + }} + /> +
+ {/each} +
+ {/if} + 0} + on:attach={() => { + inputFile.click() + }} + /> +