@topol.io/editor-vue 1.0.0-alpha.9 → 2.0.0-alpha.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 +64 -91
- package/dist/topol-editor-vue.es.js +253 -189
- package/dist/topol-editor-vue.umd.cjs +1 -0
- package/dist/types/EmailEditor.vue.d.ts +137 -7
- package/dist/types/LandingPageEditor.vue.d.ts +2 -2
- package/dist/types/TopolEditor.vue.d.ts +3 -16
- package/dist/types/entry.d.ts +7 -6
- package/dist/types/types.d.ts +5 -5
- package/package.json +8 -4
- package/dist/topol-editor-vue.umd.js +0 -1
package/README.md
CHANGED
|
@@ -1,107 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
<svg width="391" height="100" viewBox="0 0 391 100" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M198.658 24.5069C194.15 21.9659 188.894 20.6954 182.903 20.6954C176.911 20.6954 171.655 21.9659 167.103 24.5069C162.561 27.0478 159.024 30.5918 156.525 35.161C154.003 39.7192 152.765 45.024 152.765 51.0755C152.765 57.1269 154.014 62.376 156.558 66.9341C159.08 71.5034 162.617 75.0474 167.136 77.5883C171.678 80.1293 176.922 81.3998 182.914 81.3998C188.906 81.3998 194.116 80.1293 198.635 77.5883C203.177 75.0474 206.703 71.5034 209.224 66.9341C211.746 62.376 213.018 57.0824 213.018 51.0755C213.018 45.0685 211.746 39.7192 209.224 35.161C206.703 30.5918 203.177 27.0478 198.658 24.5069ZM198.011 60.604C196.593 63.3233 194.585 65.4296 192.008 66.9119C189.43 68.4052 186.395 69.1519 182.914 69.1519C179.432 69.1519 176.386 68.4052 173.798 66.9119C171.209 65.4296 169.2 63.3233 167.772 60.604C166.344 57.8848 165.641 54.7086 165.641 51.0755C165.641 47.4423 166.344 44.2216 167.772 41.5134C169.2 38.8165 171.198 36.699 173.775 35.2056C176.353 33.7011 179.399 32.9433 182.914 32.9433C186.428 32.9433 189.43 33.7011 192.008 35.2056C194.585 36.699 196.593 38.8165 198.011 41.5134C199.439 44.2216 200.153 47.3978 200.153 51.0755C200.153 54.7532 199.439 57.8959 198.011 60.604ZM332.387 24.5069C327.879 21.9659 322.635 20.6954 316.643 20.6954C310.651 20.6954 305.384 21.9659 300.843 24.5069C296.291 27.0478 292.753 30.5918 290.254 35.161C287.744 39.7192 286.494 45.024 286.494 51.0755C286.494 57.1269 287.755 62.376 290.288 66.9341C292.809 71.5034 296.335 75.0474 300.876 77.5883C305.407 80.1293 310.651 81.3998 316.654 81.3998C322.657 81.3998 327.834 80.1293 332.376 77.5883C336.906 75.0474 340.432 71.5034 342.953 66.9341C345.475 62.376 346.747 57.0824 346.747 51.0755C346.747 45.0685 345.475 39.7192 342.953 35.161C340.432 30.5918 336.906 27.0478 332.387 24.5069ZM331.751 60.604C330.323 63.3233 328.325 65.4296 325.748 66.9119C323.159 68.4052 320.124 69.1519 316.654 69.1519C313.184 69.1519 310.126 68.4052 307.527 66.9119C304.938 65.4296 302.93 63.3233 301.501 60.604C300.084 57.8848 299.37 54.7086 299.37 51.0755C299.37 47.4423 300.084 44.2216 301.501 41.5134C302.93 38.8165 304.927 36.699 307.504 35.2056C310.082 33.7011 313.139 32.9433 316.654 32.9433C320.169 32.9433 323.159 33.7011 325.748 35.2056C328.325 36.699 330.323 38.8165 331.751 41.5134C333.168 44.2216 333.882 47.3978 333.882 51.0755C333.882 54.7532 333.168 57.8959 331.751 60.604ZM267.971 24.44C263.798 21.9436 258.889 20.6954 253.276 20.6954C248.043 20.6954 243.591 21.8656 239.942 24.1837C236.963 26.0782 234.575 28.7195 232.768 32.0517V21.8767H219.3V100H232.768V69.464C234.575 72.7962 236.952 75.4263 239.942 77.3208C243.591 79.6612 248.043 80.8091 253.276 80.8091C258.889 80.8091 263.798 79.5609 267.971 77.0311C272.156 74.5236 275.414 71.0019 277.757 66.4772C280.1 61.9637 281.283 56.7034 281.283 50.7188C281.283 44.7342 280.1 39.474 277.757 34.9604C275.414 30.4358 272.145 26.9252 267.971 24.44ZM266.186 60.1137C264.736 62.7995 262.694 64.8724 260.072 66.3435C257.449 67.8257 254.359 68.5612 250.81 68.5612C247.262 68.5612 244.171 67.8257 241.549 66.3435C238.916 64.8724 236.874 62.7995 235.435 60.1137C233.984 57.439 233.248 54.3185 233.248 50.7411C233.248 47.1637 233.973 43.9987 235.435 41.3351C236.874 38.6827 238.916 36.6098 241.549 35.1499C244.171 33.6788 247.262 32.9544 250.81 32.9544C254.359 32.9544 257.483 33.69 260.094 35.1499C262.705 36.6098 264.724 38.6827 266.186 41.3574C267.626 44.0321 268.362 47.1526 268.362 50.7411C268.362 54.3297 267.637 57.4501 266.186 60.1137ZM391 66.7781V80.2407H366.408V66.7781H391ZM366.397 0V66.7781H352.918V0H366.397ZM127.38 21.7096H149.607V35.1722H127.38V66.7893H113.79V0H127.38V21.7096ZM127.38 66.7781H147.152V80.2407H127.38V66.7781ZM80.3379 66.8004V80.263H60.2534V66.8004H80.3379ZM0 66.8004H20.0845V80.263H0V66.8004ZM0.0223161 50.1727V30.1126H20.0845V50.1727H0.0223161ZM60.2534 50.1727V30.1126H20.0845V13.4849H60.2534V30.1126H80.3044V50.1727H60.2534ZM20.0845 50.1727H60.2534V66.8004H20.0845V50.1727ZM0 13.4738V0.0222891H20.0845V13.4849L0 13.4738ZM80.3379 13.4738H60.2534V0.0222891H80.3379V13.4738Z" fill="black"/></svg>
|
|
3
|
-
</a>
|
|
1
|
+
# @topol.io/editor-vue — v2 alpha
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
Vue 3 wrapper for Email Editor v4. Local version: `2.0.0-alpha.0` (unpublished).
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
yarn add @topol.io/editor-vue
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Use in Component
|
|
24
|
-
|
|
25
|
-
In your Vue component import and add the simplest options.
|
|
26
|
-
|
|
27
|
-
For more options see the docs for [TopolOptions configuration](https://docs.topol.io/reference/topol-options.html)
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
import { TopolEditor } from '@topol.io/editor-vue';
|
|
31
|
-
|
|
32
|
-
const customOptions = {
|
|
33
|
-
authorize: {
|
|
34
|
-
apiKey: 'YOUR_API_TOKEN',
|
|
35
|
-
userId: 'some-user-id',
|
|
5
|
+
```vue
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
import { EmailEditor, type IEmailCallbacks, type IVueEmailOptions } from "@topol.io/editor-vue";
|
|
8
|
+
const options: IVueEmailOptions = {
|
|
9
|
+
authorize: { apiKey: "pk_your-key", userId: "user-123" },
|
|
10
|
+
cloud: { enabled: true },
|
|
11
|
+
};
|
|
12
|
+
const callbacks: IEmailCallbacks = {
|
|
13
|
+
async getNonce() {
|
|
14
|
+
const response = await fetch("/api/topol/nonce", { method: "POST" });
|
|
15
|
+
if (!response.ok) throw new Error("Cloud authorization failed");
|
|
16
|
+
return (await response.json()).nonce;
|
|
36
17
|
},
|
|
37
18
|
};
|
|
19
|
+
</script>
|
|
20
|
+
<template>
|
|
21
|
+
<EmailEditor
|
|
22
|
+
:options="options"
|
|
23
|
+
:callbacks="callbacks"
|
|
24
|
+
@on-cloud-save="({ templateId }) => console.log(templateId)"
|
|
25
|
+
@on-editor-error="({ source, message }) => console.error(source, message)"
|
|
26
|
+
/>
|
|
27
|
+
</template>
|
|
38
28
|
```
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
Use the **`callbacks` prop for `getNonce` and asynchronous persistence**:
|
|
31
|
+
`callbacks.onSave = async ({ json, html }) => { await persist(json, html); }`.
|
|
32
|
+
Vue event handlers do not return promises to the editor. Events remain available
|
|
33
|
+
for notifications, with the exact core object payloads. If both a callback and an
|
|
34
|
+
event listener are provided, the callback runs first and its result is returned.
|
|
45
35
|
|
|
46
|
-
|
|
36
|
+
`@ready="editor => ..."` receives the instance. A component template ref exposes
|
|
37
|
+
`getEditor()`. `@on-save-and-close` is registered only when explicitly supplied;
|
|
38
|
+
without it or `callbacks.onSaveAndClose`, the runtime's default save-and-close works.
|
|
39
|
+
`getNonce` is a function callback only, never an event.
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
`LandingPageEditor` and `CoreLandingPageEditor` retain their existing APIs.
|
|
42
|
+
`CoreEmailEditor` exposes the core v4 factory.
|
|
50
43
|
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
`options` contains the v4 configuration (`IEmailConfig`). A `getNonce` callback that
|
|
45
|
+
fetches a fresh `nc_` token from your application's authenticated backend enables
|
|
46
|
+
nonce authentication on its own; Cloud additionally requires it. Never put an `sk_`
|
|
47
|
+
secret in browser code. See the core package README for nonce authentication, Cloud
|
|
48
|
+
feature options and all v4 renames.
|
|
53
49
|
|
|
54
|
-
|
|
50
|
+
Configuration and the presence of callback handlers are captured on mount. Remount
|
|
51
|
+
with a new key to change them; existing callback functions read their latest values.
|
|
52
|
+
`ready` means the iframe has rendered; `onInit` reports editor authentication.
|
|
53
|
+
Set the container's height. Each component owns its own instance and destroys it
|
|
54
|
+
on unmount, including when initialization is still pending.
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
Use `loaderUrl` for an explicit v4 local/preview loader. A numeric `stage` selects
|
|
57
|
+
a PR preview. `TopolEditor` is a deprecated naming alias using the new v4 contract.
|
|
57
58
|
|
|
58
|
-
##
|
|
59
|
+
## Running the example against deployed Cloud
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
Merge `.env.example` into `example/.env.local` (Vite's development root). Set
|
|
62
|
+
`VITE_TOPOL_CLOUD_PUBLIC_KEY` and `VITE_TOPOL_CLOUD_SECRET_KEY` to a matching `pk_` / `sk_`
|
|
63
|
+
credential pair registered in the deployed backend, then start or restart Vite:
|
|
61
64
|
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
:options="customOptions"
|
|
65
|
-
@onSave="handleOnSave"
|
|
66
|
-
></TopolEditor>
|
|
65
|
+
```sh
|
|
66
|
+
pnpm --filter @topol.io/editor-vue dev
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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) |
|
|
92
|
-
|
|
93
|
-
<br>
|
|
94
|
-
|
|
95
|
-
## TypeScript
|
|
96
|
-
|
|
97
|
-
Topol Editor provides full TypeScript integration and exports all necessary types.
|
|
98
|
-
|
|
99
|
-
```vue
|
|
100
|
-
<script setup lang="ts">
|
|
101
|
-
import {
|
|
102
|
-
ITopolOptions,
|
|
103
|
-
INotification,
|
|
104
|
-
ISavedBlock,
|
|
105
|
-
} from '@topol.io/editor-vue';
|
|
106
|
-
</script>
|
|
107
|
-
```
|
|
69
|
+
The example uses the production v4 loader at
|
|
70
|
+
`https://v4.email-assets.topol.io/loader/build.js` and defaults to user `42`
|
|
71
|
+
(override with `VITE_TOPOL_CLOUD_USER_ID`). Its `callbacks.getNonce` calls
|
|
72
|
+
`POST https://9wh997i15a.execute-api.eu-central-1.amazonaws.com/auth/nonce`
|
|
73
|
+
directly from the browser. This testing-only example exposes the secret in the
|
|
74
|
+
frontend; use test credentials and do not deploy it. No local nonce endpoint or
|
|
75
|
+
Cloud backend is needed; a made-up nonce or the
|
|
76
|
+
local seed credentials cannot substitute for credentials registered in that backend.
|
|
77
|
+
|
|
78
|
+
The editor loader must use the same backend as `VITE_TOPOL_CLOUD_API_URL`.
|
|
79
|
+
`VITE_TOPOL_API_KEY` remains the landing-page example's key. Deployed
|
|
80
|
+
integrations need an authenticated backend that derives the user from the session.
|
|
@@ -1,119 +1,224 @@
|
|
|
1
|
-
import { EmailEditor as
|
|
2
|
-
import { EmailEditor as
|
|
3
|
-
import { defineComponent as
|
|
4
|
-
const
|
|
1
|
+
import { EmailEditor as A, LandingPageEditor as P } from "@topol.io/editor";
|
|
2
|
+
import { EmailEditor as O, LandingPageEditor as _, default as M } from "@topol.io/editor";
|
|
3
|
+
import { defineComponent as p, getCurrentInstance as h, ref as k, onMounted as b, onBeforeUnmount as f, createElementBlock as L, openBlock as T } from "vue";
|
|
4
|
+
const B = /* @__PURE__ */ p({
|
|
5
5
|
__name: "EmailEditor",
|
|
6
6
|
props: {
|
|
7
7
|
options: {},
|
|
8
|
-
|
|
8
|
+
callbacks: {},
|
|
9
|
+
stage: { default: "production" },
|
|
10
|
+
loaderUrl: {}
|
|
9
11
|
},
|
|
10
|
-
emits: ["onSave", "onSaveAndClose", "onTestSend", "onOpenFileManager", "onLoaded", "
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
12
|
+
emits: ["ready", "onSave", "onSaveAndClose", "onTestSend", "onBannerClick", "onOpenFileManager", "onLoaded", "onSavedSectionSave", "onSavedSectionRemove", "onSavedSectionEdit", "onImageDelete", "onInit", "onUndoChange", "onRedoChange", "onPreview", "onPreviewClose", "onAlert", "onEditorClose", "onEdittedWithoutSaveChanged", "onBlocksAndStructuresVisibilityChange", "onOpenCustomBlockDialog", "onTemplateRename", "onTemplateUpdated", "updateTestingEmailAddresses", "onEditorError", "onLanguageCreated", "onLanguageDeleted", "onLanguageSelected", "onPrimaryLanguageChanged", "onGetMutations", "onCloudSave", "onCloudTemplateChange"],
|
|
13
|
+
setup(C, { expose: m, emit: S }) {
|
|
14
|
+
const a = C, r = S, v = h(), c = k();
|
|
15
|
+
let d, u = !1;
|
|
16
|
+
m({ getEditor: () => d ?? null });
|
|
17
|
+
const i = (s) => {
|
|
18
|
+
var n, o, e;
|
|
19
|
+
const l = `on${s[0].toUpperCase()}${s.slice(1)}`;
|
|
20
|
+
return !!((n = a.callbacks) != null && n[s]) || !!((o = v.vnode.props) != null && o[l]) || !!((e = v.vnode.props) != null && e[`${l}Once`]);
|
|
21
|
+
}, g = (s) => {
|
|
22
|
+
var n, o;
|
|
23
|
+
if (u) return;
|
|
24
|
+
const l = { source: "integration", message: s instanceof Error ? s.message : String(s), detail: s };
|
|
25
|
+
i("onEditorError") || console.error("[@topol.io/editor-vue] EmailEditor failed:", s), (o = (n = a.callbacks) == null ? void 0 : n.onEditorError) == null || o.call(n, l), r("onEditorError", l);
|
|
26
|
+
};
|
|
27
|
+
return b(async () => {
|
|
28
|
+
var l;
|
|
29
|
+
const s = {
|
|
30
|
+
onSave: i("onSave") ? (n) => {
|
|
31
|
+
var e, t;
|
|
32
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onSave) == null ? void 0 : t.call(e, n);
|
|
33
|
+
return r("onSave", n), o;
|
|
34
|
+
} : void 0,
|
|
35
|
+
onSaveAndClose: i("onSaveAndClose") ? (n) => {
|
|
36
|
+
var e, t;
|
|
37
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onSaveAndClose) == null ? void 0 : t.call(e, n);
|
|
38
|
+
return r("onSaveAndClose", n), o;
|
|
39
|
+
} : void 0,
|
|
40
|
+
onTestSend: i("onTestSend") ? (n) => {
|
|
41
|
+
var e, t;
|
|
42
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onTestSend) == null ? void 0 : t.call(e, n);
|
|
43
|
+
return r("onTestSend", n), o;
|
|
44
|
+
} : void 0,
|
|
45
|
+
onBannerClick: i("onBannerClick") ? (n) => {
|
|
46
|
+
var e, t;
|
|
47
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onBannerClick) == null ? void 0 : t.call(e, n);
|
|
48
|
+
return r("onBannerClick", n), o;
|
|
49
|
+
} : void 0,
|
|
50
|
+
onOpenFileManager: i("onOpenFileManager") ? () => {
|
|
51
|
+
var o, e;
|
|
52
|
+
const n = (e = (o = a.callbacks) == null ? void 0 : o.onOpenFileManager) == null ? void 0 : e.call(o);
|
|
53
|
+
return r("onOpenFileManager"), n;
|
|
54
|
+
} : void 0,
|
|
55
|
+
onLoaded: i("onLoaded") ? () => {
|
|
56
|
+
var o, e;
|
|
57
|
+
const n = (e = (o = a.callbacks) == null ? void 0 : o.onLoaded) == null ? void 0 : e.call(o);
|
|
58
|
+
return r("onLoaded"), n;
|
|
59
|
+
} : void 0,
|
|
60
|
+
onSavedSectionSave: i("onSavedSectionSave") ? (n) => {
|
|
61
|
+
var e, t;
|
|
62
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onSavedSectionSave) == null ? void 0 : t.call(e, n);
|
|
63
|
+
return r("onSavedSectionSave", n), o;
|
|
64
|
+
} : void 0,
|
|
65
|
+
onSavedSectionRemove: i("onSavedSectionRemove") ? (n) => {
|
|
66
|
+
var e, t;
|
|
67
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onSavedSectionRemove) == null ? void 0 : t.call(e, n);
|
|
68
|
+
return r("onSavedSectionRemove", n), o;
|
|
69
|
+
} : void 0,
|
|
70
|
+
onSavedSectionEdit: i("onSavedSectionEdit") ? (n) => {
|
|
71
|
+
var e, t;
|
|
72
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onSavedSectionEdit) == null ? void 0 : t.call(e, n);
|
|
73
|
+
return r("onSavedSectionEdit", n), o;
|
|
74
|
+
} : void 0,
|
|
75
|
+
onImageDelete: i("onImageDelete") ? (n) => {
|
|
76
|
+
var e, t;
|
|
77
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onImageDelete) == null ? void 0 : t.call(e, n);
|
|
78
|
+
return r("onImageDelete", n), o;
|
|
79
|
+
} : void 0,
|
|
80
|
+
onInit: i("onInit") ? () => {
|
|
81
|
+
var o, e;
|
|
82
|
+
const n = (e = (o = a.callbacks) == null ? void 0 : o.onInit) == null ? void 0 : e.call(o);
|
|
83
|
+
return r("onInit"), n;
|
|
84
|
+
} : void 0,
|
|
85
|
+
onUndoChange: i("onUndoChange") ? (n) => {
|
|
86
|
+
var e, t;
|
|
87
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onUndoChange) == null ? void 0 : t.call(e, n);
|
|
88
|
+
return r("onUndoChange", n), o;
|
|
89
|
+
} : void 0,
|
|
90
|
+
onRedoChange: i("onRedoChange") ? (n) => {
|
|
91
|
+
var e, t;
|
|
92
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onRedoChange) == null ? void 0 : t.call(e, n);
|
|
93
|
+
return r("onRedoChange", n), o;
|
|
94
|
+
} : void 0,
|
|
95
|
+
onPreview: i("onPreview") ? (n) => {
|
|
96
|
+
var e, t;
|
|
97
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onPreview) == null ? void 0 : t.call(e, n);
|
|
98
|
+
return r("onPreview", n), o;
|
|
99
|
+
} : void 0,
|
|
100
|
+
onPreviewClose: i("onPreviewClose") ? () => {
|
|
101
|
+
var o, e;
|
|
102
|
+
const n = (e = (o = a.callbacks) == null ? void 0 : o.onPreviewClose) == null ? void 0 : e.call(o);
|
|
103
|
+
return r("onPreviewClose"), n;
|
|
104
|
+
} : void 0,
|
|
105
|
+
onAlert: i("onAlert") ? (n) => {
|
|
106
|
+
var e, t;
|
|
107
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onAlert) == null ? void 0 : t.call(e, n);
|
|
108
|
+
return r("onAlert", n), o;
|
|
109
|
+
} : void 0,
|
|
110
|
+
onEditorClose: i("onEditorClose") ? () => {
|
|
111
|
+
var o, e;
|
|
112
|
+
const n = (e = (o = a.callbacks) == null ? void 0 : o.onEditorClose) == null ? void 0 : e.call(o);
|
|
113
|
+
return r("onEditorClose"), n;
|
|
114
|
+
} : void 0,
|
|
115
|
+
onEdittedWithoutSaveChanged: i("onEdittedWithoutSaveChanged") ? (n) => {
|
|
116
|
+
var e, t;
|
|
117
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onEdittedWithoutSaveChanged) == null ? void 0 : t.call(e, n);
|
|
118
|
+
return r("onEdittedWithoutSaveChanged", n), o;
|
|
119
|
+
} : void 0,
|
|
120
|
+
onBlocksAndStructuresVisibilityChange: i("onBlocksAndStructuresVisibilityChange") ? (n) => {
|
|
121
|
+
var e, t;
|
|
122
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onBlocksAndStructuresVisibilityChange) == null ? void 0 : t.call(e, n);
|
|
123
|
+
return r("onBlocksAndStructuresVisibilityChange", n), o;
|
|
124
|
+
} : void 0,
|
|
125
|
+
onOpenCustomBlockDialog: i("onOpenCustomBlockDialog") ? (n) => {
|
|
126
|
+
var e, t;
|
|
127
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onOpenCustomBlockDialog) == null ? void 0 : t.call(e, n);
|
|
128
|
+
return r("onOpenCustomBlockDialog", n), o;
|
|
129
|
+
} : void 0,
|
|
130
|
+
onTemplateRename: i("onTemplateRename") ? (n) => {
|
|
131
|
+
var e, t;
|
|
132
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onTemplateRename) == null ? void 0 : t.call(e, n);
|
|
133
|
+
return r("onTemplateRename", n), o;
|
|
134
|
+
} : void 0,
|
|
135
|
+
onTemplateUpdated: i("onTemplateUpdated") ? () => {
|
|
136
|
+
var o, e;
|
|
137
|
+
const n = (e = (o = a.callbacks) == null ? void 0 : o.onTemplateUpdated) == null ? void 0 : e.call(o);
|
|
138
|
+
return r("onTemplateUpdated"), n;
|
|
139
|
+
} : void 0,
|
|
140
|
+
updateTestingEmailAddresses: i("updateTestingEmailAddresses") ? (n) => {
|
|
141
|
+
var e, t;
|
|
142
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.updateTestingEmailAddresses) == null ? void 0 : t.call(e, n);
|
|
143
|
+
return r("updateTestingEmailAddresses", n), o;
|
|
144
|
+
} : void 0,
|
|
145
|
+
onEditorError: i("onEditorError") ? (n) => {
|
|
146
|
+
var e, t;
|
|
147
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onEditorError) == null ? void 0 : t.call(e, n);
|
|
148
|
+
return r("onEditorError", n), o;
|
|
149
|
+
} : void 0,
|
|
150
|
+
onLanguageCreated: i("onLanguageCreated") ? (n) => {
|
|
151
|
+
var e, t;
|
|
152
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onLanguageCreated) == null ? void 0 : t.call(e, n);
|
|
153
|
+
return r("onLanguageCreated", n), o;
|
|
154
|
+
} : void 0,
|
|
155
|
+
onLanguageDeleted: i("onLanguageDeleted") ? (n) => {
|
|
156
|
+
var e, t;
|
|
157
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onLanguageDeleted) == null ? void 0 : t.call(e, n);
|
|
158
|
+
return r("onLanguageDeleted", n), o;
|
|
159
|
+
} : void 0,
|
|
160
|
+
onLanguageSelected: i("onLanguageSelected") ? (n) => {
|
|
161
|
+
var e, t;
|
|
162
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onLanguageSelected) == null ? void 0 : t.call(e, n);
|
|
163
|
+
return r("onLanguageSelected", n), o;
|
|
164
|
+
} : void 0,
|
|
165
|
+
onPrimaryLanguageChanged: i("onPrimaryLanguageChanged") ? (n) => {
|
|
166
|
+
var e, t;
|
|
167
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onPrimaryLanguageChanged) == null ? void 0 : t.call(e, n);
|
|
168
|
+
return r("onPrimaryLanguageChanged", n), o;
|
|
169
|
+
} : void 0,
|
|
170
|
+
onGetMutations: i("onGetMutations") ? (n) => {
|
|
171
|
+
var e, t;
|
|
172
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onGetMutations) == null ? void 0 : t.call(e, n);
|
|
173
|
+
return r("onGetMutations", n), o;
|
|
174
|
+
} : void 0,
|
|
175
|
+
getNonce: (l = a.callbacks) != null && l.getNonce ? () => a.callbacks.getNonce() : void 0,
|
|
176
|
+
onCloudSave: i("onCloudSave") ? (n) => {
|
|
177
|
+
var e, t;
|
|
178
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onCloudSave) == null ? void 0 : t.call(e, n);
|
|
179
|
+
return r("onCloudSave", n), o;
|
|
180
|
+
} : void 0,
|
|
181
|
+
onCloudTemplateChange: i("onCloudTemplateChange") ? (n) => {
|
|
182
|
+
var e, t;
|
|
183
|
+
const o = (t = (e = a.callbacks) == null ? void 0 : e.onCloudTemplateChange) == null ? void 0 : t.call(e, n);
|
|
184
|
+
return r("onCloudTemplateChange", n), o;
|
|
185
|
+
} : void 0
|
|
186
|
+
};
|
|
90
187
|
try {
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
188
|
+
const n = await A.init({ config: a.options, ...s }, { stage: a.stage, loaderUrl: a.loaderUrl });
|
|
189
|
+
if (u) {
|
|
190
|
+
await n.destroy();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
d = n;
|
|
194
|
+
try {
|
|
195
|
+
await n.render(c.value);
|
|
196
|
+
} catch (o) {
|
|
197
|
+
throw await n.destroy(), d = void 0, o;
|
|
198
|
+
}
|
|
199
|
+
u || r("ready", n);
|
|
200
|
+
} catch (n) {
|
|
201
|
+
g(n);
|
|
100
202
|
}
|
|
101
|
-
}),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
203
|
+
}), f(() => {
|
|
204
|
+
u = !0;
|
|
205
|
+
const s = d;
|
|
206
|
+
d = void 0, s == null || s.destroy().catch((l) => console.warn("[@topol.io/editor-vue] EmailEditor cleanup failed:", l));
|
|
207
|
+
}), (s, l) => (T(), L("div", {
|
|
208
|
+
ref_key: "container",
|
|
209
|
+
ref: c,
|
|
210
|
+
style: { width: "100%", height: "100vh" }
|
|
211
|
+
}, null, 512));
|
|
107
212
|
}
|
|
108
|
-
}),
|
|
213
|
+
}), E = "topol-landing-page-editor-id", R = /* @__PURE__ */ p({
|
|
109
214
|
__name: "LandingPageEditor",
|
|
110
215
|
props: {
|
|
111
216
|
options: {},
|
|
112
217
|
stage: { default: "production" }
|
|
113
218
|
},
|
|
114
219
|
emits: ["onSave", "onSaveAndClose", "onOpenFileManager", "onImageDelete", "onLoaded", "onInit", "onUndoChange", "onRedoChange", "onPreview", "onPreviewClose", "onAlert", "onEditorClose", "onEdittedWithoutSaveChanged", "onOpenCustomBlockDialog", "onTemplateRename", "onEditorError"],
|
|
115
|
-
setup(
|
|
116
|
-
const
|
|
220
|
+
setup(C, { expose: m, emit: S }) {
|
|
221
|
+
const a = C, r = S, v = [
|
|
117
222
|
"onSave",
|
|
118
223
|
"onSaveAndClose",
|
|
119
224
|
"onOpenFileManager",
|
|
@@ -130,107 +235,66 @@ const O = "topol-email-editor-id", y = /* @__PURE__ */ m({
|
|
|
130
235
|
"onOpenCustomBlockDialog",
|
|
131
236
|
"onTemplateRename",
|
|
132
237
|
"onEditorError"
|
|
133
|
-
],
|
|
134
|
-
const
|
|
135
|
-
if (!
|
|
136
|
-
const
|
|
137
|
-
return typeof
|
|
138
|
-
},
|
|
139
|
-
const
|
|
140
|
-
for (const
|
|
141
|
-
u(
|
|
142
|
-
|
|
238
|
+
], c = k(null), d = h(), u = (o) => {
|
|
239
|
+
const e = d == null ? void 0 : d.vnode.props;
|
|
240
|
+
if (!e) return !1;
|
|
241
|
+
const t = "on" + o.charAt(0).toUpperCase() + o.slice(1);
|
|
242
|
+
return typeof e[t] == "function" || Array.isArray(e[t]);
|
|
243
|
+
}, i = () => {
|
|
244
|
+
const o = {};
|
|
245
|
+
for (const e of v)
|
|
246
|
+
u(e) && (o[e] = (t) => {
|
|
247
|
+
t === void 0 ? r(e) : r(e, t);
|
|
143
248
|
});
|
|
144
|
-
return
|
|
249
|
+
return o;
|
|
145
250
|
};
|
|
146
|
-
let
|
|
147
|
-
async function
|
|
148
|
-
var
|
|
149
|
-
if (
|
|
251
|
+
let g = !1;
|
|
252
|
+
async function s(o) {
|
|
253
|
+
var e;
|
|
254
|
+
if (o)
|
|
150
255
|
try {
|
|
151
|
-
await ((
|
|
152
|
-
} catch (
|
|
153
|
-
console.warn("[@topol.io/editor-vue] LandingPageEditor destroy failed:",
|
|
256
|
+
await ((e = o.destroy) == null ? void 0 : e.call(o));
|
|
257
|
+
} catch (t) {
|
|
258
|
+
console.warn("[@topol.io/editor-vue] LandingPageEditor destroy failed:", t);
|
|
154
259
|
}
|
|
155
260
|
}
|
|
156
|
-
return
|
|
261
|
+
return b(async () => {
|
|
157
262
|
try {
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
-
await
|
|
263
|
+
const o = await P.init({ config: a.options, ...i() }, { stage: a.stage });
|
|
264
|
+
if (g) {
|
|
265
|
+
await s(o);
|
|
161
266
|
return;
|
|
162
267
|
}
|
|
163
|
-
|
|
164
|
-
} catch (
|
|
165
|
-
if (
|
|
166
|
-
const
|
|
167
|
-
|
|
268
|
+
c.value = o, await o.render("#" + E);
|
|
269
|
+
} catch (o) {
|
|
270
|
+
if (g) return;
|
|
271
|
+
const e = o instanceof Error ? o.message : "Failed to initialize editor";
|
|
272
|
+
r("onEditorError", { source: "init", message: e, detail: o }), console.error("[@topol.io/editor-vue] LandingPageEditor initialization failed:", o);
|
|
168
273
|
}
|
|
169
|
-
}),
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
}),
|
|
174
|
-
load: (
|
|
175
|
-
var
|
|
176
|
-
(
|
|
274
|
+
}), f(() => {
|
|
275
|
+
g = !0;
|
|
276
|
+
const o = c.value;
|
|
277
|
+
c.value = null, s(o);
|
|
278
|
+
}), m({
|
|
279
|
+
load: (o) => {
|
|
280
|
+
var e;
|
|
281
|
+
(e = c.value) == null || e.load(o);
|
|
177
282
|
},
|
|
178
283
|
save: () => {
|
|
179
|
-
var
|
|
180
|
-
(
|
|
284
|
+
var o;
|
|
285
|
+
(o = c.value) == null || o.save();
|
|
181
286
|
}
|
|
182
|
-
}), (
|
|
183
|
-
id:
|
|
287
|
+
}), (o, e) => (T(), L("div", {
|
|
288
|
+
id: E,
|
|
184
289
|
style: { position: "absolute", width: "100%", height: "100vh" }
|
|
185
290
|
}));
|
|
186
291
|
}
|
|
187
|
-
}), U = /* @__PURE__ */ m({
|
|
188
|
-
__name: "TopolEditor",
|
|
189
|
-
props: {
|
|
190
|
-
options: {},
|
|
191
|
-
stage: { default: "production" }
|
|
192
|
-
},
|
|
193
|
-
emits: ["onSave", "onSaveAndClose", "onTestSend", "onOpenFileManager", "onLoaded", "onBlockSave", "onBlockRemove", "onBlockEdit", "onInit", "onClose", "onUndoChange", "onRedoChange", "onPreview", "onAlert", "onBannerClick", "onEdittedWithoutSaveChanged", "onOpenCustomBlockDialog", "onTemplateRename", "updateTestingEmailAddresses", "onError", "onLanguageCreated", "onLanguageDeleted", "onLanguageSelected", "onPrimaryLanguageChanged", "onGetMutations"],
|
|
194
|
-
setup(l, { emit: g }) {
|
|
195
|
-
const r = l, e = g;
|
|
196
|
-
return C(() => {
|
|
197
|
-
console.warn("[@topol.io/editor-vue] TopolEditor is deprecated and will be removed in a future version. Please use EmailEditor instead.");
|
|
198
|
-
}), (s, o) => (v(), R(y, {
|
|
199
|
-
options: r.options,
|
|
200
|
-
stage: r.stage,
|
|
201
|
-
onOnSave: o[0] || (o[0] = (n) => e("onSave", n)),
|
|
202
|
-
onOnSaveAndClose: o[1] || (o[1] = (n) => e("onSaveAndClose", n)),
|
|
203
|
-
onOnTestSend: o[2] || (o[2] = (n) => e("onTestSend", n)),
|
|
204
|
-
onOnOpenFileManager: o[3] || (o[3] = () => e("onOpenFileManager")),
|
|
205
|
-
onOnLoaded: o[4] || (o[4] = () => e("onLoaded")),
|
|
206
|
-
onOnBlockSave: o[5] || (o[5] = (n) => e("onBlockSave", n)),
|
|
207
|
-
onOnBlockRemove: o[6] || (o[6] = (n) => e("onBlockRemove", n)),
|
|
208
|
-
onOnBlockEdit: o[7] || (o[7] = (n) => e("onBlockEdit", n)),
|
|
209
|
-
onOnInit: o[8] || (o[8] = () => e("onInit")),
|
|
210
|
-
onOnClose: o[9] || (o[9] = () => e("onClose")),
|
|
211
|
-
onOnUndoChange: o[10] || (o[10] = (n) => e("onUndoChange", n)),
|
|
212
|
-
onOnRedoChange: o[11] || (o[11] = (n) => e("onRedoChange", n)),
|
|
213
|
-
onOnPreview: o[12] || (o[12] = (n) => e("onPreview", n)),
|
|
214
|
-
onOnAlert: o[13] || (o[13] = (n) => e("onAlert", n)),
|
|
215
|
-
onOnBannerClick: o[14] || (o[14] = (n) => e("onBannerClick", n)),
|
|
216
|
-
onOnEdittedWithoutSaveChanged: o[15] || (o[15] = (n) => e("onEdittedWithoutSaveChanged", n)),
|
|
217
|
-
onOnOpenCustomBlockDialog: o[16] || (o[16] = (n) => e("onOpenCustomBlockDialog", n)),
|
|
218
|
-
onOnTemplateRename: o[17] || (o[17] = (n) => e("onTemplateRename", n)),
|
|
219
|
-
onUpdateTestingEmailAddresses: o[18] || (o[18] = (n) => e("updateTestingEmailAddresses", n)),
|
|
220
|
-
onOnError: o[19] || (o[19] = (n) => e("onError", n)),
|
|
221
|
-
onOnLanguageCreated: o[20] || (o[20] = (n) => e("onLanguageCreated", n)),
|
|
222
|
-
onOnLanguageDeleted: o[21] || (o[21] = (n) => e("onLanguageDeleted", n)),
|
|
223
|
-
onOnLanguageSelected: o[22] || (o[22] = (n) => e("onLanguageSelected", n)),
|
|
224
|
-
onOnPrimaryLanguageChanged: o[23] || (o[23] = (n) => e("onPrimaryLanguageChanged", n)),
|
|
225
|
-
onOnGetMutations: o[24] || (o[24] = (n) => e("onGetMutations", n))
|
|
226
|
-
}, null, 8, ["options", "stage"]));
|
|
227
|
-
}
|
|
228
292
|
});
|
|
229
293
|
export {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
294
|
+
O as CoreEmailEditor,
|
|
295
|
+
_ as CoreLandingPageEditor,
|
|
296
|
+
B as EmailEditor,
|
|
297
|
+
R as LandingPageEditor,
|
|
298
|
+
B as TopolEditor,
|
|
299
|
+
M as TopolPlugin
|
|
236
300
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(d,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@topol.io/editor"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@topol.io/editor","vue"],u):(d=typeof globalThis<"u"?globalThis:d||self,u(d["topol-editor-vue"]={},d.TopolPlugin,d.Vue))})(this,function(d,u,s){"use strict";const k=s.defineComponent({__name:"EmailEditor",props:{options:{},callbacks:{},stage:{default:"production"},loaderUrl:{}},emits:["ready","onSave","onSaveAndClose","onTestSend","onBannerClick","onOpenFileManager","onLoaded","onSavedSectionSave","onSavedSectionRemove","onSavedSectionEdit","onImageDelete","onInit","onUndoChange","onRedoChange","onPreview","onPreviewClose","onAlert","onEditorClose","onEdittedWithoutSaveChanged","onBlocksAndStructuresVisibilityChange","onOpenCustomBlockDialog","onTemplateRename","onTemplateUpdated","updateTestingEmailAddresses","onEditorError","onLanguageCreated","onLanguageDeleted","onLanguageSelected","onPrimaryLanguageChanged","onGetMutations","onCloudSave","onCloudTemplateChange"],setup(E,{expose:p,emit:h}){const a=E,r=h,S=s.getCurrentInstance(),v=s.ref();let g,C=!1;p({getEditor:()=>g??null});const i=l=>{var o,n,e;const c=`on${l[0].toUpperCase()}${l.slice(1)}`;return!!((o=a.callbacks)!=null&&o[l])||!!((n=S.vnode.props)!=null&&n[c])||!!((e=S.vnode.props)!=null&&e[`${c}Once`])},m=l=>{var o,n;if(C)return;const c={source:"integration",message:l instanceof Error?l.message:String(l),detail:l};i("onEditorError")||console.error("[@topol.io/editor-vue] EmailEditor failed:",l),(n=(o=a.callbacks)==null?void 0:o.onEditorError)==null||n.call(o,c),r("onEditorError",c)};return s.onMounted(async()=>{var c;const l={onSave:i("onSave")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onSave)==null?void 0:t.call(e,o);return r("onSave",o),n}:void 0,onSaveAndClose:i("onSaveAndClose")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onSaveAndClose)==null?void 0:t.call(e,o);return r("onSaveAndClose",o),n}:void 0,onTestSend:i("onTestSend")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onTestSend)==null?void 0:t.call(e,o);return r("onTestSend",o),n}:void 0,onBannerClick:i("onBannerClick")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onBannerClick)==null?void 0:t.call(e,o);return r("onBannerClick",o),n}:void 0,onOpenFileManager:i("onOpenFileManager")?()=>{var n,e;const o=(e=(n=a.callbacks)==null?void 0:n.onOpenFileManager)==null?void 0:e.call(n);return r("onOpenFileManager"),o}:void 0,onLoaded:i("onLoaded")?()=>{var n,e;const o=(e=(n=a.callbacks)==null?void 0:n.onLoaded)==null?void 0:e.call(n);return r("onLoaded"),o}:void 0,onSavedSectionSave:i("onSavedSectionSave")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onSavedSectionSave)==null?void 0:t.call(e,o);return r("onSavedSectionSave",o),n}:void 0,onSavedSectionRemove:i("onSavedSectionRemove")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onSavedSectionRemove)==null?void 0:t.call(e,o);return r("onSavedSectionRemove",o),n}:void 0,onSavedSectionEdit:i("onSavedSectionEdit")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onSavedSectionEdit)==null?void 0:t.call(e,o);return r("onSavedSectionEdit",o),n}:void 0,onImageDelete:i("onImageDelete")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onImageDelete)==null?void 0:t.call(e,o);return r("onImageDelete",o),n}:void 0,onInit:i("onInit")?()=>{var n,e;const o=(e=(n=a.callbacks)==null?void 0:n.onInit)==null?void 0:e.call(n);return r("onInit"),o}:void 0,onUndoChange:i("onUndoChange")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onUndoChange)==null?void 0:t.call(e,o);return r("onUndoChange",o),n}:void 0,onRedoChange:i("onRedoChange")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onRedoChange)==null?void 0:t.call(e,o);return r("onRedoChange",o),n}:void 0,onPreview:i("onPreview")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onPreview)==null?void 0:t.call(e,o);return r("onPreview",o),n}:void 0,onPreviewClose:i("onPreviewClose")?()=>{var n,e;const o=(e=(n=a.callbacks)==null?void 0:n.onPreviewClose)==null?void 0:e.call(n);return r("onPreviewClose"),o}:void 0,onAlert:i("onAlert")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onAlert)==null?void 0:t.call(e,o);return r("onAlert",o),n}:void 0,onEditorClose:i("onEditorClose")?()=>{var n,e;const o=(e=(n=a.callbacks)==null?void 0:n.onEditorClose)==null?void 0:e.call(n);return r("onEditorClose"),o}:void 0,onEdittedWithoutSaveChanged:i("onEdittedWithoutSaveChanged")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onEdittedWithoutSaveChanged)==null?void 0:t.call(e,o);return r("onEdittedWithoutSaveChanged",o),n}:void 0,onBlocksAndStructuresVisibilityChange:i("onBlocksAndStructuresVisibilityChange")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onBlocksAndStructuresVisibilityChange)==null?void 0:t.call(e,o);return r("onBlocksAndStructuresVisibilityChange",o),n}:void 0,onOpenCustomBlockDialog:i("onOpenCustomBlockDialog")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onOpenCustomBlockDialog)==null?void 0:t.call(e,o);return r("onOpenCustomBlockDialog",o),n}:void 0,onTemplateRename:i("onTemplateRename")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onTemplateRename)==null?void 0:t.call(e,o);return r("onTemplateRename",o),n}:void 0,onTemplateUpdated:i("onTemplateUpdated")?()=>{var n,e;const o=(e=(n=a.callbacks)==null?void 0:n.onTemplateUpdated)==null?void 0:e.call(n);return r("onTemplateUpdated"),o}:void 0,updateTestingEmailAddresses:i("updateTestingEmailAddresses")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.updateTestingEmailAddresses)==null?void 0:t.call(e,o);return r("updateTestingEmailAddresses",o),n}:void 0,onEditorError:i("onEditorError")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onEditorError)==null?void 0:t.call(e,o);return r("onEditorError",o),n}:void 0,onLanguageCreated:i("onLanguageCreated")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onLanguageCreated)==null?void 0:t.call(e,o);return r("onLanguageCreated",o),n}:void 0,onLanguageDeleted:i("onLanguageDeleted")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onLanguageDeleted)==null?void 0:t.call(e,o);return r("onLanguageDeleted",o),n}:void 0,onLanguageSelected:i("onLanguageSelected")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onLanguageSelected)==null?void 0:t.call(e,o);return r("onLanguageSelected",o),n}:void 0,onPrimaryLanguageChanged:i("onPrimaryLanguageChanged")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onPrimaryLanguageChanged)==null?void 0:t.call(e,o);return r("onPrimaryLanguageChanged",o),n}:void 0,onGetMutations:i("onGetMutations")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onGetMutations)==null?void 0:t.call(e,o);return r("onGetMutations",o),n}:void 0,getNonce:(c=a.callbacks)!=null&&c.getNonce?()=>a.callbacks.getNonce():void 0,onCloudSave:i("onCloudSave")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onCloudSave)==null?void 0:t.call(e,o);return r("onCloudSave",o),n}:void 0,onCloudTemplateChange:i("onCloudTemplateChange")?o=>{var e,t;const n=(t=(e=a.callbacks)==null?void 0:e.onCloudTemplateChange)==null?void 0:t.call(e,o);return r("onCloudTemplateChange",o),n}:void 0};try{const o=await u.EmailEditor.init({config:a.options,...l},{stage:a.stage,loaderUrl:a.loaderUrl});if(C){await o.destroy();return}g=o;try{await o.render(v.value)}catch(n){throw await o.destroy(),g=void 0,n}C||r("ready",o)}catch(o){m(o)}}),s.onBeforeUnmount(()=>{C=!0;const l=g;g=void 0,l==null||l.destroy().catch(c=>console.warn("[@topol.io/editor-vue] EmailEditor cleanup failed:",c))}),(l,c)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"container",ref:v,style:{width:"100%",height:"100vh"}},null,512))}}),f="topol-landing-page-editor-id",b=s.defineComponent({__name:"LandingPageEditor",props:{options:{},stage:{default:"production"}},emits:["onSave","onSaveAndClose","onOpenFileManager","onImageDelete","onLoaded","onInit","onUndoChange","onRedoChange","onPreview","onPreviewClose","onAlert","onEditorClose","onEdittedWithoutSaveChanged","onOpenCustomBlockDialog","onTemplateRename","onEditorError"],setup(E,{expose:p,emit:h}){const a=E,r=h,S=["onSave","onSaveAndClose","onOpenFileManager","onImageDelete","onLoaded","onInit","onUndoChange","onRedoChange","onPreview","onPreviewClose","onAlert","onEditorClose","onEdittedWithoutSaveChanged","onOpenCustomBlockDialog","onTemplateRename","onEditorError"],v=s.ref(null),g=s.getCurrentInstance(),C=n=>{const e=g==null?void 0:g.vnode.props;if(!e)return!1;const t="on"+n.charAt(0).toUpperCase()+n.slice(1);return typeof e[t]=="function"||Array.isArray(e[t])},i=()=>{const n={};for(const e of S)C(e)&&(n[e]=t=>{t===void 0?r(e):r(e,t)});return n};let m=!1;async function l(n){var e;if(n)try{await((e=n.destroy)==null?void 0:e.call(n))}catch(t){console.warn("[@topol.io/editor-vue] LandingPageEditor destroy failed:",t)}}return s.onMounted(async()=>{try{const n=await u.LandingPageEditor.init({config:a.options,...i()},{stage:a.stage});if(m){await l(n);return}v.value=n,await n.render("#"+f)}catch(n){if(m)return;const e=n instanceof Error?n.message:"Failed to initialize editor";r("onEditorError",{source:"init",message:e,detail:n}),console.error("[@topol.io/editor-vue] LandingPageEditor initialization failed:",n)}}),s.onBeforeUnmount(()=>{m=!0;const n=v.value;v.value=null,l(n)}),p({load:n=>{var e;(e=v.value)==null||e.load(n)},save:()=>{var n;(n=v.value)==null||n.save()}}),(n,e)=>(s.openBlock(),s.createElementBlock("div",{id:f,style:{position:"absolute",width:"100%",height:"100vh"}}))}});Object.defineProperty(d,"CoreEmailEditor",{enumerable:!0,get:()=>u.EmailEditor}),Object.defineProperty(d,"CoreLandingPageEditor",{enumerable:!0,get:()=>u.LandingPageEditor}),d.TopolPlugin=u,d.EmailEditor=k,d.LandingPageEditor=b,d.TopolEditor=k,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,15 +1,145 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { IVueEmailOptions } from
|
|
1
|
+
import type { IEmailCallbacks, IEmailEditorInstance, IStage, IErrorData } from "@topol.io/editor";
|
|
2
|
+
import type { IVueEmailOptions } from "./types";
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
options: IVueEmailOptions;
|
|
5
|
+
callbacks?: IEmailCallbacks;
|
|
5
6
|
stage?: IStage;
|
|
7
|
+
loaderUrl?: string;
|
|
6
8
|
};
|
|
7
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
9
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
10
|
+
getEditor: () => IEmailEditorInstance | null;
|
|
11
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
onSave: (payload: import("@topol.io/editor").ISaveData) => any;
|
|
13
|
+
onSaveAndClose: (payload: import("@topol.io/editor").ISaveData) => any;
|
|
14
|
+
onTestSend: (payload: import("@topol.io/editor").ISendTestData) => any;
|
|
15
|
+
onBannerClick: (payload: {
|
|
16
|
+
json: unknown;
|
|
17
|
+
html: unknown;
|
|
18
|
+
}) => any;
|
|
19
|
+
onOpenFileManager: () => any;
|
|
20
|
+
onLoaded: () => any;
|
|
21
|
+
onSavedSectionSave: (payload: {
|
|
22
|
+
section: import("@topol.io/editor").ISavedBlock;
|
|
23
|
+
}) => any;
|
|
24
|
+
onSavedSectionRemove: (payload: {
|
|
25
|
+
id: number | string;
|
|
26
|
+
}) => any;
|
|
27
|
+
onSavedSectionEdit: (payload: {
|
|
28
|
+
id: number | string;
|
|
29
|
+
}) => any;
|
|
30
|
+
onImageDelete: (payload: {
|
|
31
|
+
items: import("@topol.io/editor").IEmailDeletedItem[];
|
|
32
|
+
}) => any;
|
|
33
|
+
onInit: () => any;
|
|
34
|
+
onUndoChange: (payload: {
|
|
35
|
+
count: number;
|
|
36
|
+
}) => any;
|
|
37
|
+
onRedoChange: (payload: {
|
|
38
|
+
count: number;
|
|
39
|
+
}) => any;
|
|
40
|
+
onPreview: (payload: {
|
|
41
|
+
html: unknown;
|
|
42
|
+
}) => any;
|
|
43
|
+
onPreviewClose: () => any;
|
|
44
|
+
onAlert: (payload: {
|
|
45
|
+
notification: import("@topol.io/editor").INotification;
|
|
46
|
+
}) => any;
|
|
47
|
+
onEditorClose: () => any;
|
|
48
|
+
onEdittedWithoutSaveChanged: (payload: {
|
|
49
|
+
value: boolean;
|
|
50
|
+
}) => any;
|
|
51
|
+
onBlocksAndStructuresVisibilityChange: (payload: {
|
|
52
|
+
value: boolean;
|
|
53
|
+
}) => any;
|
|
54
|
+
onOpenCustomBlockDialog: (payload: {
|
|
55
|
+
block: unknown;
|
|
56
|
+
}) => any;
|
|
57
|
+
onTemplateRename: (payload: {
|
|
58
|
+
name: string;
|
|
59
|
+
}) => any;
|
|
60
|
+
onTemplateUpdated: () => any;
|
|
61
|
+
updateTestingEmailAddresses: (payload: {
|
|
62
|
+
emails: string[];
|
|
63
|
+
}) => any;
|
|
64
|
+
onEditorError: (payload: IErrorData) => any;
|
|
65
|
+
onLanguageCreated: (payload: import("@topol.io/editor").ILanguageChangePayload) => any;
|
|
66
|
+
onLanguageDeleted: (payload: import("@topol.io/editor").ILanguageChangePayload) => any;
|
|
67
|
+
onLanguageSelected: (payload: {
|
|
68
|
+
code: string;
|
|
69
|
+
}) => any;
|
|
70
|
+
onPrimaryLanguageChanged: (payload: import("@topol.io/editor").ILanguageChangePayload) => any;
|
|
71
|
+
onGetMutations: (payload: {
|
|
72
|
+
mutations: import("@topol.io/editor").ILanguageMutation[];
|
|
73
|
+
}) => any;
|
|
74
|
+
onCloudSave: (payload: import("@topol.io/editor").ICloudSavePayload) => any;
|
|
75
|
+
onCloudTemplateChange: (payload: import("@topol.io/editor").ICloudTemplateChangePayload) => any;
|
|
76
|
+
ready: (editor: IEmailEditorInstance) => any;
|
|
11
77
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
-
|
|
78
|
+
onOnSave?: ((payload: import("@topol.io/editor").ISaveData) => any) | undefined;
|
|
79
|
+
onOnSaveAndClose?: ((payload: import("@topol.io/editor").ISaveData) => any) | undefined;
|
|
80
|
+
onOnTestSend?: ((payload: import("@topol.io/editor").ISendTestData) => any) | undefined;
|
|
81
|
+
onOnBannerClick?: ((payload: {
|
|
82
|
+
json: unknown;
|
|
83
|
+
html: unknown;
|
|
84
|
+
}) => any) | undefined;
|
|
85
|
+
onOnOpenFileManager?: (() => any) | undefined;
|
|
86
|
+
onOnLoaded?: (() => any) | undefined;
|
|
87
|
+
onOnSavedSectionSave?: ((payload: {
|
|
88
|
+
section: import("@topol.io/editor").ISavedBlock;
|
|
89
|
+
}) => any) | undefined;
|
|
90
|
+
onOnSavedSectionRemove?: ((payload: {
|
|
91
|
+
id: number | string;
|
|
92
|
+
}) => any) | undefined;
|
|
93
|
+
onOnSavedSectionEdit?: ((payload: {
|
|
94
|
+
id: number | string;
|
|
95
|
+
}) => any) | undefined;
|
|
96
|
+
onOnImageDelete?: ((payload: {
|
|
97
|
+
items: import("@topol.io/editor").IEmailDeletedItem[];
|
|
98
|
+
}) => any) | undefined;
|
|
99
|
+
onOnInit?: (() => any) | undefined;
|
|
100
|
+
onOnUndoChange?: ((payload: {
|
|
101
|
+
count: number;
|
|
102
|
+
}) => any) | undefined;
|
|
103
|
+
onOnRedoChange?: ((payload: {
|
|
104
|
+
count: number;
|
|
105
|
+
}) => any) | undefined;
|
|
106
|
+
onOnPreview?: ((payload: {
|
|
107
|
+
html: unknown;
|
|
108
|
+
}) => any) | undefined;
|
|
109
|
+
onOnPreviewClose?: (() => any) | undefined;
|
|
110
|
+
onOnAlert?: ((payload: {
|
|
111
|
+
notification: import("@topol.io/editor").INotification;
|
|
112
|
+
}) => any) | undefined;
|
|
113
|
+
onOnEditorClose?: (() => any) | undefined;
|
|
114
|
+
onOnEdittedWithoutSaveChanged?: ((payload: {
|
|
115
|
+
value: boolean;
|
|
116
|
+
}) => any) | undefined;
|
|
117
|
+
onOnBlocksAndStructuresVisibilityChange?: ((payload: {
|
|
118
|
+
value: boolean;
|
|
119
|
+
}) => any) | undefined;
|
|
120
|
+
onOnOpenCustomBlockDialog?: ((payload: {
|
|
121
|
+
block: unknown;
|
|
122
|
+
}) => any) | undefined;
|
|
123
|
+
onOnTemplateRename?: ((payload: {
|
|
124
|
+
name: string;
|
|
125
|
+
}) => any) | undefined;
|
|
126
|
+
onOnTemplateUpdated?: (() => any) | undefined;
|
|
127
|
+
onUpdateTestingEmailAddresses?: ((payload: {
|
|
128
|
+
emails: string[];
|
|
129
|
+
}) => any) | undefined;
|
|
130
|
+
onOnEditorError?: ((payload: IErrorData) => any) | undefined;
|
|
131
|
+
onOnLanguageCreated?: ((payload: import("@topol.io/editor").ILanguageChangePayload) => any) | undefined;
|
|
132
|
+
onOnLanguageDeleted?: ((payload: import("@topol.io/editor").ILanguageChangePayload) => any) | undefined;
|
|
133
|
+
onOnLanguageSelected?: ((payload: {
|
|
134
|
+
code: string;
|
|
135
|
+
}) => any) | undefined;
|
|
136
|
+
onOnPrimaryLanguageChanged?: ((payload: import("@topol.io/editor").ILanguageChangePayload) => any) | undefined;
|
|
137
|
+
onOnGetMutations?: ((payload: {
|
|
138
|
+
mutations: import("@topol.io/editor").ILanguageMutation[];
|
|
139
|
+
}) => any) | undefined;
|
|
140
|
+
onOnCloudSave?: ((payload: import("@topol.io/editor").ICloudSavePayload) => any) | undefined;
|
|
141
|
+
onOnCloudTemplateChange?: ((payload: import("@topol.io/editor").ICloudTemplateChangePayload) => any) | undefined;
|
|
142
|
+
onReady?: ((editor: IEmailEditorInstance) => any) | undefined;
|
|
13
143
|
}>, {
|
|
14
144
|
stage: IStage;
|
|
15
145
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type IStage } from
|
|
2
|
-
import type { IVueLandingPageOptions } from
|
|
1
|
+
import { type IStage } from "@topol.io/editor";
|
|
2
|
+
import type { IVueLandingPageOptions } from "./types";
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
options: IVueLandingPageOptions;
|
|
5
5
|
stage?: IStage;
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
options: IVueEmailOptions;
|
|
5
|
-
stage?: IStage;
|
|
6
|
-
};
|
|
7
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
-
[x: string]: any;
|
|
9
|
-
} & {
|
|
10
|
-
[x: string]: any;
|
|
11
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
-
[x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
|
|
13
|
-
}>, {
|
|
14
|
-
stage: IStage;
|
|
15
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
-
export default _default;
|
|
1
|
+
/** @deprecated Naming alias only; uses the v4 EmailEditor contract. */
|
|
2
|
+
import EmailEditor from "./EmailEditor.vue";
|
|
3
|
+
export default EmailEditor;
|
package/dist/types/entry.d.ts
CHANGED
|
@@ -31,12 +31,13 @@
|
|
|
31
31
|
* </template>
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
export { default as TopolPlugin, EmailEditor as CoreEmailEditor, LandingPageEditor as CoreLandingPageEditor } from
|
|
35
|
-
export { default as EmailEditor } from
|
|
36
|
-
export { default as LandingPageEditor } from
|
|
34
|
+
export { default as TopolPlugin, EmailEditor as CoreEmailEditor, LandingPageEditor as CoreLandingPageEditor } from "@topol.io/editor";
|
|
35
|
+
export { default as EmailEditor } from "./EmailEditor.vue";
|
|
36
|
+
export { default as LandingPageEditor } from "./LandingPageEditor.vue";
|
|
37
37
|
/**
|
|
38
38
|
* @deprecated Use EmailEditor instead. TopolEditor is an alias for backwards compatibility.
|
|
39
39
|
*/
|
|
40
|
-
export { default as TopolEditor } from
|
|
41
|
-
export type { ITopolOptions, ILandingPageOptions, ILandingPageEditorInstance, IEmailCallbacks, ILandingPageCallbacks, ISaveData, IErrorData, ISendTestData, INotification, ISavedBlock, IStage, TopolSection, } from
|
|
42
|
-
export type { IVueEmailOptions, IVueLandingPageOptions, IVueOptions } from
|
|
40
|
+
export { default as TopolEditor } from "./TopolEditor.vue";
|
|
41
|
+
export type { ITopolOptions, ILandingPageOptions, ILandingPageEditorInstance, IEmailCallbacks, ILandingPageCallbacks, ISaveData, IErrorData, ISendTestData, INotification, ISavedBlock, IStage, TopolSection, } from "@topol.io/editor";
|
|
42
|
+
export type { IVueEmailOptions, IVueLandingPageOptions, IVueOptions } from "./types";
|
|
43
|
+
export type { IEmailConfig, IEmailEditorInstance, IEmailEditorPluginOptions, ICloudOptions, ICloudFeatures, INonceAuthCallbacks, ICloudCallbacks, ICloudSavePayload, ICloudTemplateChangePayload, ISavedSection, IPremadeSection, IPremadeSections, IPremadeSectionsOptions, ILanguageMutation, ILanguageChangePayload, IEmailDeletedItem, IUpdateTemplateOptions, } from "@topol.io/editor";
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type re-exports from core package and Vue-specific types.
|
|
3
3
|
*/
|
|
4
|
-
export type { ITopolOptions, ILandingPageOptions, ILandingPageEditorInstance, IEmailCallbacks, ILandingPageCallbacks, ISaveData, IErrorData, ISendTestData, INotification, ISavedBlock, IStage, TopolSection, } from
|
|
5
|
-
import type {
|
|
4
|
+
export type { ITopolOptions, ILandingPageOptions, ILandingPageEditorInstance, IEmailCallbacks, ILandingPageCallbacks, ISaveData, IErrorData, ISendTestData, INotification, ISavedBlock, IStage, TopolSection, } from "@topol.io/editor";
|
|
5
|
+
import type { IEmailConfig, ILandingPageOptions } from "@topol.io/editor";
|
|
6
6
|
/**
|
|
7
7
|
* Vue-specific options for EmailEditor component.
|
|
8
|
-
*
|
|
8
|
+
* Contains the v4 config; callbacks are provided separately.
|
|
9
9
|
*/
|
|
10
|
-
export type IVueEmailOptions =
|
|
10
|
+
export type IVueEmailOptions = IEmailConfig;
|
|
11
11
|
/**
|
|
12
12
|
* Vue-specific options for LandingPageEditor component.
|
|
13
13
|
* Contains only the config options, as callbacks are handled as Vue emits.
|
|
14
14
|
*/
|
|
15
|
-
export type IVueLandingPageOptions = ILandingPageOptions[
|
|
15
|
+
export type IVueLandingPageOptions = ILandingPageOptions["config"];
|
|
16
16
|
/**
|
|
17
17
|
* @deprecated Use IVueEmailOptions instead.
|
|
18
18
|
*/
|
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": "
|
|
17
|
+
"version": "2.0.0-alpha.2",
|
|
18
18
|
"type": "module",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist"
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
".": {
|
|
26
26
|
"types": "./dist/types/entry.d.ts",
|
|
27
27
|
"import": "./dist/topol-editor-vue.es.js",
|
|
28
|
-
"require": "./dist/topol-editor-vue.umd.
|
|
28
|
+
"require": "./dist/topol-editor-vue.umd.cjs"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@topol.io/editor": "
|
|
32
|
+
"@topol.io/editor": "2.0.0-alpha.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"vue": "^3.2.25"
|
|
@@ -55,6 +55,10 @@
|
|
|
55
55
|
"preview": "vite preview",
|
|
56
56
|
"build:types": "vue-tsc -p tsconfig.prod.json",
|
|
57
57
|
"test": "vitest run",
|
|
58
|
-
"test:watch": "vitest"
|
|
58
|
+
"test:watch": "vitest",
|
|
59
|
+
"lint": "oxlint --deny-warnings .",
|
|
60
|
+
"lint:fix": "oxlint --fix --deny-warnings .",
|
|
61
|
+
"format": "oxfmt --write .",
|
|
62
|
+
"format:check": "oxfmt --check ."
|
|
59
63
|
}
|
|
60
64
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(r,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("@topol.io/editor"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@topol.io/editor","vue"],l):(r=typeof globalThis<"u"?globalThis:r||self,l(r["topol-editor-vue"]={},r.editor,r.Vue))})(this,function(r,l,i){"use strict";const v="topol-email-editor-id",f=i.defineComponent({__name:"EmailEditor",props:{options:{},stage:{default:"production"}},emits:["onSave","onSaveAndClose","onTestSend","onOpenFileManager","onLoaded","onBlockSave","onBlockRemove","onBlockEdit","onInit","onClose","onUndoChange","onRedoChange","onPreview","onAlert","onBannerClick","onEdittedWithoutSaveChanged","onOpenCustomBlockDialog","onTemplateRename","updateTestingEmailAddresses","onError","onLanguageCreated","onLanguageDeleted","onLanguageSelected","onPrimaryLanguageChanged","onGetMutations"],setup(p,{emit:m}){const s=p,e=m,u=()=>({onSave(n,o,d,C){e("onSave",{json:n,html:o,mutations:d,syncedSections:C})},onSaveAndClose(n,o,d,C){e("onSaveAndClose",{json:n,html:o,mutations:d,syncedSections:C})},onTestSend(n,o,d){e("onTestSend",{email:n,json:o,html:d})},onOpenFileManager(){e("onOpenFileManager")},onLoaded(){e("onLoaded")},onBlockSave(n){e("onBlockSave",n)},onBlockRemove(n){e("onBlockRemove",n)},onBlockEdit(n){e("onBlockEdit",n)},onInit(){e("onInit")},onUndoChange(n){e("onUndoChange",n)},onRedoChange(n){e("onRedoChange",n)},onPreview(n){e("onPreview",n)},onAlert(n){e("onAlert",n)},onClose(){e("onClose")},onBannerClick(n,o){e("onBannerClick",{json:n,html:o})},onEdittedWithoutSaveChanged(n){e("onEdittedWithoutSaveChanged",n)},onOpenCustomBlockDialog(n){e("onOpenCustomBlockDialog",n)},onTemplateRename(n){e("onTemplateRename",n)},updateTestingEmailAddresses(n){e("updateTestingEmailAddresses",n)},onError(n,o,d){e("onError",{type:n,message:o,responseBody:d})},onLanguageCreated(n,o){e("onLanguageCreated",{lang:n,mutations:o})},onLanguageDeleted(n,o){e("onLanguageDeleted",{lang:n,mutations:o})},onLanguageSelected(n){e("onLanguageSelected",{lang:n})},onPrimaryLanguageChanged(n,o){e("onPrimaryLanguageChanged",{lang:n,mutations:o})},onGetMutations(n){e("onGetMutations",{mutations:n})}});return i.onMounted(async()=>{try{const n={id:"#"+v,...s.options,callbacks:u()};await l.EmailEditor.init(n,{stage:s.stage})}catch(n){const o=n instanceof Error?n.message:"Failed to initialize editor";e("onError",{type:"init",message:o}),console.error("[@topol.io/editor-vue] EmailEditor initialization failed:",n)}}),i.onBeforeUnmount(()=>{l.EmailEditor.destroy()}),(n,o)=>(i.openBlock(),i.createElementBlock("div",{id:v,style:{position:"absolute",width:"100%",height:"100vh"}}))}}),O="topol-landing-page-editor-id",L=i.defineComponent({__name:"LandingPageEditor",props:{options:{},stage:{default:"production"}},emits:["onSave","onSaveAndClose","onOpenFileManager","onImageDelete","onLoaded","onInit","onUndoChange","onRedoChange","onPreview","onPreviewClose","onAlert","onEditorClose","onEdittedWithoutSaveChanged","onOpenCustomBlockDialog","onTemplateRename","onEditorError"],setup(p,{expose:m,emit:s}){const e=p,u=s,n=["onSave","onSaveAndClose","onOpenFileManager","onImageDelete","onLoaded","onInit","onUndoChange","onRedoChange","onPreview","onPreviewClose","onAlert","onEditorClose","onEdittedWithoutSaveChanged","onOpenCustomBlockDialog","onTemplateRename","onEditorError"],o=i.ref(null),d=i.getCurrentInstance(),C=t=>{const a=d==null?void 0:d.vnode.props;if(!a)return!1;const g="on"+t.charAt(0).toUpperCase()+t.slice(1);return typeof a[g]=="function"||Array.isArray(a[g])},B=()=>{const t={};for(const a of n)C(a)&&(t[a]=g=>{g===void 0?u(a):u(a,g)});return t};let E=!1;async function S(t){var a;if(t)try{await((a=t.destroy)==null?void 0:a.call(t))}catch(g){console.warn("[@topol.io/editor-vue] LandingPageEditor destroy failed:",g)}}return i.onMounted(async()=>{try{const t=await l.LandingPageEditor.init({config:e.options,...B()},{stage:e.stage});if(E){await S(t);return}o.value=t,await t.render("#"+O)}catch(t){if(E)return;const a=t instanceof Error?t.message:"Failed to initialize editor";u("onEditorError",{source:"init",message:a,detail:t}),console.error("[@topol.io/editor-vue] LandingPageEditor initialization failed:",t)}}),i.onBeforeUnmount(()=>{E=!0;const t=o.value;o.value=null,S(t)}),m({load:t=>{var a;(a=o.value)==null||a.load(t)},save:()=>{var t;(t=o.value)==null||t.save()}}),(t,a)=>(i.openBlock(),i.createElementBlock("div",{id:O,style:{position:"absolute",width:"100%",height:"100vh"}}))}}),k=i.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","onTemplateRename","updateTestingEmailAddresses","onError","onLanguageCreated","onLanguageDeleted","onLanguageSelected","onPrimaryLanguageChanged","onGetMutations"],setup(p,{emit:m}){const s=p,e=m;return i.onMounted(()=>{console.warn("[@topol.io/editor-vue] TopolEditor is deprecated and will be removed in a future version. Please use EmailEditor instead.")}),(u,n)=>(i.openBlock(),i.createBlock(f,{options:s.options,stage:s.stage,onOnSave:n[0]||(n[0]=o=>e("onSave",o)),onOnSaveAndClose:n[1]||(n[1]=o=>e("onSaveAndClose",o)),onOnTestSend:n[2]||(n[2]=o=>e("onTestSend",o)),onOnOpenFileManager:n[3]||(n[3]=()=>e("onOpenFileManager")),onOnLoaded:n[4]||(n[4]=()=>e("onLoaded")),onOnBlockSave:n[5]||(n[5]=o=>e("onBlockSave",o)),onOnBlockRemove:n[6]||(n[6]=o=>e("onBlockRemove",o)),onOnBlockEdit:n[7]||(n[7]=o=>e("onBlockEdit",o)),onOnInit:n[8]||(n[8]=()=>e("onInit")),onOnClose:n[9]||(n[9]=()=>e("onClose")),onOnUndoChange:n[10]||(n[10]=o=>e("onUndoChange",o)),onOnRedoChange:n[11]||(n[11]=o=>e("onRedoChange",o)),onOnPreview:n[12]||(n[12]=o=>e("onPreview",o)),onOnAlert:n[13]||(n[13]=o=>e("onAlert",o)),onOnBannerClick:n[14]||(n[14]=o=>e("onBannerClick",o)),onOnEdittedWithoutSaveChanged:n[15]||(n[15]=o=>e("onEdittedWithoutSaveChanged",o)),onOnOpenCustomBlockDialog:n[16]||(n[16]=o=>e("onOpenCustomBlockDialog",o)),onOnTemplateRename:n[17]||(n[17]=o=>e("onTemplateRename",o)),onUpdateTestingEmailAddresses:n[18]||(n[18]=o=>e("updateTestingEmailAddresses",o)),onOnError:n[19]||(n[19]=o=>e("onError",o)),onOnLanguageCreated:n[20]||(n[20]=o=>e("onLanguageCreated",o)),onOnLanguageDeleted:n[21]||(n[21]=o=>e("onLanguageDeleted",o)),onOnLanguageSelected:n[22]||(n[22]=o=>e("onLanguageSelected",o)),onOnPrimaryLanguageChanged:n[23]||(n[23]=o=>e("onPrimaryLanguageChanged",o)),onOnGetMutations:n[24]||(n[24]=o=>e("onGetMutations",o))},null,8,["options","stage"]))}});Object.defineProperty(r,"CoreEmailEditor",{enumerable:!0,get:()=>l.EmailEditor}),Object.defineProperty(r,"CoreLandingPageEditor",{enumerable:!0,get:()=>l.LandingPageEditor}),r.TopolPlugin=l,r.EmailEditor=f,r.LandingPageEditor=L,r.TopolEditor=k,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|