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
parent
commit
5ac6139363
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      ui-ngx/src/app/shared/models/widget-settings.models.ts

8
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);

Loading…
Cancel
Save