Browse Source

Fix incorrect target for requiresParent

pull/1710/head
David Polak 7 years ago
parent
commit
5862b9bd0f
  1. 12
      src/style_manager/view/PropertyView.js

12
src/style_manager/view/PropertyView.js

@ -419,6 +419,7 @@ module.exports = Backbone.View.extend({
const requires = model.get('requires');
const requiresParent = model.get('requiresParent');
const sectors = this.sector ? this.sector.collection : null;
const selected = this.em ? this.em.getSelected() : null;
let stylable = trg.get('stylable');
// Stylable could also be an array indicating with which property
@ -456,12 +457,13 @@ module.exports = Backbone.View.extend({
// Check if the property is available based on parent's property values
if (requiresParent) {
if (
trg.view &&
trg.view.$el &&
trg.view.$el[0] &&
trg.view.$el[0].parentNode
selected &&
selected.view &&
selected.view.$el &&
selected.view.$el[0] &&
selected.view.$el[0].parentNode
) {
const styles = window.getComputedStyle(trg.view.$el[0].parentNode);
const styles = window.getComputedStyle(selected.view.$el[0].parentNode);
each(requiresParent, (values, property) => {
stylable =
stylable && styles[property] && includes(values, styles[property]);

Loading…
Cancel
Save