| 1503 | 1501 | $(document).on('click', '.mes_img_enlarge', enlargeMessageImage); |
| 1504 | 1502 | $(document).on('click', '.mes_img_delete', deleteMessageImage); |
| 1505 | 1503 | |
| 1506 | 1504 | $('#file_form_input').on('change', onFileAttachasync (); => { |
| 1505 | + const fileInput = document.getElementById('file_form_input'); |
| 1506 | + if (!(fileInput instanceof HTMLInputElement)) return; |
| 1507 | + const file = fileInput.files[0]; |
| 1508 | + await onFileAttach(file); |
| 1509 | + }); |
| 1507 | 1510 | $('#file_form').on('reset', function () { |
| 1508 | 1511 | $('#file_form').addClass('displayNone'); |
| 1509 | 1512 | }); |
| 1513 | + |
| 1514 | + document.getElementById('send_textarea').addEventListener('paste', async function (event) { |
| 1515 | + if (event.clipboardData.files.length === 0) { |
| 1516 | + return; |
| 1517 | + } |
| 1518 | + |
| 1519 | + event.preventDefault(); |
| 1520 | + event.stopPropagation(); |
| 1521 | + |
| 1522 | + const fileInput = document.getElementById('file_form_input'); |
| 1523 | + if (!(fileInput instanceof HTMLInputElement)) return; |
| 1524 | + |
| 1525 | + fileInput.files = event.clipboardData.files; |
| 1526 | + await onFileAttach(fileInput.files[0]); |
| 1527 | + }); |
| 1510 | 1528 | }); |