Browse Source

Take care of parenthesis when split CSS style values. Fixes #1579

pull/1625/head
Artur Arseniev 7 years ago
parent
commit
342149a89d
  1. 10
      src/style_manager/model/PropertyComposite.js
  2. 2
      src/style_manager/view/PropertyCompositeView.js

10
src/style_manager/model/PropertyComposite.js

@ -43,7 +43,7 @@ module.exports = Property.extend({
* Update property values
*/
updateValues() {
const values = this.getFullValue().split(this.get('separator'));
const values = this.getFullValue().split(this.getSplitSeparator());
this.get('properties').each((property, i) => {
const len = values.length;
// Try to get value from a shorthand:
@ -56,6 +56,14 @@ module.exports = Property.extend({
});
},
/**
* Split by sperator but avoid it inside parenthesis
* @return {RegExp}
*/
getSplitSeparator() {
return new RegExp(`${this.get('separator')}(?![^\\(]*\\))`);
},
/**
* Returns default value
* @param {Boolean} defaultProps Force to get defaults from properties

2
src/style_manager/view/PropertyCompositeView.js

@ -111,7 +111,7 @@ module.exports = PropertyView.extend({
// the corresponding value from the requested index, otherwise try
// to get the value of the sub-property
if (targetValue) {
const values = targetValue.split(' ');
const values = targetValue.split(this.model.getSplitSeparator());
value = values[index];
} else {
value =

Loading…
Cancel
Save