fix: allow only one funbox changing capitalisation (@fehmer) (#5959)

Fixes funboxes like `capitals` and `instant messaging` not working at
the same time.
This commit is contained in:
Christian Fehmer 2024-10-15 11:43:55 +02:00 committed by GitHub
parent 4f541da111
commit c7751d9051
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -136,6 +136,10 @@ export function areFunboxesCompatible(funboxesString: string): boolean {
const oneCharReplacerMax =
funboxesToCheck.filter((f) => f.frontendFunctions?.includes("getWordHtml"))
.length <= 1;
const oneChangesCapitalisationMax =
funboxesToCheck.filter((f) =>
f.properties?.find((fp) => fp === "changesCapitalisation")
).length <= 1;
const allowedConfig = {} as Record<string, string[] | boolean[]>;
let noConfigConflicts = true;
for (const f of funboxesToCheck) {
@ -174,6 +178,7 @@ export function areFunboxesCompatible(funboxesString: string): boolean {
onePunctuateWordMax &&
oneCharCheckerMax &&
oneCharReplacerMax &&
oneChangesCapitalisationMax &&
noConfigConflicts &&
oneWordOrderMax
);

View file

@ -296,6 +296,10 @@ export function areFunboxesCompatible(
funboxesToCheck.filter((f) => f.functions?.isCharCorrect).length <= 1;
const oneCharReplacerMax =
funboxesToCheck.filter((f) => f.functions?.getWordHtml).length <= 1;
const oneChangesCapitalisationMax =
funboxesToCheck.filter((f) =>
f.properties?.find((fp) => fp === "changesCapitalisation")
).length <= 1;
const allowedConfig = {} as FunboxForcedConfig;
let noConfigConflicts = true;
for (const f of funboxesToCheck) {
@ -335,6 +339,7 @@ export function areFunboxesCompatible(
onePunctuateWordMax &&
oneCharCheckerMax &&
oneCharReplacerMax &&
oneChangesCapitalisationMax &&
noConfigConflicts
);
}