@topol.io/editor-vue 0.0.0 → 0.0.2
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 +3 -1
- package/dist/topol-editor-vue.es.js +20 -17
- package/dist/topol-editor-vue.umd.js +1 -1
- package/dist/types/TopolEditor.vue.d.ts +78 -0
- package/dist/types/entry.d.ts +4 -0
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ TopolPlugin.save();
|
|
|
56
56
|
| Action | Description |
|
|
57
57
|
| --- | ----------- |
|
|
58
58
|
| `TopolPlugin.save()` | Saves the content of the editor [more info](https://topol.io/docs#plugin-configuration) |
|
|
59
|
-
| `TopolPlugin.load(template`
|
|
59
|
+
| `TopolPlugin.load(template)` | Loads the provided template [more info](https://topol.io/docs#save-and-load-options) |
|
|
60
60
|
| `TopolPlugin.togglePreview()` | Toggles editor preview [more info](https://topol.io/docs#preview-mode-on-desktop-and-mobile)|
|
|
61
61
|
| `TopolPlugin.togglePreviewSize()` | Toggles editor preview size |
|
|
62
62
|
| `TopolPlugin.undo()` | Undo change in editor [more info](https://topol.io/docs#redo-and-undo)|
|
|
@@ -69,6 +69,7 @@ TopolPlugin.save();
|
|
|
69
69
|
| `TopolPlugin.destroy()` | Destroys the editor initialization [more info](https://topol.io/docs#working-with-js-frameworks) |
|
|
70
70
|
|
|
71
71
|
<br>
|
|
72
|
+
|
|
72
73
|
## Editor Events
|
|
73
74
|
|
|
74
75
|
The callbacks from editor are received as component events.
|
|
@@ -98,6 +99,7 @@ The callbacks from editor are received as component events.
|
|
|
98
99
|
|
|
99
100
|
|
|
100
101
|
<br>
|
|
102
|
+
|
|
101
103
|
## TypeScript
|
|
102
104
|
|
|
103
105
|
Topol Editor provides full TypeScript integration and exports all necessary types.
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i from "@topol.io/editor";
|
|
2
2
|
import { default as E } from "@topol.io/editor";
|
|
3
|
-
import { defineComponent as
|
|
4
|
-
const l = "topol-editor-id",
|
|
3
|
+
import { defineComponent as p, onMounted as g, onBeforeUnmount as C, openBlock as m, createElementBlock as v } from "vue";
|
|
4
|
+
const l = "topol-editor-id", B = /* @__PURE__ */ p({
|
|
5
5
|
__name: "TopolEditor",
|
|
6
6
|
props: {
|
|
7
7
|
options: {},
|
|
8
8
|
stage: { default: "production" }
|
|
9
9
|
},
|
|
10
|
-
emits: ["onSave", "onSaveAndClose", "onTestSend", "onOpenFileManager", "onLoaded", "onBlockSave", "onBlockRemove", "onBlockEdit", "onInit", "onClose", "onUndoChange", "onRedoChange", "onPreview", "onAlert", "onBannerClick", "onEdittedWithoutSaveChanged"],
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
const
|
|
10
|
+
emits: ["onSave", "onSaveAndClose", "onTestSend", "onOpenFileManager", "onLoaded", "onBlockSave", "onBlockRemove", "onBlockEdit", "onInit", "onClose", "onUndoChange", "onRedoChange", "onPreview", "onAlert", "onBannerClick", "onEdittedWithoutSaveChanged", "onOpenCustomBlockDialog"],
|
|
11
|
+
setup(d, { emit: s }) {
|
|
12
|
+
const a = d, n = s, r = () => {
|
|
13
|
+
const t = {
|
|
14
14
|
onSave(o, e) {
|
|
15
15
|
n("onSave", { json: o, html: e });
|
|
16
16
|
},
|
|
17
17
|
onSaveAndClose(o, e) {
|
|
18
18
|
n("onSaveAndClose", { json: o, html: e });
|
|
19
19
|
},
|
|
20
|
-
onTestSend(o, e,
|
|
21
|
-
n("onTestSend", { email: o, json: e, html:
|
|
20
|
+
onTestSend(o, e, c) {
|
|
21
|
+
n("onTestSend", { email: o, json: e, html: c });
|
|
22
22
|
},
|
|
23
23
|
onOpenFileManager() {
|
|
24
24
|
n("onOpenFileManager");
|
|
@@ -59,22 +59,25 @@ const l = "topol-editor-id", u = /* @__PURE__ */ c({
|
|
|
59
59
|
},
|
|
60
60
|
onEdittedWithoutSaveChanged(o) {
|
|
61
61
|
n("onEdittedWithoutSaveChanged", o);
|
|
62
|
+
},
|
|
63
|
+
onOpenCustomBlockDialog(o) {
|
|
64
|
+
n("onOpenCustomBlockDialog", o);
|
|
62
65
|
}
|
|
63
66
|
};
|
|
64
|
-
return { id: "#" + l, ...
|
|
67
|
+
return { id: "#" + l, ...a.options, callbacks: { ...t } };
|
|
65
68
|
};
|
|
66
|
-
return
|
|
67
|
-
const
|
|
68
|
-
await
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
}), (
|
|
69
|
+
return g(async () => {
|
|
70
|
+
const t = r();
|
|
71
|
+
await i.init(t, { stage: a.stage });
|
|
72
|
+
}), C(() => {
|
|
73
|
+
i.destroy();
|
|
74
|
+
}), (t, o) => (m(), v("div", {
|
|
72
75
|
id: l,
|
|
73
76
|
style: { position: "absolute", width: "100%", height: "100vh" }
|
|
74
77
|
}));
|
|
75
78
|
}
|
|
76
79
|
});
|
|
77
80
|
export {
|
|
78
|
-
|
|
81
|
+
B as TopolEditor,
|
|
79
82
|
E as TopolPlugin
|
|
80
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(n,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@topol.io/editor"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@topol.io/editor","vue"],t):(n=typeof globalThis<"u"?globalThis:n||self,t(n["topol-editor-vue"]={},n.TopolPlugin,n.Vue))})(this,function(n,t,d){"use strict";const l="topol-editor-id",c=d.defineComponent({__name:"TopolEditor",props:{options:{},stage:{default:"production"}},emits:["onSave","onSaveAndClose","onTestSend","onOpenFileManager","onLoaded","onBlockSave","onBlockRemove","onBlockEdit","onInit","onClose","onUndoChange","onRedoChange","onPreview","onAlert","onBannerClick","onEdittedWithoutSaveChanged","onOpenCustomBlockDialog"],setup(r,{emit:p}){const s=r,e=p,u=()=>{const a={onSave(o,i){e("onSave",{json:o,html:i})},onSaveAndClose(o,i){e("onSaveAndClose",{json:o,html:i})},onTestSend(o,i,C){e("onTestSend",{email:o,json:i,html:C})},onOpenFileManager(){e("onOpenFileManager")},onLoaded(){e("onLoaded")},onBlockSave(o){e("onBlockSave",o)},onBlockRemove(o){e("onBlockRemove",o)},onBlockEdit(o){e("onBlockEdit",o)},onInit(){e("onInit")},onUndoChange(o){e("onUndoChange",o)},onRedoChange(o){e("onRedoChange",o)},onPreview(o){e("onPreview",o)},onAlert(o){e("onAlert",o)},onClose(){e("onClose")},onBannerClick(o,i){e("onBannerClick",{json:o,html:i})},onEdittedWithoutSaveChanged(o){e("onEdittedWithoutSaveChanged",o)},onOpenCustomBlockDialog(o){e("onOpenCustomBlockDialog",o)}};return{id:"#"+l,...s.options,callbacks:{...a}}};return d.onMounted(async()=>{const a=u();await t.init(a,{stage:s.stage})}),d.onBeforeUnmount(()=>{t.destroy()}),(a,o)=>(d.openBlock(),d.createElementBlock("div",{id:l,style:{position:"absolute",width:"100%",height:"100vh"}}))}});n.TopolPlugin=t,n.TopolEditor=c,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ITopolOptions, INotification, ISavedBlock, IStage } from '@topol.io/editor';
|
|
2
|
+
export type IVueOptions = Omit<ITopolOptions, 'id' | 'callbacks'>;
|
|
3
|
+
export type ISaveData = {
|
|
4
|
+
json: unknown;
|
|
5
|
+
html: unknown;
|
|
6
|
+
};
|
|
7
|
+
export type ISendTestData = {
|
|
8
|
+
email: string;
|
|
9
|
+
json: unknown;
|
|
10
|
+
html: unknown;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
13
|
+
options: IVueOptions;
|
|
14
|
+
stage?: IStage | undefined;
|
|
15
|
+
}>, {
|
|
16
|
+
stage: string;
|
|
17
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
onSave: (data: ISaveData) => void;
|
|
19
|
+
onSaveAndClose: (data: ISaveData) => void;
|
|
20
|
+
onTestSend: (data: ISendTestData) => void;
|
|
21
|
+
onOpenFileManager: () => void;
|
|
22
|
+
onLoaded: () => void;
|
|
23
|
+
onBlockSave: (block: ISavedBlock) => void;
|
|
24
|
+
onBlockRemove: (blockId: number) => void;
|
|
25
|
+
onBlockEdit: (blockId: number) => void;
|
|
26
|
+
onInit: () => void;
|
|
27
|
+
onClose: () => void;
|
|
28
|
+
onUndoChange: (count: number) => void;
|
|
29
|
+
onRedoChange: (count: number) => void;
|
|
30
|
+
onPreview: (html: unknown) => void;
|
|
31
|
+
onAlert: (notification: INotification) => void;
|
|
32
|
+
onBannerClick: (data: ISaveData) => void;
|
|
33
|
+
onEdittedWithoutSaveChanged: (hasUnsavedChanges: boolean) => void;
|
|
34
|
+
onOpenCustomBlockDialog: (blockContent: unknown) => void;
|
|
35
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
36
|
+
options: IVueOptions;
|
|
37
|
+
stage?: IStage | undefined;
|
|
38
|
+
}>, {
|
|
39
|
+
stage: string;
|
|
40
|
+
}>>> & {
|
|
41
|
+
onOnSave?: ((data: ISaveData) => any) | undefined;
|
|
42
|
+
onOnSaveAndClose?: ((data: ISaveData) => any) | undefined;
|
|
43
|
+
onOnTestSend?: ((data: ISendTestData) => any) | undefined;
|
|
44
|
+
onOnOpenFileManager?: (() => any) | undefined;
|
|
45
|
+
onOnLoaded?: (() => any) | undefined;
|
|
46
|
+
onOnBlockSave?: ((block: ISavedBlock) => any) | undefined;
|
|
47
|
+
onOnBlockRemove?: ((blockId: number) => any) | undefined;
|
|
48
|
+
onOnBlockEdit?: ((blockId: number) => any) | undefined;
|
|
49
|
+
onOnInit?: (() => any) | undefined;
|
|
50
|
+
onOnClose?: (() => any) | undefined;
|
|
51
|
+
onOnUndoChange?: ((count: number) => any) | undefined;
|
|
52
|
+
onOnRedoChange?: ((count: number) => any) | undefined;
|
|
53
|
+
onOnPreview?: ((html: unknown) => any) | undefined;
|
|
54
|
+
onOnAlert?: ((notification: INotification) => any) | undefined;
|
|
55
|
+
onOnBannerClick?: ((data: ISaveData) => any) | undefined;
|
|
56
|
+
onOnEdittedWithoutSaveChanged?: ((hasUnsavedChanges: boolean) => any) | undefined;
|
|
57
|
+
onOnOpenCustomBlockDialog?: ((blockContent: unknown) => any) | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
stage: IStage;
|
|
60
|
+
}, {}>;
|
|
61
|
+
export default _default;
|
|
62
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
63
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
64
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
65
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
66
|
+
} : {
|
|
67
|
+
type: import('vue').PropType<T[K]>;
|
|
68
|
+
required: true;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
type __VLS_WithDefaults<P, D> = {
|
|
72
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
73
|
+
default: D[K];
|
|
74
|
+
}> : P[K];
|
|
75
|
+
};
|
|
76
|
+
type __VLS_Prettify<T> = {
|
|
77
|
+
[K in keyof T]: T[K];
|
|
78
|
+
} & {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as TopolPlugin } from '@topol.io/editor';
|
|
2
|
+
export type { INotification, IStage, ISavedBlock } from '@topol.io/editor';
|
|
3
|
+
export { default as TopolEditor } from './TopolEditor.vue';
|
|
4
|
+
export type { ISaveData, ISendTestData, IVueOptions as ITopolOptions } from './TopolEditor.vue';
|
package/package.json
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"author": "Topol.io",
|
|
15
15
|
"homepage": "https://topol.io",
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
|
-
"version": "0.0.
|
|
17
|
+
"version": "0.0.2",
|
|
18
|
+
"type": "module",
|
|
18
19
|
"files": [
|
|
19
20
|
"dist"
|
|
20
21
|
],
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
}
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@topol.io/editor": "0.0.
|
|
32
|
+
"@topol.io/editor": "0.0.2"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
35
|
"vue": "^3.2.25"
|
|
@@ -36,10 +37,10 @@
|
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@babel/types": "^7.23.0",
|
|
38
39
|
"@types/node": "^20.8.4",
|
|
39
|
-
"@vitejs/plugin-vue": "^
|
|
40
|
+
"@vitejs/plugin-vue": "^5.0.3",
|
|
40
41
|
"typescript": "^5.2.2",
|
|
41
|
-
"vite": "^
|
|
42
|
-
"vue": "^3.
|
|
42
|
+
"vite": "^5.0.11",
|
|
43
|
+
"vue": "^3.4.10",
|
|
43
44
|
"vue-tsc": "^1.8.18"
|
|
44
45
|
},
|
|
45
46
|
"publishConfig": {
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
},
|
|
48
49
|
"scripts": {
|
|
49
50
|
"dev": "vite",
|
|
50
|
-
"build": "vite build &&
|
|
51
|
+
"build": "vite build && pnpm run build:types",
|
|
51
52
|
"preview": "vite preview",
|
|
52
53
|
"build:types": "vue-tsc -p tsconfig.prod.json"
|
|
53
54
|
}
|