@silexlabs/grapesjs-notifications 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,7 +9,7 @@ This GrapesJs plugin is designed to enhance the user experience within the edito
9
9
  Features
10
10
 
11
11
  * [x] Notification types with corresponding icons
12
- * [x] Select component attached to the notification
12
+ * [x] Select component attached to the notification (supports components on different pages)
13
13
  * [x] Customizable notification style
14
14
  * [x] Internationalization
15
15
  * [x] Local storage for persistent notifications
@@ -20,6 +20,7 @@ Features
20
20
  * [x] Notification commands
21
21
  * [x] editor.NotificationManager API
22
22
  * [x] Group notifications
23
+ * [x] Support pages
23
24
 
24
25
  ### HTML
25
26
  ```html
@@ -59,7 +60,7 @@ API:
59
60
  * `type`: `error`, `warning`, `success`, `info`
60
61
  * `message`: `string`
61
62
  * `timeout`: `number` (ms)
62
- * `component`: `string` or GrapesJs `Component` (optional)
63
+ * `componentId`: `string`
63
64
  * `editor.Notifications` methods:
64
65
  * `add(notification)`
65
66
  * `remove(notification)`
@@ -83,7 +84,7 @@ API:
83
84
  | `storeKey` | Store notifications in local storage under this key | `string` | No storage |
84
85
  | `icons` | Icons for the notification types | `object` | `{error: '\u2716', warning: '\u26A0', success: '\u2714', info: '\u2139'}` |
85
86
  | `i18n` | Internationalization | `object` | Check the values in locale/en.js |
86
- | `maxNotifications` | Maximum number of notifications to display | `number` | `5` |
87
+ | `maxNotifications` | Maximum number of notifications to display | `number` | No limit |
87
88
  | `reverse` | Reverse the order of the notifications | `boolean` | `false` |
88
89
 
89
90
  ## Styling
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import Backbone from 'backbone';
2
- import { Component, Editor } from 'grapesjs';
2
+ import { Editor } from 'grapesjs';
3
3
  import { StyleInfo } from 'lit/directives/style-map';
4
4
 
5
5
  export interface NotificationOptions {
6
6
  message: string;
7
7
  group?: string;
8
8
  timeout?: number;
9
- component?: string | Component;
9
+ componentId?: string;
10
10
  type: "info" | "warning" | "error" | "success";
11
11
  icons: {
12
12
  info: string;
@@ -20,7 +20,7 @@ export interface NotificationModel extends Backbone.Model<NotificationOptions> {
20
20
  declare class Notification {
21
21
  protected editor: NotificationEditor;
22
22
  protected model: NotificationModel;
23
- component: Component | null;
23
+ componentId: string | null;
24
24
  group: string | null;
25
25
  timeoutRef: NodeJS.Timeout | undefined;
26
26
  message: string;
@@ -30,6 +30,14 @@ declare class Notification {
30
30
  select(): void;
31
31
  remove(): void;
32
32
  getSvgIcon(type: string): string;
33
+ private getDefaultOptions;
34
+ /**
35
+ * Get all components in the editor
36
+ * This is a heavy operation
37
+ */
38
+ private getAllComponents;
39
+ private getAllComponentInPage;
40
+ private getAllChildrenComponent;
33
41
  }
34
42
  export interface NotificationEditor extends Editor {
35
43
  NotificationManager: NotificationManager;