|
|
@ -30,7 +30,11 @@ export default Backbone.View.extend({ |
|
|
this.attr = model.get('attributes'); |
|
|
this.attr = model.get('attributes'); |
|
|
this.classe = this.attr.class || []; |
|
|
this.classe = this.attr.class || []; |
|
|
this.listenTo(model, 'change:style', this.updateStyle); |
|
|
this.listenTo(model, 'change:style', this.updateStyle); |
|
|
this.listenTo(model, 'change:attributes', this.renderAttributes); |
|
|
this.listenTo( |
|
|
|
|
|
model, |
|
|
|
|
|
'change:attributes change:_innertext', |
|
|
|
|
|
this.renderAttributes |
|
|
|
|
|
); |
|
|
this.listenTo(model, 'change:highlightable', this.updateHighlight); |
|
|
this.listenTo(model, 'change:highlightable', this.updateHighlight); |
|
|
this.listenTo(model, 'change:status', this.updateStatus); |
|
|
this.listenTo(model, 'change:status', this.updateStatus); |
|
|
this.listenTo(model, 'change:script', this.reset); |
|
|
this.listenTo(model, 'change:script', this.reset); |
|
|
@ -205,11 +209,14 @@ export default Backbone.View.extend({ |
|
|
* @private |
|
|
* @private |
|
|
* */ |
|
|
* */ |
|
|
updateStyle() { |
|
|
updateStyle() { |
|
|
const em = this.em; |
|
|
const { model, em, el } = this; |
|
|
const model = this.model; |
|
|
|
|
|
|
|
|
|
|
|
if (em && em.getConfig('avoidInlineStyle')) { |
|
|
if (em && em.getConfig('avoidInlineStyle')) { |
|
|
this.el.id = model.getId(); |
|
|
if (model.get('_innertext')) { |
|
|
|
|
|
el.removeAttribute('id'); |
|
|
|
|
|
} else { |
|
|
|
|
|
el.id = model.getId(); |
|
|
|
|
|
} |
|
|
const style = model.getStyle(); |
|
|
const style = model.getStyle(); |
|
|
!isEmpty(style) && model.setStyle(style); |
|
|
!isEmpty(style) && model.setStyle(style); |
|
|
} else { |
|
|
} else { |
|
|
@ -260,12 +267,12 @@ export default Backbone.View.extend({ |
|
|
updateAttributes() { |
|
|
updateAttributes() { |
|
|
const attrs = []; |
|
|
const attrs = []; |
|
|
const { model, $el, el, config } = this; |
|
|
const { model, $el, el, config } = this; |
|
|
const { highlightable, textable, type } = model.attributes; |
|
|
const { highlightable, textable, type, _innertext } = model.attributes; |
|
|
const { draggableComponents } = config; |
|
|
const { draggableComponents } = config; |
|
|
|
|
|
|
|
|
const defaultAttr = { |
|
|
const defaultAttr = { |
|
|
'data-gjs-type': type || 'default', |
|
|
'data-gjs-type': type || 'default', |
|
|
...(draggableComponents ? { draggable: true } : {}), |
|
|
...(draggableComponents && !_innertext ? { draggable: true } : {}), |
|
|
...(highlightable ? { 'data-highlightable': 1 } : {}), |
|
|
...(highlightable ? { 'data-highlightable': 1 } : {}), |
|
|
...(textable |
|
|
...(textable |
|
|
? { |
|
|
? { |
|
|
|