Skip to content

Commit

Permalink
Put the visibility key in a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Apr 1, 2020
1 parent 398509f commit 55493d6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/commands/view/Preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { each } from 'underscore';

const cmdVis = 'sw-visibility';

export default {
getPanels(editor) {
if (!this.panels) {
Expand All @@ -19,13 +21,10 @@ export default {
this.sender = sender;

if (!this.shouldRunSwVisibility) {
this.shouldRunSwVisibility = editor.Commands.isActive('sw-visibility');
}

if (this.shouldRunSwVisibility) {
editor.stopCommand('sw-visibility');
this.shouldRunSwVisibility = editor.Commands.isActive(cmdVis);
}

this.shouldRunSwVisibility && editor.stopCommand(cmdVis);
editor.getModel().stopDefault();

const panels = this.getPanels(editor);
Expand Down Expand Up @@ -62,12 +61,11 @@ export default {
const panels = this.getPanels(editor);

if (this.shouldRunSwVisibility) {
editor.runCommand('sw-visibility');
editor.runCommand(cmdVis);
this.shouldRunSwVisibility = false;
}

editor.getModel().runDefault();

panels.forEach(panel => panel.set('visible', true));

const canvas = editor.Canvas.getElement();
Expand Down

0 comments on commit 55493d6

Please sign in to comment.