mirror of
https://github.com/codex-team/editor.js
synced 2024-05-03 07:03:47 +02:00
3272efc3f7
* update eslint + autofix * a bunch of eslint fixes * some spelling & eslint fixes * fix some eslint errors and spells * Update __module.ts * a bunch of eslint fixes in tests * Update cypress.yml * Update cypress.yml * fix cypress docker image name * fixes for tests * more tests fixed * rm rule ignore * rm another ignored rule * Update .eslintrc
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { Notifier as INotifier } from '../../../../types/api';
|
|
import Notifier from '../../utils/notifier';
|
|
import { ConfirmNotifierOptions, NotifierOptions, PromptNotifierOptions } from 'codex-notifier';
|
|
import Module from '../../__module';
|
|
import { ModuleConfig } from '../../../types-internal/module-config';
|
|
|
|
/**
|
|
*
|
|
*/
|
|
export default class NotifierAPI extends Module {
|
|
/**
|
|
* Notifier utility Instance
|
|
*/
|
|
private notifier: Notifier;
|
|
|
|
/**
|
|
* @param moduleConfiguration - Module Configuration
|
|
* @param moduleConfiguration.config - Editor's config
|
|
* @param moduleConfiguration.eventsDispatcher - Editor's event dispatcher
|
|
*/
|
|
constructor({ config, eventsDispatcher }: ModuleConfig) {
|
|
super({
|
|
config,
|
|
eventsDispatcher,
|
|
});
|
|
|
|
this.notifier = new Notifier();
|
|
}
|
|
|
|
/**
|
|
* Available methods
|
|
*/
|
|
public get methods(): INotifier {
|
|
return {
|
|
show: (options: NotifierOptions | ConfirmNotifierOptions | PromptNotifierOptions): void => this.show(options),
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Show notification
|
|
*
|
|
* @param {NotifierOptions} options - message option
|
|
*/
|
|
public show(options: NotifierOptions | ConfirmNotifierOptions | PromptNotifierOptions): void {
|
|
return this.notifier.show(options);
|
|
}
|
|
}
|