@topol.io/editor 0.0.0-alfa.2 → 0.0.0-alfa.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/LICENSE +13 -0
- package/README +88 -1
- package/dist/topol-plugin.es.js +30 -46
- package/dist/topol-plugin.umd.js +1 -1
- package/dist/types/src/main.d.ts +29 -0
- package/dist/types/types/API/API.d.ts +21 -0
- package/dist/types/types/AuthHeaderConfig/IAuthHeaderConfig.d.ts +3 -0
- package/dist/types/types/ContentBlock/IContentBlockOptions.d.ts +5 -0
- package/dist/types/types/Font/IFont.d.ts +5 -0
- package/dist/types/types/ITopolOptions.d.ts +57 -0
- package/dist/types/types/ITopolPlugin.d.ts +19 -0
- package/dist/types/types/MergeTag/IMergeTag.d.ts +5 -0
- package/dist/types/types/MergeTag/IMergeTagGroup.d.ts +5 -0
- package/dist/types/types/Notification/INotification.d.ts +7 -0
- package/dist/types/types/SavedBlock/ISavedBlock.d.ts +5 -0
- package/dist/types/types/Theme/ITheme.d.ts +33 -0
- package/package.json +17 -4
- package/dist/topol-plugin.d.ts +0 -231
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2022 Ecomail s.r.o.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README
CHANGED
|
@@ -1 +1,88 @@
|
|
|
1
|
-
|
|
1
|
+
<a href="https://topol.io" target="_blank">
|
|
2
|
+
<img src="https://storage.googleapis.com/topolio17326/plugin-assets/6320/17326/topol-with-bg.png" alt="Tailwind CSS" width="400" height="120">
|
|
3
|
+
</a>
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Easy and quick! Drag and drop HTML editor and builder for beautiful responsive email templates.
|
|
8
|
+
|
|
9
|
+
# Documentation
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Install Editor from NPM using:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install @topol.io/editor
|
|
17
|
+
|
|
18
|
+
//or
|
|
19
|
+
|
|
20
|
+
yarn add @topol.io/editor
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
Add HTML element Editor will load to
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<div id="app" style="position: absolute; width: 100%; height: 100%"></div>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
In your JS or TS file import TopolPlugin, initialize the editor, as an ID provide the id you defined the HTML, in this example its `app`
|
|
32
|
+
|
|
33
|
+
For more options see the docs for [TopolOptions configuration](https://topol.io/docs#plugin-configuration)
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
import TopolPlugin from "@topol.io/editor";
|
|
37
|
+
|
|
38
|
+
const TOPOL_OPTIONS = {
|
|
39
|
+
id: "#app",
|
|
40
|
+
authorize: {
|
|
41
|
+
apiKey: "YOUR_API_TOKEN",
|
|
42
|
+
userId: "some-user-id",
|
|
43
|
+
},
|
|
44
|
+
callbacks: {
|
|
45
|
+
onSave(json, html) {},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
TopolPlugin.init(TOPOL_OPTIONS);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Call Topol Plugin actions
|
|
53
|
+
|
|
54
|
+
To call actions to the editor import:
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
import { TopolPlugin } from "@topol.io/editor";
|
|
58
|
+
|
|
59
|
+
TopolPlugin.save();
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### List of all available TopolPlugin actions:
|
|
63
|
+
|
|
64
|
+
| Action | Description |
|
|
65
|
+
| ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
+
| `TopolPlugin.save()` | Saves the content of the editor [more info](https://topol.io/docs#plugin-configuration) |
|
|
67
|
+
| `TopolPlugin.load(template`) | Loads the provided template [more info](https://topol.io/docs#save-and-load-options) |
|
|
68
|
+
| `TopolPlugin.togglePreview()` | Toggles editor preview [more info](https://topol.io/docs#preview-mode-on-desktop-and-mobile) |
|
|
69
|
+
| `TopolPlugin.togglePreviewSize()` | Toggles editor preview size |
|
|
70
|
+
| `TopolPlugin.undo()` | Undo change in editor [more info](https://topol.io/docs#redo-and-undo) |
|
|
71
|
+
| `TopolPlugin.redo()` | Redo change in editor [more info](https://topol.io/docs#redo-and-undo) |
|
|
72
|
+
| `TopolPlugin.setSavedBlocks(savedblock: ISavedBlock[])` | Sets the saved blocks [more info](https://topol.io/docs#saved-blocks) |
|
|
73
|
+
| `TopolPlugin.createNotification(notification: INotification)` | Creates editor's notification [more info](https://topol.io/docs#show-custom-notification-in-editor) |
|
|
74
|
+
| `TopolPlugin.changeEmailToMobile()` | Change email to mobile view [more info](https://topol.io/docs#mobile-first-email-template) |
|
|
75
|
+
| `TopolPlugin.changeEmailToDesktop()` | Change email to desktop view [more info](https://topol.io/docs#mobile-first-email-template) |
|
|
76
|
+
| `TopolPlugin.toggleBlocksAndStructuresVisibility()` | Toggle hidden structures visibility for blocks and structures [more info](https://topol.io/docs#mobile-first-email-template) |
|
|
77
|
+
| `TopolPlugin.destroy()` | Destroys the editor initialization [more info](https://topol.io/docs#working-with-js-frameworks) |
|
|
78
|
+
|
|
79
|
+
<br>
|
|
80
|
+
|
|
81
|
+
<br>
|
|
82
|
+
## TypeScript
|
|
83
|
+
|
|
84
|
+
Topol Editor provides full TypeScript integration and exports all necessary types.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { ITopolOptions, INotification, ISavedBlock } from "@topol.io/editor";
|
|
88
|
+
```
|
package/dist/topol-plugin.es.js
CHANGED
|
@@ -49,8 +49,8 @@ function ieOnEnd(script, cb) {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
const TOPOL_URL = "https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js";
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
const TopolPlugin = {
|
|
53
|
+
init: (options) => {
|
|
54
54
|
return new Promise((resolve, reject) => {
|
|
55
55
|
loadScript(TOPOL_URL, (err) => {
|
|
56
56
|
if (err !== null) {
|
|
@@ -60,61 +60,45 @@ const createTopolPlugin = (options) => {
|
|
|
60
60
|
resolve(true);
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
|
-
}
|
|
64
|
-
|
|
63
|
+
},
|
|
64
|
+
save: () => {
|
|
65
65
|
window.TopolPlugin.save();
|
|
66
|
-
}
|
|
67
|
-
|
|
66
|
+
},
|
|
67
|
+
load: (json) => {
|
|
68
68
|
window.TopolPlugin.load(json);
|
|
69
|
-
}
|
|
70
|
-
|
|
69
|
+
},
|
|
70
|
+
togglePreview: () => {
|
|
71
71
|
window.TopolPlugin.togglePreview();
|
|
72
|
-
}
|
|
73
|
-
|
|
72
|
+
},
|
|
73
|
+
togglePreviewSize: () => {
|
|
74
74
|
window.TopolPlugin.togglePreviewSize();
|
|
75
|
-
}
|
|
76
|
-
|
|
75
|
+
},
|
|
76
|
+
chooseFile: (url) => {
|
|
77
77
|
window.TopolPlugin.chooseFile(url);
|
|
78
|
-
}
|
|
79
|
-
|
|
78
|
+
},
|
|
79
|
+
undo: () => {
|
|
80
80
|
window.TopolPlugin.undo();
|
|
81
|
-
}
|
|
82
|
-
|
|
81
|
+
},
|
|
82
|
+
redo: () => {
|
|
83
83
|
window.TopolPlugin.redo();
|
|
84
|
-
}
|
|
85
|
-
|
|
84
|
+
},
|
|
85
|
+
setSavedBlocks: (savedBlocks) => {
|
|
86
86
|
window.TopolPlugin.setSavedBlocks(savedBlocks);
|
|
87
|
-
}
|
|
88
|
-
|
|
87
|
+
},
|
|
88
|
+
createNotification: (notification) => {
|
|
89
89
|
window.TopolPlugin.createNotification(notification);
|
|
90
|
-
}
|
|
91
|
-
|
|
90
|
+
},
|
|
91
|
+
changeEmailToMobile: () => {
|
|
92
92
|
window.TopolPlugin.changeEmailToMobile();
|
|
93
|
-
}
|
|
94
|
-
|
|
93
|
+
},
|
|
94
|
+
changeEmailToDesktop: () => {
|
|
95
95
|
window.TopolPlugin.changeEmailToDesktop();
|
|
96
|
-
}
|
|
97
|
-
|
|
96
|
+
},
|
|
97
|
+
toggleBlocksAndStructuresVisibility: () => {
|
|
98
98
|
window.TopolPlugin.toggleBlocksAndStructuresVisibility();
|
|
99
|
-
}
|
|
100
|
-
|
|
99
|
+
},
|
|
100
|
+
destroy: () => {
|
|
101
101
|
window.TopolPlugin.destroy();
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
init,
|
|
105
|
-
save,
|
|
106
|
-
load: load2,
|
|
107
|
-
togglePreview,
|
|
108
|
-
togglePreviewSize,
|
|
109
|
-
chooseFile,
|
|
110
|
-
undo,
|
|
111
|
-
redo,
|
|
112
|
-
setSavedBlocks,
|
|
113
|
-
createNotification,
|
|
114
|
-
changeEmailToMobile,
|
|
115
|
-
changeEmailToDesktop,
|
|
116
|
-
toggleBlocksAndStructuresVisibility,
|
|
117
|
-
destroy
|
|
118
|
-
};
|
|
102
|
+
}
|
|
119
103
|
};
|
|
120
|
-
export {
|
|
104
|
+
export { TopolPlugin as default };
|
package/dist/topol-plugin.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(d
|
|
1
|
+
(function(l,d){typeof exports=="object"&&typeof module!="undefined"?module.exports=d():typeof define=="function"&&define.amd?define(d):(l=typeof globalThis!="undefined"?globalThis:l||self,l["topol-plugin"]=d())})(this,function(){"use strict";var l=function(n,e,t){var c=document.head||document.getElementsByTagName("head")[0],i=document.createElement("script");typeof e=="function"&&(t=e,e={}),e=e||{},t=t||function(){},i.type=e.type||"text/javascript",i.charset=e.charset||"utf8",i.async="async"in e?!!e.async:!0,i.src=n,e.attrs&&d(i,e.attrs),e.text&&(i.text=""+e.text);var s="onload"in i?u:a;s(i,t),i.onload||u(i,t),c.appendChild(i)};function d(o,n){for(var e in n)o.setAttribute(e,n[e])}function u(o,n){o.onload=function(){this.onerror=this.onload=null,n(null,o)},o.onerror=function(){this.onerror=this.onload=null,n(new Error("Failed to load "+this.src),o)}}function a(o,n){o.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,n(null,o))}}const r="https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js";return{init:o=>new Promise((n,e)=>{l(r,t=>{t!==null&&e(t),window.TopolPlugin.init(o),n(!0)})}),save:()=>{window.TopolPlugin.save()},load:o=>{window.TopolPlugin.load(o)},togglePreview:()=>{window.TopolPlugin.togglePreview()},togglePreviewSize:()=>{window.TopolPlugin.togglePreviewSize()},chooseFile:o=>{window.TopolPlugin.chooseFile(o)},undo:()=>{window.TopolPlugin.undo()},redo:()=>{window.TopolPlugin.redo()},setSavedBlocks:o=>{window.TopolPlugin.setSavedBlocks(o)},createNotification:o=>{window.TopolPlugin.createNotification(o)},changeEmailToMobile:()=>{window.TopolPlugin.changeEmailToMobile()},changeEmailToDesktop:()=>{window.TopolPlugin.changeEmailToDesktop()},toggleBlocksAndStructuresVisibility:()=>{window.TopolPlugin.toggleBlocksAndStructuresVisibility()},destroy:()=>{window.TopolPlugin.destroy()}}});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import ITopolOptions from "../types/ITopolOptions";
|
|
2
|
+
import ITopolPlugin from "../types/ITopolPlugin";
|
|
3
|
+
import INotification from "../types/Notification/INotification";
|
|
4
|
+
import ISavedBlock from "../types/SavedBlock/ISavedBlock";
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
TopolPlugin: ITopolPlugin;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
declare const TopolPlugin: {
|
|
11
|
+
init: (options: ITopolOptions) => Promise<boolean | string>;
|
|
12
|
+
save: () => void;
|
|
13
|
+
load: (json: unknown) => void;
|
|
14
|
+
togglePreview: () => void;
|
|
15
|
+
togglePreviewSize: () => void;
|
|
16
|
+
chooseFile: (url: string) => void;
|
|
17
|
+
undo: () => void;
|
|
18
|
+
redo: () => void;
|
|
19
|
+
setSavedBlocks: (savedBlocks: ISavedBlock[]) => void;
|
|
20
|
+
createNotification: (notification: INotification) => void;
|
|
21
|
+
changeEmailToMobile: () => void;
|
|
22
|
+
changeEmailToDesktop: () => void;
|
|
23
|
+
toggleBlocksAndStructuresVisibility: () => void;
|
|
24
|
+
destroy: () => void;
|
|
25
|
+
};
|
|
26
|
+
export default TopolPlugin;
|
|
27
|
+
export type { ITopolOptions };
|
|
28
|
+
export type { INotification };
|
|
29
|
+
export type { ISavedBlock };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface IAPI {
|
|
2
|
+
GET_AUTOSAVE: string;
|
|
3
|
+
AUTOSAVES: string;
|
|
4
|
+
LOAD: string;
|
|
5
|
+
SAVE: string | null;
|
|
6
|
+
AUTOSAVE: string;
|
|
7
|
+
PREVIEW: string;
|
|
8
|
+
FEEDS: string;
|
|
9
|
+
PRODUCTS: string;
|
|
10
|
+
IMAGE_UPLOAD: string;
|
|
11
|
+
FOLDERS: string;
|
|
12
|
+
IMAGE_EDITOR_UPLOAD: string | null;
|
|
13
|
+
TEST_EMAIL: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ILockedAPI {
|
|
16
|
+
GIPHY_API_KEY: string;
|
|
17
|
+
GIPHY_SEARCH: string;
|
|
18
|
+
AUTHORIZE: string;
|
|
19
|
+
GCS_SIGNED_URL: string;
|
|
20
|
+
SAVE_SERVER: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { IAPI } from "./API/API";
|
|
2
|
+
import ISavedBlock from "./SavedBlock/ISavedBlock";
|
|
3
|
+
import INotification from "./Notification/INotification";
|
|
4
|
+
import IMergeTagGroup from "./MergeTag/IMergeTagGroup";
|
|
5
|
+
import IContentBlockOptions from "./ContentBlock/IContentBlockOptions";
|
|
6
|
+
import ITheme from "./Theme/ITheme";
|
|
7
|
+
import IAuthHeaderConfig from "./AuthHeaderConfig/IAuthHeaderConfig";
|
|
8
|
+
import IFont from "./Font/IFont";
|
|
9
|
+
export default interface ITopolOptions {
|
|
10
|
+
id: string;
|
|
11
|
+
authorize: {
|
|
12
|
+
apiKey: string;
|
|
13
|
+
userId: string | number;
|
|
14
|
+
};
|
|
15
|
+
templateId?: number;
|
|
16
|
+
title?: string;
|
|
17
|
+
removeTopBar?: boolean;
|
|
18
|
+
topBarOptions?: Array<string>;
|
|
19
|
+
mainMenuAlign?: "left" | "right";
|
|
20
|
+
disableAlerts?: boolean;
|
|
21
|
+
customFileManager?: boolean;
|
|
22
|
+
language?: string;
|
|
23
|
+
light?: boolean;
|
|
24
|
+
theme?: ITheme;
|
|
25
|
+
hideSettingsTab?: boolean;
|
|
26
|
+
imageEditor?: boolean;
|
|
27
|
+
premadeBlocks?: unknown | boolean;
|
|
28
|
+
savedBlocks?: Array<ISavedBlock> | boolean;
|
|
29
|
+
mergeTags?: Array<IMergeTagGroup>;
|
|
30
|
+
enableAutosaves?: boolean;
|
|
31
|
+
htmlMinified?: boolean;
|
|
32
|
+
apiAuthorizationHeader?: IAuthHeaderConfig | string;
|
|
33
|
+
contentBlocks?: IContentBlockOptions[];
|
|
34
|
+
callbacks: {
|
|
35
|
+
onSave?(json: unknown, html: unknown): void;
|
|
36
|
+
onSaveAndClose?(json: unknown, html: unknown): void;
|
|
37
|
+
onTestSend?(email: string, json: unknown, html: unknown): void;
|
|
38
|
+
onOpenFileManager?(): void;
|
|
39
|
+
onLoaded?(): void;
|
|
40
|
+
onBlockSave?(block: ISavedBlock): void;
|
|
41
|
+
onBlockRemove?(blockId: number): void;
|
|
42
|
+
onBlockEdit?(blockId: number): void;
|
|
43
|
+
onInit?(): void;
|
|
44
|
+
onUndoChange?(count: number): void;
|
|
45
|
+
onRedoChange?(count: number): void;
|
|
46
|
+
onPreview?(html: unknown): void;
|
|
47
|
+
onAlert?(notification: INotification): void;
|
|
48
|
+
};
|
|
49
|
+
api?: IAPI;
|
|
50
|
+
mobileFirstEnabled?: boolean;
|
|
51
|
+
fonts?: Array<IFont>;
|
|
52
|
+
tinyConfig?: unknown;
|
|
53
|
+
fontSizes?: Array<number>;
|
|
54
|
+
colors?: Array<string>;
|
|
55
|
+
googleApiKey?: string;
|
|
56
|
+
role?: "manager" | "editor" | "reader";
|
|
57
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import INotification from "./Notification/INotification";
|
|
2
|
+
import ISavedBlock from "./SavedBlock/ISavedBlock";
|
|
3
|
+
import ITopolOptions from "./ITopolOptions";
|
|
4
|
+
export default interface ITopolPlugin {
|
|
5
|
+
init: (topolOptions: ITopolOptions) => void;
|
|
6
|
+
save: () => void;
|
|
7
|
+
load: (json: unknown) => void;
|
|
8
|
+
togglePreview: () => void;
|
|
9
|
+
togglePreviewSize: () => void;
|
|
10
|
+
chooseFile: (url: string) => void;
|
|
11
|
+
undo: () => void;
|
|
12
|
+
redo: () => void;
|
|
13
|
+
setSavedBlocks: (savedBlocks: ISavedBlock[]) => void;
|
|
14
|
+
createNotification: (notification: INotification) => void;
|
|
15
|
+
changeEmailToMobile: () => void;
|
|
16
|
+
changeEmailToDesktop: () => void;
|
|
17
|
+
toggleBlocksAndStructuresVisibility: () => void;
|
|
18
|
+
destroy: () => void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default interface ITheme {
|
|
2
|
+
preset: "light" | "dark";
|
|
3
|
+
borderRadius?: {
|
|
4
|
+
small?: string;
|
|
5
|
+
large?: string;
|
|
6
|
+
};
|
|
7
|
+
colors: {
|
|
8
|
+
"900"?: string;
|
|
9
|
+
"800"?: string;
|
|
10
|
+
"700"?: string;
|
|
11
|
+
"600"?: string;
|
|
12
|
+
"500"?: string;
|
|
13
|
+
"450"?: string;
|
|
14
|
+
"400"?: string;
|
|
15
|
+
"350"?: string;
|
|
16
|
+
"300"?: string;
|
|
17
|
+
"200"?: string;
|
|
18
|
+
"150"?: string;
|
|
19
|
+
"100"?: string;
|
|
20
|
+
white?: string;
|
|
21
|
+
primary?: string;
|
|
22
|
+
"primary-light"?: string;
|
|
23
|
+
"primary-dark"?: string;
|
|
24
|
+
secondary?: string;
|
|
25
|
+
"secondary-light"?: string;
|
|
26
|
+
error?: string;
|
|
27
|
+
"error-light"?: string;
|
|
28
|
+
success?: string;
|
|
29
|
+
"success-light"?: string;
|
|
30
|
+
active?: string;
|
|
31
|
+
"active-light"?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topol.io/editor",
|
|
3
|
-
"
|
|
3
|
+
"description": "Official NPM package for Topol Editor",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"plugin",
|
|
6
|
+
"editor",
|
|
7
|
+
"email",
|
|
8
|
+
"topol",
|
|
9
|
+
"topol.io",
|
|
10
|
+
"email templates"
|
|
11
|
+
],
|
|
12
|
+
"author": "Topol.io",
|
|
13
|
+
"homepage": "https://topol.io",
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"version": "0.0.0-alfa.6",
|
|
4
16
|
"files": [
|
|
5
17
|
"dist"
|
|
6
18
|
],
|
|
7
19
|
"module": "./dist/topol-plugin.es.js",
|
|
20
|
+
"types": "./dist/types/src/main.d.ts",
|
|
8
21
|
"exports": {
|
|
9
22
|
".": {
|
|
10
23
|
"import": "./dist/topol-plugin.es.js",
|
|
11
24
|
"require": "./dist/topol-plugin.umd.js",
|
|
12
|
-
"types": "./dist/
|
|
25
|
+
"types": "./dist/types/src/main.d.ts"
|
|
13
26
|
}
|
|
14
27
|
},
|
|
15
28
|
"scripts": {
|
|
16
29
|
"dev": "vite",
|
|
17
|
-
"build": "
|
|
30
|
+
"build": "vite build && tsc",
|
|
18
31
|
"lint": "eslint --config '.eslintrc.js' ./**/*.ts --fix",
|
|
19
32
|
"format": "prettier --write .",
|
|
20
|
-
"build:types": "
|
|
33
|
+
"build:types": "tsc"
|
|
21
34
|
},
|
|
22
35
|
"devDependencies": {
|
|
23
36
|
"@types/node": "^17.0.12",
|
package/dist/topol-plugin.d.ts
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
declare module 'topol-plugin/src/main' {
|
|
2
|
-
import ITopolOptions from "topol-plugin/types/ITopolOptions";
|
|
3
|
-
import ITopolPlugin from "topol-plugin/types/ITopolPlugin";
|
|
4
|
-
import INotification from "topol-plugin/types/Notification/INotification";
|
|
5
|
-
import ISavedBlock from "topol-plugin/types/SavedBlock/ISavedBlock";
|
|
6
|
-
global {
|
|
7
|
-
interface Window {
|
|
8
|
-
TopolPlugin: ITopolPlugin;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
const createTopolPlugin: (options: ITopolOptions) => {
|
|
12
|
-
init: () => Promise<boolean | string>;
|
|
13
|
-
save: () => void;
|
|
14
|
-
load: (json: unknown) => void;
|
|
15
|
-
togglePreview: () => void;
|
|
16
|
-
togglePreviewSize: () => void;
|
|
17
|
-
chooseFile: (url: string) => void;
|
|
18
|
-
undo: () => void;
|
|
19
|
-
redo: () => void;
|
|
20
|
-
setSavedBlocks: (savedBlocks: ISavedBlock[]) => void;
|
|
21
|
-
createNotification: (notification: INotification) => void;
|
|
22
|
-
changeEmailToMobile: () => void;
|
|
23
|
-
changeEmailToDesktop: () => void;
|
|
24
|
-
toggleBlocksAndStructuresVisibility: () => void;
|
|
25
|
-
destroy: () => void;
|
|
26
|
-
};
|
|
27
|
-
export default createTopolPlugin;
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
declare module 'topol-plugin/types/API/API' {
|
|
31
|
-
export interface IAPI {
|
|
32
|
-
GET_AUTOSAVE: string;
|
|
33
|
-
AUTOSAVES: string;
|
|
34
|
-
LOAD: string;
|
|
35
|
-
SAVE: string | null;
|
|
36
|
-
AUTOSAVE: string;
|
|
37
|
-
PREVIEW: string;
|
|
38
|
-
FEEDS: string;
|
|
39
|
-
PRODUCTS: string;
|
|
40
|
-
IMAGE_UPLOAD: string;
|
|
41
|
-
FOLDERS: string;
|
|
42
|
-
IMAGE_EDITOR_UPLOAD: string | null;
|
|
43
|
-
TEST_EMAIL: string;
|
|
44
|
-
}
|
|
45
|
-
export interface ILockedAPI {
|
|
46
|
-
GIPHY_API_KEY: string;
|
|
47
|
-
GIPHY_SEARCH: string;
|
|
48
|
-
AUTHORIZE: string;
|
|
49
|
-
GCS_SIGNED_URL: string;
|
|
50
|
-
SAVE_SERVER: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
declare module 'topol-plugin/types/AuthHeaderConfig/IAuthHeaderConfig' {
|
|
55
|
-
export default interface AuthHeaderConfig {
|
|
56
|
-
[key: string]: string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
declare module 'topol-plugin/types/ContentBlock/IContentBlockOptions' {
|
|
61
|
-
export default interface IContentBlockOptions {
|
|
62
|
-
disabled?: boolean;
|
|
63
|
-
disabledText?: string;
|
|
64
|
-
hidden?: boolean;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
declare module 'topol-plugin/types/Font/IFont' {
|
|
69
|
-
export default interface IFont {
|
|
70
|
-
label: string;
|
|
71
|
-
style: string;
|
|
72
|
-
url?: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
declare module 'topol-plugin/types/ITopolOptions' {
|
|
77
|
-
import { IAPI } from "topol-plugin/types/API/API";
|
|
78
|
-
import ISavedBlock from "topol-plugin/types/SavedBlock/ISavedBlock";
|
|
79
|
-
import INotification from "topol-plugin/types/Notification/INotification";
|
|
80
|
-
import IMergeTagGroup from "topol-plugin/types/MergeTag/IMergeTagGroup";
|
|
81
|
-
import IContentBlockOptions from "topol-plugin/types/ContentBlock/IContentBlockOptions";
|
|
82
|
-
import ITheme from "topol-plugin/types/Theme/ITheme";
|
|
83
|
-
import IAuthHeaderConfig from "topol-plugin/types/AuthHeaderConfig/IAuthHeaderConfig";
|
|
84
|
-
import IFont from "topol-plugin/types/Font/IFont";
|
|
85
|
-
export default interface ITopolOptions {
|
|
86
|
-
id: string;
|
|
87
|
-
authorize: {
|
|
88
|
-
apiKey: string;
|
|
89
|
-
userId: string | number;
|
|
90
|
-
};
|
|
91
|
-
templateId?: number;
|
|
92
|
-
title?: string;
|
|
93
|
-
removeTopBar?: boolean;
|
|
94
|
-
topBarOptions?: Array<string>;
|
|
95
|
-
mainMenuAlign?: "left" | "right";
|
|
96
|
-
disableAlerts?: boolean;
|
|
97
|
-
customFileManager?: boolean;
|
|
98
|
-
language?: string;
|
|
99
|
-
light?: boolean;
|
|
100
|
-
theme?: ITheme;
|
|
101
|
-
hideSettingsTab?: boolean;
|
|
102
|
-
imageEditor?: boolean;
|
|
103
|
-
premadeBlocks?: unknown | boolean;
|
|
104
|
-
savedBlocks?: Array<ISavedBlock> | boolean;
|
|
105
|
-
mergeTags?: Array<IMergeTagGroup>;
|
|
106
|
-
enableAutosaves?: boolean;
|
|
107
|
-
htmlMinified?: boolean;
|
|
108
|
-
apiAuthorizationHeader?: IAuthHeaderConfig | string;
|
|
109
|
-
contentBlocks?: IContentBlockOptions[];
|
|
110
|
-
callbacks: {
|
|
111
|
-
onSave?(json: unknown, html: unknown): void;
|
|
112
|
-
onSaveAndClose?(json: unknown, html: unknown): void;
|
|
113
|
-
onTestSend?(email: string, json: unknown, html: unknown): void;
|
|
114
|
-
onOpenFileManager?(): void;
|
|
115
|
-
onLoaded?(): void;
|
|
116
|
-
onBlockSave?(block: ISavedBlock): void;
|
|
117
|
-
onBlockRemove?(blockId: number): void;
|
|
118
|
-
onBlockEdit?(blockId: number): void;
|
|
119
|
-
onInit?(): void;
|
|
120
|
-
onUndoChange?(count: number): void;
|
|
121
|
-
onRedoChange?(count: number): void;
|
|
122
|
-
onPreview?(html: unknown): void;
|
|
123
|
-
onAlert?(notification: INotification): void;
|
|
124
|
-
};
|
|
125
|
-
api?: IAPI;
|
|
126
|
-
mobileFirstEnabled?: boolean;
|
|
127
|
-
fonts?: Array<IFont>;
|
|
128
|
-
tinyConfig?: unknown;
|
|
129
|
-
fontSizes?: Array<number>;
|
|
130
|
-
colors?: Array<string>;
|
|
131
|
-
googleApiKey?: string;
|
|
132
|
-
role?: "manager" | "editor" | "reader";
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
declare module 'topol-plugin/types/ITopolPlugin' {
|
|
137
|
-
import INotification from "topol-plugin/types/Notification/INotification";
|
|
138
|
-
import ISavedBlock from "topol-plugin/types/SavedBlock/ISavedBlock";
|
|
139
|
-
import ITopolOptions from "topol-plugin/types/ITopolOptions";
|
|
140
|
-
export default interface ITopolPlugin {
|
|
141
|
-
init: (topolOptions: ITopolOptions) => void;
|
|
142
|
-
save: () => void;
|
|
143
|
-
load: (json: unknown) => void;
|
|
144
|
-
togglePreview: () => void;
|
|
145
|
-
togglePreviewSize: () => void;
|
|
146
|
-
chooseFile: (url: string) => void;
|
|
147
|
-
undo: () => void;
|
|
148
|
-
redo: () => void;
|
|
149
|
-
setSavedBlocks: (savedBlocks: ISavedBlock[]) => void;
|
|
150
|
-
createNotification: (notification: INotification) => void;
|
|
151
|
-
changeEmailToMobile: () => void;
|
|
152
|
-
changeEmailToDesktop: () => void;
|
|
153
|
-
toggleBlocksAndStructuresVisibility: () => void;
|
|
154
|
-
destroy: () => void;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
declare module 'topol-plugin/types/MergeTag/IMergeTag' {
|
|
159
|
-
export default interface IMergeTag {
|
|
160
|
-
value: string;
|
|
161
|
-
text: string;
|
|
162
|
-
label: string;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
declare module 'topol-plugin/types/MergeTag/IMergeTagGroup' {
|
|
167
|
-
import IMergeTag from "topol-plugin/types/MergeTag/IMergeTag";
|
|
168
|
-
export default interface IMergeTagGroup {
|
|
169
|
-
name: string;
|
|
170
|
-
items: Array<IMergeTag | IMergeTagGroup>;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
declare module 'topol-plugin/types/Notification/INotification' {
|
|
175
|
-
export default interface INotification {
|
|
176
|
-
title: string;
|
|
177
|
-
text: string;
|
|
178
|
-
expectSideEffect?: boolean;
|
|
179
|
-
persistent?: boolean;
|
|
180
|
-
type: "info" | "error" | "success";
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
declare module 'topol-plugin/types/SavedBlock/ISavedBlock' {
|
|
185
|
-
export default interface ISavedBlock {
|
|
186
|
-
id: number;
|
|
187
|
-
name: string;
|
|
188
|
-
definition: Array<Object>;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
declare module 'topol-plugin/types/Theme/ITheme' {
|
|
193
|
-
export default interface ITheme {
|
|
194
|
-
preset: "light" | "dark";
|
|
195
|
-
borderRadius?: {
|
|
196
|
-
small?: string;
|
|
197
|
-
large?: string;
|
|
198
|
-
};
|
|
199
|
-
colors: {
|
|
200
|
-
"900"?: string;
|
|
201
|
-
"800"?: string;
|
|
202
|
-
"700"?: string;
|
|
203
|
-
"600"?: string;
|
|
204
|
-
"500"?: string;
|
|
205
|
-
"450"?: string;
|
|
206
|
-
"400"?: string;
|
|
207
|
-
"350"?: string;
|
|
208
|
-
"300"?: string;
|
|
209
|
-
"200"?: string;
|
|
210
|
-
"150"?: string;
|
|
211
|
-
"100"?: string;
|
|
212
|
-
white?: string;
|
|
213
|
-
primary?: string;
|
|
214
|
-
"primary-light"?: string;
|
|
215
|
-
"primary-dark"?: string;
|
|
216
|
-
secondary?: string;
|
|
217
|
-
"secondary-light"?: string;
|
|
218
|
-
error?: string;
|
|
219
|
-
"error-light"?: string;
|
|
220
|
-
success?: string;
|
|
221
|
-
"success-light"?: string;
|
|
222
|
-
active?: string;
|
|
223
|
-
"active-light"?: string;
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
declare module 'topol-plugin' {
|
|
229
|
-
import main = require('topol-plugin/src/main');
|
|
230
|
-
export = main;
|
|
231
|
-
}
|