diff --git a/html-to-react/src/utils/convertInlineStyleToMap.ts b/html-to-react/src/utils/convertInlineStyleToMap.ts index b4c71c5cd..13d8eb30d 100644 --- a/html-to-react/src/utils/convertInlineStyleToMap.ts +++ b/html-to-react/src/utils/convertInlineStyleToMap.ts @@ -61,10 +61,12 @@ export function convertInlineStyleToMap( // additionally don't uppercase any -ms- prefix // e.g. -ms-style-property = msStyleProperty // -webkit-style-property = WebkitStyleProperty - const replacedProperty = property - .toLowerCase() - .replace(/^-ms-/, 'ms-') - .replace(/-(.)/g, (_, character: string) => character.toUpperCase()) + const replacedProperty = property.startsWith('--') + ? property + : property + .toLowerCase() + .replace(/^-ms-/, 'ms-') + .replace(/-(.)/g, (_, character: string) => character.toUpperCase()) // add the new style property and value to the style object styleObject[replacedProperty] = value