Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
implement element reordering
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott J. Miles committed Apr 5, 2014
1 parent 9e45261 commit 98cf4ca
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions elements/x-designable/x-designable.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,36 @@
deleteElement: function() {
var e = this.selected;
if (e && e !== this) {
//if (e === this.$.designElement) {
// this.clearElement();
//} else {
e.parentNode.removeChild(e);
forSubtree(e, this.removeElementRule.bind(this));
this.selected = null;
//}
e.parentNode.removeChild(e);
forSubtree(e, this.removeElementRule.bind(this));
this.selected = null;
}
},

promoteElement: function() {
var e = this.selected;
if (e && e !== this) {
e.parentNode.insertBefore(e, e.previousElementSibling);
}
this.notify();
},

demoteElement: function() {
var e = this.selected;
if (e && e !== this) {
var n = e.nextElementSibling;
if (n) {
n = n.nextElementSibling;
if (n) {
e.parentNode.insertBefore(e, n);
} else {
e.parentNode.appendChild(e);
}
}
}
this.notify();
},

selectParentElement: function() {
var e = this.selected;
if (e && e.parentNode) {
Expand Down

0 comments on commit 98cf4ca

Please sign in to comment.