Browse Source
Merge pull request #11770 from vvlladd28/bug/parce-css-unit/rem-em
Fixed incorrect parsing of the CSS units 'rem' and 'vmin'
pull/11776/head
Igor Kulikov
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
3 additions and
5 deletions
-
ui-ngx/src/app/shared/models/widget-settings.models.ts
|
|
|
@ -329,11 +329,9 @@ export const resolveCssSize = (strSize?: string): [number, cssUnit] => { |
|
|
|
} |
|
|
|
let resolvedUnit: cssUnit; |
|
|
|
let resolvedSize = strSize; |
|
|
|
for (const unit of cssUnits) { |
|
|
|
if (strSize.endsWith(unit)) { |
|
|
|
resolvedUnit = unit; |
|
|
|
break; |
|
|
|
} |
|
|
|
const unitMatch = strSize.match(new RegExp(`(${cssUnits.join('|')})$`)); |
|
|
|
if (unitMatch) { |
|
|
|
resolvedUnit = unitMatch[0] as cssUnit; |
|
|
|
} |
|
|
|
if (resolvedUnit) { |
|
|
|
resolvedSize = strSize.substring(0, strSize.length - resolvedUnit.length); |
|
|
|
|