(e)
| 579 | }; |
| 580 | |
| 581 | const onPaste: ClipboardEventHandler<HTMLTextAreaElement> = async (e) => { |
| 582 | const pastedText = e.clipboardData.getData('text'); |
| 583 | if (isValidHttpUrl(pastedText)) { |
| 584 | const cursor = getCursorType(textarea); |
| 585 | |
| 586 | if (cursor === CursorType.Highlighted) { |
| 587 | const isInMarkdownLink = isSelectionInMarkdownLink( |
| 588 | textarea, |
| 589 | textarea.selectionStart, |
| 590 | textarea.selectionEnd, |
| 591 | ); |
| 592 | |
| 593 | if (!isInMarkdownLink) { |
| 594 | e.preventDefault(); |
| 595 | await onLinkPaste(pastedText); |
| 596 | return; |
| 597 | } |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | if (e.clipboardData.files?.length && isUploadEnabled) { |
| 602 | e.preventDefault(); |
| 603 | |
| 604 | Array.from(e.clipboardData.files).forEach(verifyFile); |
| 605 | |
| 606 | startUploading(); |
| 607 | } |
| 608 | }; |
| 609 | |
| 610 | const onCloseMention = useCallback(() => setQuery(undefined), []); |
| 611 | const onCloseEmoji = useCallback(() => setEmojiQuery(undefined), []); |
nothing calls this directly
no test coverage detected