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

Commit

Permalink
refine deletion/selection: can't select design host; delete selects p…
Browse files Browse the repository at this point in the history
…arent element.
  • Loading branch information
sorvell committed Apr 8, 2014
1 parent 40b8c14 commit 4b20366
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions elements/x-designable/x-designable.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@

deleteElement: function() {
var e = this.selected;
if (e && e !== this) {
e.parentNode.removeChild(e);
if (e && e !== this && e !== this.designHost) {
var parent = e.parentNode;
parent.removeChild(e);
forSubtree(e, this.removeElementRule.bind(this));
this.selected = null;
this.selected = parent;
}
},

Expand Down Expand Up @@ -256,6 +257,9 @@
this.dragInfo.dropped = this.drop(this.dragInfo.element, e);
} else {
this.selected = e.target;
if (this.selected === this) {
this.selected = this.designHost;
}
}
this.dragInfo = null;
//var focusNode = nodeIsEditor(this.selected) ? this.selected : this;
Expand Down Expand Up @@ -387,6 +391,7 @@
this.designHost.loadHtml(html, function() {
this.appendChild(this.designHost);
this.notify();
this.selected = this.designHost;
}.bind(this));
},

Expand Down

0 comments on commit 4b20366

Please sign in to comment.