mirror of
https://github.com/codex-team/editor.js
synced 2024-06-18 13:45:20 +02:00
refactoring: notifier is util now (#1628)
* Notifier is util now
* Update CHANGELOG.md
* Update notifier.ts
* Update cypress.yml
* Revert "Update cypress.yml"
This reverts commit a2c8331314
.
* Update CHANGELOG.md
This commit is contained in:
parent
2996affb0a
commit
472d950b0b
|
@ -4,6 +4,7 @@
|
|||
|
||||
- `Fix` — Append default Tunes if user tunes are provided for Block Tool [#1640](https://github.com/codex-team/editor.js/issues/1640)
|
||||
- `Fix` - Prevent the leak of codex-tooltip when Editor.js is destroyed [#1475](https://github.com/codex-team/editor.js/issues/1475).
|
||||
- `Refactoring` - Notifier module now is a util.
|
||||
|
||||
### 2.20.1
|
||||
|
||||
|
|
|
@ -1,15 +1,38 @@
|
|||
import { Notifier } from '../../../../types/api';
|
||||
import EventsDispatcher from '../../utils/events';
|
||||
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;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @param {object} moduleConfiguration - Module Configuration
|
||||
* @param {EditorConfig} moduleConfiguration.config - Editor's config
|
||||
* @param {EventsDispatcher} moduleConfiguration.eventsDispatcher - Editor's event dispatcher
|
||||
*/
|
||||
constructor({ config, eventsDispatcher }: ModuleConfig) {
|
||||
super({
|
||||
config,
|
||||
eventsDispatcher,
|
||||
});
|
||||
|
||||
this.notifier = new Notifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* Available methods
|
||||
*/
|
||||
public get methods(): Notifier {
|
||||
public get methods(): INotifier {
|
||||
return {
|
||||
show: (options: NotifierOptions | ConfirmNotifierOptions | PromptNotifierOptions): void => this.show(options),
|
||||
};
|
||||
|
@ -21,6 +44,6 @@ export default class NotifierAPI extends Module {
|
|||
* @param {NotifierOptions} options - message option
|
||||
*/
|
||||
public show(options: NotifierOptions | ConfirmNotifierOptions | PromptNotifierOptions): void {
|
||||
return this.Editor.Notifier.show(options);
|
||||
return this.notifier.show(options);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import Module from '../__module';
|
||||
|
||||
/**
|
||||
* Use external package module for notifications
|
||||
*
|
||||
|
@ -8,9 +6,9 @@ import Module from '../__module';
|
|||
import notifier, { ConfirmNotifierOptions, NotifierOptions, PromptNotifierOptions } from 'codex-notifier';
|
||||
|
||||
/**
|
||||
* Notifier module
|
||||
* Util for showing notifications
|
||||
*/
|
||||
export default class Notifier extends Module {
|
||||
export default class Notifier {
|
||||
/**
|
||||
* Show web notification
|
||||
*
|
2
src/types-internal/editor-modules.d.ts
vendored
2
src/types-internal/editor-modules.d.ts
vendored
|
@ -5,7 +5,6 @@ import InlineToolbar from '../components/modules/toolbar/inline';
|
|||
import Toolbox from '../components/modules/toolbar/toolbox';
|
||||
import BlockSettings from '../components/modules/toolbar/blockSettings';
|
||||
import Paste from '../components/modules/paste';
|
||||
import Notifier from '../components/modules/notifier';
|
||||
import DragNDrop from '../components/modules/dragNDrop';
|
||||
import ModificationsObserver from '../components/modules/modificationsObserver';
|
||||
import Renderer from '../components/modules/renderer';
|
||||
|
@ -52,7 +51,6 @@ export interface EditorModules {
|
|||
API: API;
|
||||
Caret: Caret;
|
||||
Saver: Saver;
|
||||
Notifier: Notifier;
|
||||
BlockManager: BlockManager;
|
||||
BlocksAPI: BlocksAPI;
|
||||
CaretAPI: CaretAPI;
|
||||
|
|
Loading…
Reference in a new issue