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
|
// Enter = send: prepend our handler BEFORE Quill's default Enter handlers
|
||||||
state.quill.root.addEventListener('keydown', function (e) {
|
// Quill stores handlers in keyboard.bindings keyed by keyCode
|
||||||
if (e.key === 'Enter' && !e.shiftKey) {
|
var enterBindings = state.quill.keyboard.bindings[13] || [];
|
||||||
e.preventDefault();
|
// Insert our handler at the BEGINNING so it runs first
|
||||||
e.stopImmediatePropagation();
|
enterBindings.unshift({
|
||||||
if (state._pendingSend) return; // Already scheduled
|
key: 13,
|
||||||
state._pendingSend = true;
|
shiftKey: false,
|
||||||
setTimeout(function() {
|
handler: function() {
|
||||||
state._pendingSend = false;
|
var html = state.quill.root.innerHTML;
|
||||||
var html = state.quill.root.innerHTML;
|
var text = state.quill.getText().trim();
|
||||||
var text = state.quill.getText().trim();
|
if (text) {
|
||||||
if (text) {
|
state.quill.setText('');
|
||||||
state.quill.setText('');
|
Composer.sendContent(html, text);
|
||||||
Composer.sendContent(html, text);
|
}
|
||||||
}
|
return false; // Block Quill's default Enter (newline insertion)
|
||||||
}, 15);
|
|
||||||
}
|
}
|
||||||
}, true);
|
});
|
||||||
|
state.quill.keyboard.bindings[13] = enterBindings;
|
||||||
|
|
||||||
// Typing indicator
|
// Typing indicator
|
||||||
state.quill.on('text-change', function () {
|
state.quill.on('text-change', function () {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user