fix(messages): use Quill keyboard bindings instead of DOM — text always ready
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
2afffc92af
commit
29e98d0b03
@ -1225,24 +1225,24 @@
|
||||
},
|
||||
});
|
||||
|
||||
// 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();
|
||||
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);
|
||||
// Enter = send: prepend our handler BEFORE Quill's default Enter handlers
|
||||
// Quill stores handlers in keyboard.bindings keyed by keyCode
|
||||
var enterBindings = state.quill.keyboard.bindings[13] || [];
|
||||
// Insert our handler at the BEGINNING so it runs first
|
||||
enterBindings.unshift({
|
||||
key: 13,
|
||||
shiftKey: false,
|
||||
handler: function() {
|
||||
var html = state.quill.root.innerHTML;
|
||||
var text = state.quill.getText().trim();
|
||||
if (text) {
|
||||
state.quill.setText('');
|
||||
Composer.sendContent(html, text);
|
||||
}
|
||||
return false; // Block Quill's default Enter (newline insertion)
|
||||
}
|
||||
}, true);
|
||||
});
|
||||
state.quill.keyboard.bindings[13] = enterBindings;
|
||||
|
||||
// Typing indicator
|
||||
state.quill.on('text-change', function () {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user