fix: ensure all matched quick add magic parts are correctly removed from the task

This commit is contained in:
kolaente 2023-04-04 10:41:26 +02:00 committed by konrad
parent 4ff0c81e37
commit 7b6a13dd52
1 changed files with 9 additions and 6 deletions

View File

@ -280,13 +280,16 @@ const getRepeats = (text: string): repeatParsedResult => {
export const cleanupItemText = (text: string, items: string[], prefix: string): string => { export const cleanupItemText = (text: string, items: string[], prefix: string): string => {
items.forEach(l => { items.forEach(l => {
if (l === '') {
return
}
text = text text = text
.replace(`${prefix}'${l}' `, '') .replace(new RegExp(`\\${prefix}'${l}' `, 'ig'), '')
.replace(`${prefix}'${l}'`, '') .replace(new RegExp(`\\${prefix}'${l}'`, 'ig'), '')
.replace(`${prefix}"${l}" `, '') .replace(new RegExp(`\\${prefix}"${l}" `, 'ig'), '')
.replace(`${prefix}"${l}"`, '') .replace(new RegExp(`\\${prefix}"${l}"`, 'ig'), '')
.replace(`${prefix}${l} `, '') .replace(new RegExp(`\\${prefix}${l} `, 'ig'), '')
.replace(`${prefix}${l}`, '') .replace(new RegExp(`\\${prefix}${l}`, 'ig'), '')
}) })
return text return text
} }