Browse Source

TS Preview

ts-style-manager
Artur Arseniev 3 years ago
parent
commit
38c7a639ca
  1. 2
      src/commands/view/CommandAbstract.ts
  2. 16
      src/commands/view/Preview.ts

2
src/commands/view/CommandAbstract.ts

@ -137,7 +137,7 @@ export default class CommandAbstract<O extends AnyObject = any> extends Model {
/**
* Stop current command
*/
stopCommand(opts: any) {
stopCommand(opts?: any) {
this.em.get('Commands').stop(this.id, opts);
}

16
src/commands/view/Preview.js → src/commands/view/Preview.ts

@ -1,9 +1,11 @@
import { each } from 'underscore';
import Editor from '../../editor';
import { CustomCommand } from './CommandAbstract';
const cmdOutline = 'core:component-outline';
export default {
getPanels(editor) {
getPanels(editor: Editor) {
if (!this.panels) {
this.panels = editor.Panels.getPanels();
}
@ -11,11 +13,11 @@ export default {
return this.panels;
},
preventDrag(opts) {
preventDrag(opts: any) {
opts.abort = 1;
},
tglEffects(on) {
tglEffects(on: boolean) {
const { em } = this;
const mthEv = on ? 'on' : 'off';
if (em) {
@ -43,7 +45,7 @@ export default {
const panels = this.getPanels(editor);
const canvas = editor.Canvas.getElement();
const editorEl = editor.getEl();
const editorEl = editor.getEl()!;
const pfx = editor.Config.stylePrefix;
if (!this.helper) {
@ -56,7 +58,7 @@ export default {
this.helper.style.display = 'inline-block';
panels.forEach(panel => panel.set('visible', false));
panels.forEach((panel: any) => panel.set('visible', false));
const canvasS = canvas.style;
canvasS.width = '100%';
@ -80,7 +82,7 @@ export default {
}
editor.getModel().runDefault();
panels.forEach(panel => panel.set('visible', true));
panels.forEach((panel: any) => panel.set('visible', true));
const canvas = editor.Canvas.getElement();
canvas.setAttribute('style', '');
@ -94,4 +96,4 @@ export default {
editor.refresh();
this.tglEffects();
},
};
} as CustomCommand<{}, { [k: string]: any }>;
Loading…
Cancel
Save