Skip to content

Commit

Permalink
[2152] Some characters typed in the filter bar raise exception
Browse files Browse the repository at this point in the history
Bug: #2152
Signed-off-by: Axel RICHARD <[email protected]>
  • Loading branch information
AxelRICHARD authored and pcdavid committed Jul 5, 2023
1 parent 143ab88 commit 94e195c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ An absent/empty candidates expression now simply means the widget is empty.
- https://github.com/eclipse-sirius/sirius-components/issues/2088[#2088] [tree] Fix initial value of the tree filter bar
- https://github.com/eclipse-sirius/sirius-components/issues/2133[#2133] [workbench] Fix NPE in Related Elements view
- https://github.com/eclipse-sirius/sirius-components/issues/2112[#2112] [form] Fix the pages filtering in form editor.
- https://github.com/eclipse-sirius/sirius-components/issues/2152[#2152] [tree] Fix an issue where some characters typed in the filter bar raised exception

=== New Features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,13 @@ export const TreeItem = ({
if (item.imageURL) {
image = <img height="16" width="16" alt={item.kind} src={httpOrigin + item.imageURL}></img>;
}
const highlightRegExp = new RegExp(`(${textToHighlight})`, 'gi');
let highlightRegExp: RegExp | null = null;
if (textToHighlight) {
// With the RegExp, we keep the searched value in the split result
// But we need to escape the special characters from the RegExp
const excapedTextToHighlight = textToHighlight.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
highlightRegExp = new RegExp(`(${excapedTextToHighlight})`, 'gi');
}
let text;
const onCloseEditingMode = () => {
setState((prevState) => {
Expand Down

0 comments on commit 94e195c

Please sign in to comment.