mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2026-04-30 00:00:04 +08:00
Escape regex input for layoutCandidates check. Fixes #1645
This commit is contained in:
@@ -332,7 +332,7 @@ class SimpleKeyboard {
|
||||
const inputSubstr =
|
||||
input.substring(0, this.getCaretPositionEnd() || 0) || input;
|
||||
const regexp = new RegExp(
|
||||
`${layoutCandidate}$`,
|
||||
`${this.utilities.escapeRegex(layoutCandidate)}$`,
|
||||
layoutCandidatesCaseSensitiveMatch ? "g" : "gi"
|
||||
);
|
||||
const matches = [...inputSubstr.matchAll(regexp)];
|
||||
@@ -387,7 +387,7 @@ class SimpleKeyboard {
|
||||
currentInput;
|
||||
|
||||
const regexp = new RegExp(
|
||||
`${candidateKey}$`,
|
||||
`${this.utilities.escapeRegex(candidateKey)}$`,
|
||||
layoutCandidatesCaseSensitiveMatch ? "g" : "gi"
|
||||
);
|
||||
const newInputSubstr = inputSubstr.replace(
|
||||
|
||||
Reference in New Issue
Block a user