Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

don't use regex to avoid the need for escaping

Oleg Isonen2fc894068641
diff --git a/packages/fonts/src/font-data.ts b/packages/fonts/src/font-data.ts
index a6b965c318..d582b8738b 100644
--- a/packages/fonts/src/font-data.ts
+++ b/packages/fonts/src/font-data.ts
@@ -40,10 +40,12 @@ export const normalizeFamily = (family: string, subfamily: string) => {
.trim()
.split(" ")
.forEach((word: string) => {
- simplifiedFamily = simplifiedFamily.replace(
- new RegExp(word.trim(), "i"),
- ""
- );
+ // We need to remove 'Black' or 'black' from 'Roboto Black'
+ const index = simplifiedFamily.toLowerCase().indexOf(word.toLowerCase());
+ if (index !== -1) {
+ const found = simplifiedFamily.slice(index, index + word.length);
+ simplifiedFamily = simplifiedFamily.replace(found, "");
+ }
});
return simplifiedFamily.trim();
};