Build update

This commit is contained in:
Francisco Hodge 2022-04-06 04:28:03 +00:00
parent a4bf6d8bad
commit 1113a88d08
6 changed files with 23 additions and 10 deletions

View File

@ -1,6 +1,6 @@
/*!
*
* simple-keyboard v3.4.75
* simple-keyboard v3.4.76
* https://github.com/hodgef/simple-keyboard
*
* Copyright (c) Francisco Hodge (https://github.com/hodgef) and project contributors.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -189,9 +189,13 @@ export interface KeyboardOptions {
[key: string]: string[];
};
/**
* Determine size of layout candidate list
* Determines size of layout candidate list
*/
layoutCandidatesPageSize?: number;
/**
* Determines whether layout candidate match should be case sensitive.
*/
layoutCandidatesCaseSensitiveMatch?: boolean;
/**
* Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).
*/

View File

@ -316,7 +316,10 @@ class SimpleKeyboard {
getInputCandidates(
input: string
): { candidateKey: string; candidateValue: string } | Record<string, never> {
const { layoutCandidates: layoutCandidatesObj, layoutCandidatesCaseSensitiveMatch } = this.options;
const {
layoutCandidates: layoutCandidatesObj,
layoutCandidatesCaseSensitiveMatch,
} = this.options;
if (!layoutCandidatesObj || typeof layoutCandidatesObj !== "object") {
return {};
@ -326,7 +329,10 @@ class SimpleKeyboard {
(layoutCandidate: string) => {
const inputSubstr =
input.substring(0, this.getCaretPositionEnd() || 0) || input;
const regexp = new RegExp(`${layoutCandidate}$`, layoutCandidatesCaseSensitiveMatch ? "g" : "gi");
const regexp = new RegExp(
`${layoutCandidate}$`,
layoutCandidatesCaseSensitiveMatch ? "g" : "gi"
);
const matches = [...inputSubstr.matchAll(regexp)];
return !!matches.length;
}
@ -378,7 +384,10 @@ class SimpleKeyboard {
currentInput.substring(0, initialCaretPosition || 0) ||
currentInput;
const regexp = new RegExp(`${candidateKey}$`, layoutCandidatesCaseSensitiveMatch ? "g" : "gi");
const regexp = new RegExp(
`${candidateKey}$`,
layoutCandidatesCaseSensitiveMatch ? "g" : "gi"
);
const newInputSubstr = inputSubstr.replace(
regexp,
normalizedCandidate