Skip to content

Commit

Permalink
Fix toggleVisibility for items in Layer Manager. Closes GrapesJS#530
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Nov 16, 2017
1 parent c2add4a commit 47befeb
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/navigator/view/ItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,24 +185,26 @@ module.exports = Backbone.View.extend({
* @return void
* */
toggleVisibility(e) {
e.stopPropagation();
e && e.stopPropagation();
const pfx = this.pfx;

if(!this.$eye)
this.$eye = this.$el.children(`#${pfx}btn-eye`);

var cCss = _.clone(this.model.get('style')),
hClass = this.pfx + 'hide';
if(this.isVisible()){
this.$el.addClass(hClass);
this.$eye.addClass('fa-eye-slash');
cCss.display = 'none';
}else{
this.$el.removeClass(hClass);
this.$eye.removeClass('fa-eye-slash');
delete cCss.display;
const model = this.model;
const hClass = `${pfx}hide`;
const style = model.getStyle();
const hideIcon = 'fa-eye-slash';
const $el = this.$el;
!this.$eye && (this.$eye = $el.children(`#${pfx}btn-eye`));

if (this.isVisible()) {
$el.addClass(hClass);
this.$eye.addClass(hideIcon);
style.display = 'none';
} else {
$el.removeClass(hClass);
this.$eye.removeClass(hideIcon);
delete style.display;
}
this.model.set('style', cCss);

model.setStyle(style);
},

/**
Expand Down

0 comments on commit 47befeb

Please sign in to comment.