@topol.io/editor-react 0.0.4 → 0.2.0

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
@@ -2,48 +2,48 @@
2
2
  <img src="https://storage.googleapis.com/topolio17326/plugin-assets/6320/17326/topol-with-bg.png" alt="Tailwind CSS" width="400" height="120">
3
3
  </a>
4
4
 
5
- ----
5
+ ---
6
6
 
7
7
  Easy and quick! Drag and drop HTML editor and builder for beautiful responsive email templates.
8
8
 
9
-
10
9
  # Documentation
11
10
 
12
11
  ## Installation
12
+
13
13
  Install Editor from NPM using:
14
14
 
15
15
  ```sh
16
16
  npm install @topol.io/editor-react
17
17
 
18
- //or
18
+ //or
19
19
 
20
20
  yarn add @topol.io/editor-react
21
21
  ```
22
22
 
23
23
  ## Use in Component
24
+
24
25
  In your React component import and add the simplest options.
25
26
 
26
- For more options see the docs for [TopolOptions configuration](https://topol.io/docs#plugin-configuration)
27
+ For more options see the docs for [TopolOptions configuration](https://docs.topol.io/reference/topol-options.html)
27
28
 
28
29
  ```js
29
30
  import TopolEditor from '@topol.io/editor-react';
30
31
 
31
32
  const customOptions = {
32
33
  authorize: {
33
- apiKey: "YOUR_API_TOKEN",
34
- userId: "some-user-id",
35
- },
34
+ apiKey: 'YOUR_API_TOKEN',
35
+ userId: 'some-user-id',
36
+ },
36
37
  };
37
-
38
38
  ```
39
39
 
40
40
  ```jsx
41
41
  <TopolEditor options={customOptions}></TopolEditor>
42
42
  ```
43
43
 
44
-
45
44
  ## Call Topol Plugin actions
46
- To call actions to the editor import:
45
+
46
+ To call actions to the editor import:
47
47
 
48
48
  ```js
49
49
  import { TopolPlugin } from '@topol.io/editor-react';
@@ -51,22 +51,7 @@ import { TopolPlugin } from '@topol.io/editor-react';
51
51
  TopolPlugin.save();
52
52
  ```
53
53
 
54
- ### List of all available TopolPlugin actions:
55
-
56
- | Action | Description |
57
- | --- | ----------- |
58
- | `TopolPlugin.save()` | Saves the content of the editor [more info](https://topol.io/docs#plugin-configuration) |
59
- | `TopolPlugin.load(template`) | Loads the provided template [more info](https://topol.io/docs#save-and-load-options) |
60
- | `TopolPlugin.togglePreview()` | Toggles editor preview [more info](https://topol.io/docs#preview-mode-on-desktop-and-mobile)|
61
- | `TopolPlugin.togglePreviewSize()` | Toggles editor preview size |
62
- | `TopolPlugin.undo()` | Undo change in editor [more info](https://topol.io/docs#redo-and-undo)|
63
- | `TopolPlugin.redo()` | Redo change in editor [more info](https://topol.io/docs#redo-and-undo)|
64
- | `TopolPlugin.setSavedBlocks(savedblock: ISavedBlock[])` | Sets the saved blocks [more info](https://topol.io/docs#saved-blocks) |
65
- | `TopolPlugin.createNotification(notification: INotification)` | Creates editor's notification [more info](https://topol.io/docs#show-custom-notification-in-editor) |
66
- | `TopolPlugin.changeEmailToMobile()` | Change email to mobile view [more info](https://topol.io/docs#mobile-first-email-template)|
67
- | `TopolPlugin.changeEmailToDesktop()` | Change email to desktop view [more info](https://topol.io/docs#mobile-first-email-template)|
68
- | `TopolPlugin.toggleBlocksAndStructuresVisibility()` | Toggle hidden structures visibility for blocks and structures [more info](https://topol.io/docs#mobile-first-email-template)|
69
- | `TopolPlugin.destroy()` | Destroys the editor initialization [more info](https://topol.io/docs#working-with-js-frameworks) |
54
+ For more TopolPlugin functions refer to the [TopolPlugin actions](https://www.npmjs.com/package/@topol.io/editor#call-topol-plugin-actions)
70
55
 
71
56
  <br>
72
57
 
@@ -75,26 +60,35 @@ TopolPlugin.save();
75
60
  The callbacks from editor are received as component events.
76
61
 
77
62
  ```tsx
78
- <TopolEditor options={customOptions} onSave={handleOnSave}></TopolEditor>
63
+ <TopolEditor
64
+ options={customOptions}
65
+ onSave={handleOnSave}
66
+ ></TopolEditor>
79
67
  ```
80
68
 
81
69
  ### List of all editor events
82
70
 
83
- | Event | Description |
84
- | --- | ----------- |
85
- | `onSave` | Returns object which contains html and json of the template} [more info](https://topol.io/docs#onsave-and-onsaveandclose) |
86
- | `onSaveAndClose` | Returns object which contains html and json of the template [more info](https://topol.io/docs#onsave-and-onsaveandclose) |
87
- | `onTestSend` | Returns object which contains email, html and json of the template [more info](https://topol.io/docs#on-test-send) |
88
- | `onOpenFileManager` | When user clicks file manager open [more info](https://topol.io/docs#custom-file-manager)|
89
- | `onLoaded` | When editor is fully loaded |
90
- | `onInit` | When editor inits [more info](https://topol.io/docs#custom-file-manager) |
91
- | `onBlockSave` | When user saves block in editor, returns object of type ISavedBlock [more info](https://topol.io/docs#saved-blocks) |
92
- | `onBlockRemove` | When user removes saved block, returns id of saved block to be removed [more info](https://topol.io/docs#saved-blocks) |
93
- | `onBlockEdit` | When user edits saved block, returns id of saved block to be updated [more info](https://topol.io/docs#saved-blocks) |
94
- | `onUndoChange` | When user clicks undo button, retunrs number of steps user undone [more info](https://topol.io/docs#redo-and-undo) |
95
- | `unRedoChange` | When user clicks redo button, retunrs number of steps user redone [more info](https://topol.io/docs#redo-and-undo) |
96
- | `onPreview` | When user switches to preview |
97
- | `onAlert` | When alert appears in editor [more info](https://topol.io/docs#show-custom-notification-in-editor)|
71
+ | Event | Description |
72
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
73
+ | `@onSave` | Returns object which contains html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-save) |
74
+ | `@onSaveAndClose` | Returns object which contains html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-save-and-close) |
75
+ | `@onTestSend` | Returns object which contains email, html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-test-email-send) |
76
+ | `@onOpenFileManager` | When user clicks file manager open [more info](https://docs.topol.io/guide/custom-filemanager.html#onopenfilemanager) |
77
+ | `@onLoaded` | After editor template is loaded using `TopolPlugin.load()` [more info](https://docs.topol.io/guide/callbacks.html#on-loaded) |
78
+ | `@onInit` | When editor inits [more info](https://docs.topol.io/guide/callbacks.html#on-init) |
79
+ | `@onBlockSave` | When user saves block in editor, returns object of type ISavedBlock [more info](https://docs.topol.io/guide/callbacks.html#on-block-save) |
80
+ | `@onBlockRemove` | When user removes saved block, returns id of saved block to be removed [more info](https://docs.topol.io/guide/callbacks.html#on-block-remove) |
81
+ | `@onBlockEdit` | When user edits saved block, returns id of saved block to be updated [more info](https://docs.topol.io/guide/callbacks.html#on-block-edit) |
82
+ | `@onUndoChange` | When user clicks undo button, retunrs number of steps user undone [more info](https://docs.topol.io/guide/callbacks.html#on-undo-change) |
83
+ | `@onRedoChange` | When user clicks redo button, retunrs number of steps user redone [more info](https://docs.topol.io/guide/callbacks.html#on-redo-change) |
84
+ | `@onPreview` | When user switches to preview [more info](https://docs.topol.io/guide/callbacks.html#on-preview) |
85
+ | `@onAlert` | When alert appears in editor [more info](https://docs.topol.io/guide/callbacks.html#on-alert) |
86
+ | `@onClose` | When close is click inside WindowBar [more info](https://docs.topol.io/guide/top-bar.html#window-bar) |
87
+ | `@onEdittedWithoutSaveChanged` | When user is about to leave an editor with unsaved changes [more info](https://docs.topol.io/guide/disable-before-leaving-modal.html#before-exit-modal-when-user-has-unsaved-changes) |
88
+ | `@onOpenCustomBlockDialog` | When user clicks on the open dialog in custom block [more info](https://docs.topol.io/guide/custom-block.html#inserting-custom-html-in-custom-dialog-component) |
89
+ | `@onTemplateRename` | When user clicks on the pencil icon next to the template name [more info](https://docs.topol.io/guide/rename-template.html#rename-template) |
90
+ | `@updateTestingEmailAddresses` | When user edits the email list in preview [more info](https://docs.topol.io/guide/sending-a-test-email.html#managing-saving-emails-yourself) |
91
+ | `@onError` | When an error that cannot be handled happened in the editor [more info](https://docs.topol.io/guide/callbacks.html#onerror) |
98
92
 
99
93
  <br>
100
94
 
@@ -103,5 +97,9 @@ The callbacks from editor are received as component events.
103
97
  Topol Editor provides full TypeScript integration and exports all necessary types.
104
98
 
105
99
  ```tsx
106
- import { ITopolOptions, INotification, ISavedBlock } from '@topol.io/editor-react';
100
+ import {
101
+ ITopolOptions,
102
+ INotification,
103
+ ISavedBlock,
104
+ } from '@topol.io/editor-react';
107
105
  ```