Browse Source

TS CustomCommand

ts-style-manager
Artur Arseniev 4 years ago
parent
commit
5fc7eb8322
  1. 8
      src/commands/view/OpenAssets.ts

8
src/commands/view/OpenAssets.js → src/commands/view/OpenAssets.ts

@ -1,8 +1,10 @@
import { isFunction } from 'underscore'; import { isFunction } from 'underscore';
import Asset from '../../asset_manager/model/Asset';
import { createEl } from '../../utils/dom'; import { createEl } from '../../utils/dom';
import { CustomCommand } from './CommandAbstract';
export default { export default {
open(content) { open(content: string) {
const { editor, title, config, am } = this; const { editor, title, config, am } = this;
const { custom } = config; const { custom } = config;
if (isFunction(custom.open)) { if (isFunction(custom.open)) {
@ -47,7 +49,7 @@ export default {
am.__trgCustom(); am.__trgCustom();
} else { } else {
if (!this.rendered || types) { if (!this.rendered || types) {
let assets = am.getAll().filter(i => i); let assets: Asset[] = am.getAll().filter((i: Asset) => i);
if (types && types.length) { if (types && types.length) {
assets = assets.filter(a => types.indexOf(a.get('type')) !== -1); assets = assets.filter(a => types.indexOf(a.get('type')) !== -1);
@ -71,4 +73,4 @@ export default {
this.editor = editor; this.editor = editor;
this.close(this.rendered); this.close(this.rendered);
}, },
}; } as CustomCommand<any, { [k: string]: any }>;
Loading…
Cancel
Save