Skip to content

Commit

Permalink
Remove selectedComponent reference in SelectComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Jun 2, 2018
1 parent b6d1b9f commit 7fc7a35
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/commands/view/SelectComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
methods[method](body, 'click', this.onClick);
methods[method](win, 'scroll resize', this.onFrameScroll);
methods[method](win, 'keydown', this.onKeyPress);
em[method]('change:selectedComponent', this.onSelect, this);
em[method]('component:toggled', this.onSelect, this);
em[method]('change:componentHovered', this.onHovered, this);
},

Expand All @@ -64,7 +64,7 @@ module.exports = {
* */
onKeyPress(e) {
var key = e.which || e.keyCode;
var comp = this.editorModel.get('selectedComponent');
var comp = this.editorModel.getSelected();
var focused = this.frameEl.contentDocument.activeElement.tagName !== 'BODY';

// On CANC (46) or Backspace (8)
Expand Down Expand Up @@ -431,7 +431,7 @@ module.exports = {
*/
updateToolbar(mod) {
var em = this.config.em;
var model = mod == em ? em.get('selectedComponent') : mod;
var model = mod == em ? em.getSelected() : mod;
var toolbarEl = this.canvas.getToolbarEl();
var toolbarStyle = toolbarEl.style;

Expand Down Expand Up @@ -525,7 +525,7 @@ module.exports = {
if (el) {
var elPos = this.getElementPos(el);
this.updateBadge(el, elPos);
var model = this.em.get('selectedComponent');
var model = this.em.getSelected();

if (model) {
this.updateToolbarPos(model.view.el);
Expand Down Expand Up @@ -603,6 +603,5 @@ module.exports = {

em.off('component:update', this.updateAttached, this);
em.off('change:canvasOffset', this.updateAttached, this);
em.off('change:selectedComponent', this.updateToolbar, this);
}
};

0 comments on commit 7fc7a35

Please sign in to comment.