Browse Source

Update getName in Component and remove getCurrentName

pull/187/head
Artur Arseniev 9 years ago
parent
commit
54789a4852
  1. 9
      src/canvas/config/config.js
  2. 19
      src/dom_components/model/Component.js

9
src/canvas/config/config.js

@ -24,4 +24,13 @@ module.exports = {
*/
styles: [],
/**
* Add custom badge naming strategy
* @example
* customBadgeLabel: function(ComponentModel) {
* return ComponentModel.getName();
* }
*/
customBadgeLabel: '',
};

19
src/dom_components/model/Component.js

@ -249,23 +249,14 @@ module.exports = Backbone.Model.extend({
},
/**
* Get name of the component
* Get the name of the component
* @return {string}
* @private
* */
getName() {
if(!this.name){
var type = this.get('type');
var tag = this.get('tagName');
tag = tag == 'div' ? 'box' : tag;
tag = type ? type : tag;
this.name = tag.charAt(0).toUpperCase() + tag.slice(1);
}
return this.name;
},
getCurrentName() {
return this.get('custom-name') || this.getName();
let customName = this.get('custom-name');
let name = this.get('type') || this.get('tagName');
name = name.charAt(0).toUpperCase() + name.slice(1);
return customName || name;
},
/**

Loading…
Cancel
Save