Skip to content

Commit

Permalink
Merge pull request #846 from iconexperience/reduce-fix
Browse files Browse the repository at this point in the history
Make sure reduced item has no parent if original item had no parent.
Fix for #835
  • Loading branch information
lehni committed Dec 26, 2015
1 parent 411336c commit 93b6ac5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/item/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 93b6ac5

Please sign in to comment.