@topol.io/editor-vue 0.0.1 → 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
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,15 +1,15 @@
|
|
|
1
1
|
import i from "@topol.io/editor";
|
|
2
2
|
import { default as E } from "@topol.io/editor";
|
|
3
|
-
import { defineComponent as p, onMounted as g, onBeforeUnmount as
|
|
4
|
-
const
|
|
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 a =
|
|
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
13
|
const t = {
|
|
14
14
|
onSave(o, e) {
|
|
15
15
|
n("onSave", { json: o, html: e });
|
|
@@ -59,22 +59,25 @@ const d = "topol-editor-id", u = /* @__PURE__ */ p({
|
|
|
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: "#" +
|
|
67
|
+
return { id: "#" + l, ...a.options, callbacks: { ...t } };
|
|
65
68
|
};
|
|
66
69
|
return g(async () => {
|
|
67
70
|
const t = r();
|
|
68
71
|
await i.init(t, { stage: a.stage });
|
|
69
|
-
}),
|
|
72
|
+
}), C(() => {
|
|
70
73
|
i.destroy();
|
|
71
|
-
}), (t, o) => (
|
|
72
|
-
id:
|
|
74
|
+
}), (t, o) => (m(), v("div", {
|
|
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(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",
|
|
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"})});
|
|
@@ -31,6 +31,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
31
31
|
onAlert: (notification: INotification) => void;
|
|
32
32
|
onBannerClick: (data: ISaveData) => void;
|
|
33
33
|
onEdittedWithoutSaveChanged: (hasUnsavedChanges: boolean) => void;
|
|
34
|
+
onOpenCustomBlockDialog: (blockContent: unknown) => void;
|
|
34
35
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
35
36
|
options: IVueOptions;
|
|
36
37
|
stage?: IStage | undefined;
|
|
@@ -53,6 +54,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
53
54
|
onOnAlert?: ((notification: INotification) => any) | undefined;
|
|
54
55
|
onOnBannerClick?: ((data: ISaveData) => any) | undefined;
|
|
55
56
|
onOnEdittedWithoutSaveChanged?: ((hasUnsavedChanges: boolean) => any) | undefined;
|
|
57
|
+
onOnOpenCustomBlockDialog?: ((blockContent: unknown) => any) | undefined;
|
|
56
58
|
}, {
|
|
57
59
|
stage: IStage;
|
|
58
60
|
}, {}>;
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
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
18
|
"type": "module",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@topol.io/editor": "0.0.
|
|
32
|
+
"@topol.io/editor": "0.0.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"vue": "^3.2.25"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"dev": "vite",
|
|
51
|
-
"build": "vite build &&
|
|
51
|
+
"build": "vite build && pnpm run build:types",
|
|
52
52
|
"preview": "vite preview",
|
|
53
53
|
"build:types": "vue-tsc -p tsconfig.prod.json"
|
|
54
54
|
}
|