@lvce-editor/settings-view 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -966,12 +966,22 @@ const computeVisibleItems = (items, height, scrollOffset, itemHeight) => {
|
|
|
966
966
|
};
|
|
967
967
|
};
|
|
968
968
|
|
|
969
|
+
const normalizeSearchText = value => {
|
|
970
|
+
return value.replaceAll(/([a-z\d])([A-Z])/g, '$1 $2').toLowerCase().replaceAll(/[^a-z\d]+/g, ' ').trim();
|
|
971
|
+
};
|
|
972
|
+
const matchesSearch = (item, searchValue) => {
|
|
973
|
+
const searchTargets = [item.heading, item.id, ...(item.aliases ?? [])];
|
|
974
|
+
return searchTargets.some(target => normalizeSearchText(target).includes(searchValue));
|
|
975
|
+
};
|
|
969
976
|
const filterBySearch = (items, searchValue) => {
|
|
970
977
|
if (!searchValue || !searchValue.trim()) {
|
|
971
978
|
return items;
|
|
972
979
|
}
|
|
973
|
-
const normalizedSearchValue = searchValue
|
|
974
|
-
|
|
980
|
+
const normalizedSearchValue = normalizeSearchText(searchValue);
|
|
981
|
+
if (!normalizedSearchValue) {
|
|
982
|
+
return [];
|
|
983
|
+
}
|
|
984
|
+
return items.filter(item => matchesSearch(item, normalizedSearchValue));
|
|
975
985
|
};
|
|
976
986
|
|
|
977
987
|
const filterByTab = (items, tabs) => {
|
|
@@ -3448,6 +3458,7 @@ const getSettingItemsEditor = () => {
|
|
|
3448
3458
|
},
|
|
3449
3459
|
value: 15
|
|
3450
3460
|
}, {
|
|
3461
|
+
aliases: ['editor font family'],
|
|
3451
3462
|
category: TextEditorTab,
|
|
3452
3463
|
description: fontFamilyDescription(),
|
|
3453
3464
|
heading: fontFamily(),
|