Browse Source

Put the visibility key in a variable

pull/2732/head
Artur Arseniev 7 years ago
parent
commit
55493d6e7b
  1. 12
      src/commands/view/Preview.js

12
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();

Loading…
Cancel
Save