Also support CSS layout property values with a px extension #2004

This commit is contained in:
Ben Gotow 2020-05-24 17:55:10 -05:00
parent fa46b0c972
commit 470b088aa5

View file

@ -203,11 +203,17 @@ var DOMUtils = {
if (workspaceElement) { if (workspaceElement) {
const value = getComputedStyle(workspaceElement).getPropertyValue(`--${property}`); const value = getComputedStyle(workspaceElement).getPropertyValue(`--${property}`);
if (value.length > 0) { if (value.length > 0) {
return +value; const num = Number(value.replace('px', '').trim());
if (!isNaN(num)) {
return num;
} else {
console.warn(`Unable to interpret --${property}:${value}, provide a value in px.`);
}
} }
} }
return defaultValue; return defaultValue;
}, },
}; };
export default DOMUtils; export default DOMUtils;