|
|
|
@ -1,4 +1,4 @@ |
|
|
|
import { bindAll } from 'underscore'; |
|
|
|
import { bindAll, isArray } from 'underscore'; |
|
|
|
import { camelCase } from 'utils/mixins'; |
|
|
|
|
|
|
|
module.exports = Backbone.View.extend({ |
|
|
|
@ -374,12 +374,23 @@ module.exports = Backbone.View.extend({ |
|
|
|
* The target could be the Component as the CSS Rule |
|
|
|
* @return {Boolean} |
|
|
|
*/ |
|
|
|
isTargetStylable() { |
|
|
|
var stylable = this.getTarget().get('stylable'); |
|
|
|
isTargetStylable(target) { |
|
|
|
const trg = target || this.getTarget(); |
|
|
|
const property = this.model.get('property'); |
|
|
|
const unstylable = trg.get('unstylable'); |
|
|
|
let stylable = trg.get('stylable'); |
|
|
|
|
|
|
|
// Stylable could also be an array indicating with which property
|
|
|
|
// the target could be styled
|
|
|
|
if(stylable instanceof Array) |
|
|
|
stylable = _.indexOf(stylable, this.property) >= 0; |
|
|
|
if (isArray(stylable)) { |
|
|
|
stylable = stylable.indexOf(property) >= 0; |
|
|
|
} |
|
|
|
|
|
|
|
// Check if the property was signed as unstylable
|
|
|
|
if (isArray(unstylable)) { |
|
|
|
stylable = unstylable.indexOf(property) < 0; |
|
|
|
} |
|
|
|
|
|
|
|
return stylable; |
|
|
|
}, |
|
|
|
|
|
|
|
@ -389,21 +400,14 @@ module.exports = Backbone.View.extend({ |
|
|
|
* @return {Boolean} |
|
|
|
*/ |
|
|
|
isComponentStylable() { |
|
|
|
var em = this.em; |
|
|
|
var component = em && em.get('selectedComponent'); |
|
|
|
const em = this.em; |
|
|
|
const component = em && em.get('selectedComponent'); |
|
|
|
|
|
|
|
if (!component) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
var stylable = component.get('stylable'); |
|
|
|
// Stylable could also be an array indicating with which property
|
|
|
|
// the target could be styled
|
|
|
|
if(stylable instanceof Array){ |
|
|
|
stylable = _.indexOf(stylable, this.property) >= 0; |
|
|
|
} |
|
|
|
|
|
|
|
return stylable; |
|
|
|
return this.isTargetStylable(component); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
|