Browse Source

Up TS add command

pull/4615/head
Artur Arseniev 4 years ago
parent
commit
bd331d9d83
  1. 15
      index.d.ts

15
index.d.ts

@ -1665,6 +1665,12 @@ declare namespace grapesjs {
self(): Block; self(): Block;
} }
interface Command {
run: (editor: Editor, sender?: any, opts?: Record<string, any>) => any;
stop?: (editor: Editor, sender?: any, opts?: Record<string, any>) => any;
[key: string]: unknown;
}
/** /**
* You can customize the initial state of the module from the editor initialization, by passing the following [Configuration Object](https://github.com/artf/grapesjs/blob/master/src/commands/config/config.js) * You can customize the initial state of the module from the editor initialization, by passing the following [Configuration Object](https://github.com/artf/grapesjs/blob/master/src/commands/config/config.js)
* ```js * ```js
@ -1720,14 +1726,9 @@ declare namespace grapesjs {
* // As a function * // As a function
* commands.add('myCommand2', editor => { ... }); * commands.add('myCommand2', editor => { ... });
*/ */
add( add<F, S>(
id: string, id: string,
command: ((editor: Editor, sender?: any, opts?: Record<string, any>) => any) | command: Command['run'] | (Command & S & ThisType<Command & S>),
{
run?: (editor: Editor, sender?: any, opts?: Record<string, any>) => any;
stop?: (editor: Editor, sender?: any, opts?: Record<string, any>) => any;
[key: string]: unknown;
}
): void; ): void;
/** /**
* Get command by ID * Get command by ID

Loading…
Cancel
Save