Skip to content

Commit 973d7d6

Browse files
authored
fix: allow searching css with dash e.g. flex-direction (#4996)
In advanced panel in both search in put and add property autocomplete right now if you type dash it won't find anything with dash ## Description 1. What is this PR about (link the issue and add a short description) ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent af653fa commit 973d7d6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

apps/builder/app/builder/shared/css-editor/add-style-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const getAutocompleteItems = () => {
100100
};
101101

102102
const matchOrSuggestToCreate = (search: string, items: Array<SearchItem>) => {
103-
const matched = matchSorter(items, search, {
103+
const matched = matchSorter(items, search.replaceAll("-", " "), {
104104
keys: ["key"],
105105
});
106106

apps/builder/app/builder/shared/css-editor/css-editor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ export const CssEditor = ({
389389
};
390390

391391
const handleSearch = (event: ChangeEvent<HTMLInputElement>) => {
392-
const search = event.target.value.trim();
392+
const search = event.target.value.trim().replaceAll("-", " ");
393393
if (search === "") {
394394
return handleAbortSearch();
395395
}

0 commit comments

Comments
 (0)