Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
4ed98722
Unverified
Commit
4ed98722
authored
Nov 03, 2022
by
Zhou Yunliang
Committed by
GitHub
Nov 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: text filter regex support (#406)
parent
a1068b6f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
6 deletions
+14
-6
CreateShortcutDialog.tsx
web/src/components/CreateShortcutDialog.tsx
+1
-0
filter.ts
web/src/helpers/filter.ts
+9
-4
en.json
web/src/locales/en.json
+2
-1
zh.json
web/src/locales/zh.json
+2
-1
No files found.
web/src/components/CreateShortcutDialog.tsx
View file @
4ed98722
...
...
@@ -258,6 +258,7 @@ const MemoFilterInputer: React.FC<MemoFilterInputerProps> = (props: MemoFilterIn
onChange=
{
(
event
)
=>
{
handleValueChange
(
event
.
target
.
value
);
}
}
placeholder=
{
t
(
"filter.text-placeholder"
)
}
/>
)
:
(
<
Selector
className=
"value-selector"
dataSource=
{
valueDataSource
}
value=
{
value
}
handleValueChanged=
{
handleValueChange
}
/>
...
...
web/src/helpers/filter.ts
View file @
4ed98722
...
...
@@ -142,11 +142,16 @@ export const checkShouldShowMemo = (memo: Memo, filter: Filter) => {
}
shouldShow
=
matched
;
}
else
if
(
type
===
"TEXT"
)
{
let
contained
=
memo
.
content
.
toLowerCase
().
includes
(
value
.
toLowerCase
());
if
(
operator
===
"NOT_CONTAIN"
)
{
contained
=
!
contained
;
if
(
value
.
startsWith
(
"^"
))
{
const
reg
=
new
RegExp
(
value
.
slice
(
1
));
shouldShow
=
operator
===
"NOT_CONTAIN"
?
!
reg
.
test
(
memo
.
content
)
:
reg
.
test
(
memo
.
content
);
}
else
{
let
contained
=
memo
.
content
.
toLowerCase
().
includes
(
value
.
toLowerCase
());
if
(
operator
===
"NOT_CONTAIN"
)
{
contained
=
!
contained
;
}
shouldShow
=
contained
;
}
shouldShow
=
contained
;
}
return
shouldShow
;
...
...
web/src/locales/en.json
View file @
4ed98722
...
...
@@ -116,7 +116,8 @@
"value"
:
{
"not-tagged"
:
"No tags"
,
"linked"
:
"Has links"
}
},
"text-placeholder"
:
"Starts with ^ to use regex"
},
"tag-list"
:
{
"tip-text"
:
"Enter `#tag ` to create"
...
...
web/src/locales/zh.json
View file @
4ed98722
...
...
@@ -116,7 +116,8 @@
"value"
:
{
"not-tagged"
:
"无标签"
,
"linked"
:
"包含链接"
}
},
"text-placeholder"
:
"以 ^ 开头使用正则表达式"
},
"tag-list"
:
{
"tip-text"
:
"输入`#tag `来创建标签"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment