Skip to content

Commit 42c0cba

Browse files
committed
extend composition suppression to handle FlorisBoard-style deletions
1 parent d986141 commit 42c0cba

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

components/editor/plugins/patch/softkey-unborker.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@ const suppressionTriggers = new Set([
2222
'deleteSoftLineBackward',
2323
'deleteSoftLineForward',
2424
'deleteWordBackward',
25-
'deleteWordForward'
25+
'deleteWordForward',
26+
'insertText'
2627
])
2728

29+
// Additional checks:
30+
// If a trigger has an associated check, suppression starts only if the check passes.
31+
const suppressionTriggersChecks = {
32+
insertText: (e) => e.data === ''
33+
}
34+
2835
function applySoftkeyWorkaround (el) {
2936
let isCompositionSuppressed = false
3037
let isSelectionSuppressed = false
@@ -57,6 +64,9 @@ function applySoftkeyWorkaround (el) {
5764
const beginCompositionSuppression = (e) => {
5865
if (!e) return
5966
if (!e.inputType || suppressionTriggers.has(e.inputType)) {
67+
const extraChecks = suppressionTriggersChecks[e.inputType]
68+
if (extraChecks && !extraChecks(e)) return
69+
6070
isCompositionSuppressed = true
6171

6272
if (compositionTimeout != null) {

0 commit comments

Comments
 (0)