<commit_before>import { each } from 'underscore';

export default {
  getPanels(editor) {
    if (!this.panels) {
      this.panels = editor.Panels.getPanelsEl();
    }

    return this.panels;
  },

  tglPointers(editor, val) {
    const body = editor.Canvas.getBody();
    const elP = body.querySelectorAll(`.${this.ppfx}no-pointer`);
    each(elP, item => (item.style.pointerEvents = val ? '' : 'all'));
  },

  run(editor, sender) {
    this.sender = sender;
    editor.stopCommand('sw-visibility');
    editor.getModel().stopDefault();
    const panels = this.getPanels(editor);
    const canvas = editor.Canvas.getElement();
    const editorEl = editor.getEl();
    const pfx = editor.Config.stylePrefix;

    if (!this.helper) {
      const helper = document.createElement('span');
      helper.className = `${pfx}off-prv fa fa-eye-slash`;
      editorEl.appendChild(helper);
      helper.onclick = () => this.stopCommand();
      this.helper = helper;
    }

    this.helper.style.display = 'inline-block';
    this.tglPointers(editor);
    panels.style.display = 'none';
    const canvasS = canvas.style;
    canvasS.width = '100%';
    canvasS.height = '100%';
    canvasS.top = '0';
    canvasS.left = '0';
    canvasS.padding = '0';
    canvasS.margin = '0';
    editor.refresh();
  },

  stop(editor) {
    const { sender = {} } = this;
    sender.set && sender.set('active', 0);
    const panels = this.getPanels(editor);
    if (editor.Panels.getButton("options","sw-visibility").attributes.active) {
        editor.runCommand('sw-visibility');
    }
    editor.getModel().runDefault();
    panels.style.display = '';<commit_msg>Update preview command<commit_after>import { each } from 'underscore';

export default {
  getPanels(editor) {
    if (!this.panels) {
      this.panels = editor.Panels.getPanelsEl();
    }

    return this.panels;
  },

  tglPointers(editor, val) {
    const body = editor.Canvas.getBody();
    const elP = body.querySelectorAll(`.${this.ppfx}no-pointer`);
    each(elP, item => (item.style.pointerEvents = val ? '' : 'all'));
  },

  run(editor, sender) {
    this.sender = sender;
    editor.stopCommand('sw-visibility');
    editor.getModel().stopDefault();
    const panels = this.getPanels(editor);
    const canvas = editor.Canvas.getElement();
    const editorEl = editor.getEl();
    const pfx = editor.Config.stylePrefix;

    if (!this.helper) {
      const helper = document.createElement('span');
      helper.className = `${pfx}off-prv fa fa-eye-slash`;
      editorEl.appendChild(helper);
      helper.onclick = () => this.stopCommand();
      this.helper = helper;
    }

    this.helper.style.display = 'inline-block';
    this.tglPointers(editor);
    panels.style.display = 'none';
    const canvasS = canvas.style;
    canvasS.width = '100%';
    canvasS.height = '100%';
    canvasS.top = '0';
    canvasS.left = '0';
    canvasS.padding = '0';
    canvasS.margin = '0';
    editor.refresh();
  },

  stop(editor) {
    const { sender = {} } = this;
    sender.set && sender.set('active', 0);
    const panels = this.getPanels(editor);
    if (editor.Panels.getButton('options', 'sw-visibility').get('active')) {
      editor.runCommand('sw-visibility');
    }
    editor.getModel().runDefault();
    panels.style.display = '';
{'fraction_non_alphanumeric': 0.16676792223572295, 'fraction_numerical': 0.006682867557715674, 'mean_word_length': 3.050430504305043, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7292983', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1065, 'n_words': 191}