fix(custom words filter): add button overriding custom text state

also added a notification when no words were found when filtering

closes #4785
This commit is contained in:
Miodec 2023-11-13 12:32:22 +00:00
parent 2ba23567fb
commit 9d8d8dc544
2 changed files with 8 additions and 1 deletions

View file

@ -361,7 +361,7 @@ $(document).on("keydown", (event) => {
});
$("#popups").on("click", `${popup} .wordfilter`, () => {
hide({ noAnim: true });
hide({ noAnim: true, resetState: false });
WordFilterPopup.show(true, () => {
show(true);
});

View file

@ -260,6 +260,13 @@ async function filter(language: string): Promise<string[]> {
async function apply(set: boolean): Promise<void> {
const language = $("#wordFilterPopup .languageInput").val() as string;
const filteredWords = await filter(language);
if (filteredWords.length === 0) {
Notifications.add("No words found", 0);
hide(true);
return;
}
const customText = filteredWords.join(CustomText.delimiter);
CustomText.setPopupTextareaState(