fix(messages): 15ms delay for Quill to process keystroke before capture
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
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:
parent
762bad0db1
commit
2afffc92af
@ -1225,18 +1225,22 @@
|
||||
},
|
||||
});
|
||||
|
||||
// Enter = send: capture content immediately, clear editor, send async
|
||||
// Enter = send: let Quill process keystroke first (15ms), then capture+clear+send
|
||||
state.quill.root.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
// Snapshot content NOW before Quill processes further keystrokes
|
||||
var html = state.quill.root.innerHTML;
|
||||
var text = state.quill.getText().trim();
|
||||
if (text) {
|
||||
state.quill.setText(''); // Clear immediately
|
||||
Composer.sendContent(html, text); // Send with captured content
|
||||
}
|
||||
if (state._pendingSend) return; // Already scheduled
|
||||
state._pendingSend = true;
|
||||
setTimeout(function() {
|
||||
state._pendingSend = false;
|
||||
var html = state.quill.root.innerHTML;
|
||||
var text = state.quill.getText().trim();
|
||||
if (text) {
|
||||
state.quill.setText('');
|
||||
Composer.sendContent(html, text);
|
||||
}
|
||||
}, 15);
|
||||
}
|
||||
}, true);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user