Merge pull request #846 from iconexperience/reduce-fix

Make sure reduced item has no parent if original item had no parent.
Fix for #835
This commit is contained in:
Jürg Lehni 2015-12-26 23:15:03 +01:00
parent b987590c71
commit fec67617e1

View file

@ -2325,7 +2325,12 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
reduce: function() {
if (this._children && this._children.length === 1) {
var child = this._children[0].reduce();
child.insertAbove(this);
// make sure that reduced item has same parent as original
if (this.parent) {
child.insertAbove(this);
} else {
child.remove();
}
child.copyAttributes(this);
this.remove();
return child;