From 55493d6e7b9b262eda6198106c897e0305dcb48c Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Thu, 2 Apr 2020 01:13:14 +0200 Subject: [PATCH] Put the visibility key in a variable --- src/commands/view/Preview.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/commands/view/Preview.js b/src/commands/view/Preview.js index cc64f3e92..0693da0aa 100644 --- a/src/commands/view/Preview.js +++ b/src/commands/view/Preview.js @@ -1,5 +1,7 @@ import { each } from 'underscore'; +const cmdVis = 'sw-visibility'; + export default { getPanels(editor) { if (!this.panels) { @@ -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); @@ -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();