fix(messages): send images via Enter — case-insensitive img check, setContents([]) to clear
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

This commit is contained in:
Maciej Pienczyn 2026-03-30 15:58:00 +02:00
parent 51c80c78a4
commit 7c8fd90a21

View File

@ -1244,10 +1244,11 @@
handler: function() { handler: function() {
var html = state.quill.root.innerHTML; var html = state.quill.root.innerHTML;
var text = state.quill.getText().trim(); var text = state.quill.getText().trim();
var hasContent = text || html.indexOf('<img') !== -1; var hasImage = html.toLowerCase().indexOf('<img') !== -1;
var hasContent = text || hasImage || state.quill.getLength() > 1;
if (hasContent) { if (hasContent) {
state.quill.setText(''); state.quill.setContents([]); // Clear everything including images
Composer.sendContent(html, text || '(obraz)'); Composer.sendContent(html, text || '📷');
} }
return false; return false;
} }
@ -1393,14 +1394,16 @@
var html = state.quill.root.innerHTML; var html = state.quill.root.innerHTML;
var text = state.quill.getText().trim(); var text = state.quill.getText().trim();
var hasImage = html.toLowerCase().indexOf('<img') !== -1;
if (!text && !state.attachedFiles.length) return; if (!text && !hasImage && !state.attachedFiles.length) return;
if (!text && hasImage) text = '📷';
var convId = state.currentConversationId; var convId = state.currentConversationId;
var savedReplyTo = state.replyToMessage; var savedReplyTo = state.replyToMessage;
var savedFiles = state.attachedFiles.slice(); var savedFiles = state.attachedFiles.slice();
state.quill.setText(''); state.quill.setContents([]);
state.attachedFiles = []; state.attachedFiles = [];
state.replyToMessage = null; state.replyToMessage = null;
var replyPreview = document.getElementById('replyPreview'); var replyPreview = document.getElementById('replyPreview');