|
@ -31,6 +31,7 @@ function BackgroundItem (data, conversion, options) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.emptyContent = false; |
|
|
Item.call(this, data, conversion, options); |
|
|
Item.call(this, data, conversion, options); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -58,13 +59,20 @@ BackgroundItem.prototype.redraw = function() { |
|
|
this.dom = {}; |
|
|
this.dom = {}; |
|
|
dom = this.dom; |
|
|
dom = this.dom; |
|
|
|
|
|
|
|
|
// background box
|
|
|
|
|
|
|
|
|
// background box
|
|
|
dom.box = document.createElement('div'); |
|
|
dom.box = document.createElement('div'); |
|
|
// className is updated in redraw()
|
|
|
// className is updated in redraw()
|
|
|
|
|
|
|
|
|
// contents box
|
|
|
// contents box
|
|
|
dom.content = document.createElement('div'); |
|
|
dom.content = document.createElement('div'); |
|
|
dom.content.className = 'content'; |
|
|
|
|
|
|
|
|
if (this.data.content === undefined) { |
|
|
|
|
|
dom.content.className = 'noContent'; |
|
|
|
|
|
this.emptyContent = true; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
dom.content.className = 'content'; |
|
|
|
|
|
this.emptyContent = false; |
|
|
|
|
|
} |
|
|
dom.box.appendChild(dom.content); |
|
|
dom.box.appendChild(dom.content); |
|
|
|
|
|
|
|
|
// attach this item as attribute
|
|
|
// attach this item as attribute
|
|
@ -91,6 +99,16 @@ BackgroundItem.prototype.redraw = function() { |
|
|
// - the item's data is changed
|
|
|
// - the item's data is changed
|
|
|
// - the item is selected/deselected
|
|
|
// - the item is selected/deselected
|
|
|
if (this.dirty) { |
|
|
if (this.dirty) { |
|
|
|
|
|
// only change content class when needed
|
|
|
|
|
|
if (this.data.content === undefined && this.emptyContent == false) { |
|
|
|
|
|
dom.content.className = 'noContent'; |
|
|
|
|
|
this.emptyContent = true; |
|
|
|
|
|
} |
|
|
|
|
|
else if (this.data.content !== undefined && this.emptyContent == true) { |
|
|
|
|
|
dom.content.className = 'content'; |
|
|
|
|
|
this.emptyContent = false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this._updateContents(this.dom.content); |
|
|
this._updateContents(this.dom.content); |
|
|
this._updateTitle(this.dom.content); |
|
|
this._updateTitle(this.dom.content); |
|
|
this._updateDataAttributes(this.dom.content); |
|
|
this._updateDataAttributes(this.dom.content); |
|
|