Fixed bug not copying attachment when using copy and send

This commit is contained in:
delvh 2020-07-18 09:48:08 +02:00
parent d2303a187d
commit cf0e642122
No known key found for this signature in database
GPG Key ID: 42B77E634CE94D82

View File

@ -560,9 +560,14 @@ public final class ChatScene implements Restorable {
private void copyAndPostMessage() { private void copyAndPostMessage() {
final var messageText = messageTextArea.getText(); final var messageText = messageTextArea.getText();
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(messageText), null); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(messageText), null);
final var image = attachmentView.getImage();
final var messageAttachment = pendingAttachment;
postMessage(); postMessage();
messageTextArea.setText(messageText); messageTextArea.setText(messageText);
updateRemainingCharsLabel(); updateRemainingCharsLabel();
postButton.setDisable(messageText.isBlank()); postButton.setDisable(messageText.isBlank());
attachmentView.setImage(image);
if (attachmentView.getImage() != null) attachmentView.setVisible(true);
pendingAttachment = messageAttachment;
} }
} }