mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 17:26:29 -05:00
fix: ellide inline css custom properties
* ellide css custom properties when converting css inline styles to map Signed-off-by: Lim Jia Sheng <50891910+sxxov@users.noreply.github.com>
This commit is contained in:
parent
a55eac74fc
commit
82e7f439c8
1 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue