From 6f375e928e139bca556ffeb7c689b3d0a2e7e43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BA=91=E9=A3=9E?= Date: Fri, 30 Sep 2022 15:02:21 +0800 Subject: [PATCH] feat:search ignore case --- src/editor/core/draw/interactive/Search.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/editor/core/draw/interactive/Search.ts b/src/editor/core/draw/interactive/Search.ts index f052364..b4548a2 100644 --- a/src/editor/core/draw/interactive/Search.ts +++ b/src/editor/core/draw/interactive/Search.ts @@ -145,6 +145,7 @@ export class Search { } public compute(payload: string) { + const keyword = payload.toLocaleLowerCase() const searchMatchList: ISearchResult[] = [] // 分组 const elementListGroup: { type: EditorContext, elementList: IElement[], index: number }[] = [] @@ -190,6 +191,7 @@ export class Search { : ZERO) .filter(Boolean) .join('') + .toLocaleLowerCase() const matchStartIndexList = [] let index = text.indexOf(payload) while (index !== -1) { @@ -224,11 +226,11 @@ export class Search { tdIndex: d, tdId: td.id } - searchClosure(payload, group.type, td.value, restArgs) + searchClosure(keyword, group.type, td.value, restArgs) } } } else { - searchClosure(payload, group.type, group.elementList, { + searchClosure(keyword, group.type, group.elementList, { startIndex: group.index }) }