@topol.io/editor-vue 0.0.0-beta.2 → 0.0.0-beta.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 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.md CHANGED
@@ -28,7 +28,6 @@ For more options see the docs for [TopolOptions configuration](https://topol.io/
28
28
  ```js
29
29
  import { TopolEditor } from '@topol.io/editor-vue';
30
30
 
31
-
32
31
  const customOptions = {
33
32
  authorize: {
34
33
  apiKey: "YOUR_API_TOKEN",
@@ -56,25 +55,24 @@ TopolPlugin.save();
56
55
 
57
56
  | Action | Description |
58
57
  | --- | ----------- |
59
- | TopolPlugin.save() | Saves the content of the editor [more info](https://topol.io/docs#plugin-configuration) |
60
- | TopolPlugin.load(template) | Loads the provided template [more info](https://topol.io/docs#save-and-load-options) |
61
- | TopolPlugin.togglePreview() | Toggles editor preview [more info](https://topol.io/docs#preview-mode-on-desktop-and-mobile)|
62
- | TopolPlugin.togglePreviewSize() | Toggles editor preview size |
63
- | TopolPlugin.undo() | Undo change in editor [more info](https://topol.io/docs#redo-and-undo)|
64
- | TopolPlugin.redo() | Redo change in editor [more info](https://topol.io/docs#redo-and-undo)|
65
- | TopolPlugin.setSavedBlocks(savedblock: ISavedBlock[]) | Sets the saved blocks [more info](https://topol.io/docs#saved-blocks) |
66
- | TopolPlugin.createNotification(notification: INotification) | Creates editor's notification [more info](https://topol.io/docs#show-custom-notification-in-editor) |
67
- | TopolPlugin.changeEmailToMobile() | Change email to mobile view [more info](https://topol.io/docs#mobile-first-email-template)|
68
- | TopolPlugin.changeEmailToDesktop() | Change email to desktop view [more info](https://topol.io/docs#mobile-first-email-template)|
69
- | TopolPlugin.toggleBlocksAndStructuresVisibility() | Toggle hidden structures visibility for blocks and structures [more info](https://topol.io/docs#mobile-first-email-template)|
70
- | TopolPlugin.destroy() | Destroys the editor initialization [more info](https://topol.io/docs#working-with-js-frameworks) |
71
-
72
-
58
+ | `TopolPlugin.save()` | Saves the content of the editor [more info](https://topol.io/docs#plugin-configuration) |
59
+ | `TopolPlugin.load(template`) | Loads the provided template [more info](https://topol.io/docs#save-and-load-options) |
60
+ | `TopolPlugin.togglePreview()` | Toggles editor preview [more info](https://topol.io/docs#preview-mode-on-desktop-and-mobile)|
61
+ | `TopolPlugin.togglePreviewSize()` | Toggles editor preview size |
62
+ | `TopolPlugin.undo()` | Undo change in editor [more info](https://topol.io/docs#redo-and-undo)|
63
+ | `TopolPlugin.redo()` | Redo change in editor [more info](https://topol.io/docs#redo-and-undo)|
64
+ | `TopolPlugin.setSavedBlocks(savedblock: ISavedBlock[])` | Sets the saved blocks [more info](https://topol.io/docs#saved-blocks) |
65
+ | `TopolPlugin.createNotification(notification: INotification)` | Creates editor's notification [more info](https://topol.io/docs#show-custom-notification-in-editor) |
66
+ | `TopolPlugin.changeEmailToMobile()` | Change email to mobile view [more info](https://topol.io/docs#mobile-first-email-template)|
67
+ | `TopolPlugin.changeEmailToDesktop()` | Change email to desktop view [more info](https://topol.io/docs#mobile-first-email-template)|
68
+ | `TopolPlugin.toggleBlocksAndStructuresVisibility()` | Toggle hidden structures visibility for blocks and structures [more info](https://topol.io/docs#mobile-first-email-template)|
69
+ | `TopolPlugin.destroy()` | Destroys the editor initialization [more info](https://topol.io/docs#working-with-js-frameworks) |
70
+
71
+ <br>
73
72
  ## Editor Events
74
73
 
75
74
  The callbacks from editor are received as component events.
76
75
 
77
-
78
76
  ```html
79
77
  <TopolEditor :options="customOptions" @onSave="handleOnSave"></TopolEditor>
80
78
  ```
@@ -83,20 +81,21 @@ The callbacks from editor are received as component events.
83
81
 
84
82
  | Event | Description |
85
83
  | --- | ----------- |
86
- | @onSave | Returns object which contains html and json of the template} [more info](https://topol.io/docs#onsave-and-onsaveandclose) |
87
- | @onSaveAndClose | Returns object which contains html and json of the template [more info](https://topol.io/docs#onsave-and-onsaveandclose) |
88
- | @onTestSend | Returns object which contains email, html and json of the template [more info](https://topol.io/docs#on-test-send) |
89
- | @onOpenFileManager | When user clicks file manager open [more info](https://topol.io/docs#custom-file-manager)|
90
- | @onLoaded | When editor is fully loaded |
91
- | @onInit | When editor inits [more info](https://topol.io/docs#custom-file-manager) |
92
- | @onBlockSave | When user saves block in editor, returns object of type ISavedBlock [more info](https://topol.io/docs#saved-blocks) |
93
- | @onBlockRemove | When user removes saved block, returns id of saved block to be removed [more info](https://topol.io/docs#saved-blocks) |
94
- | @onBlockEdit | When user edits saved block, returns id of saved block to be updated [more info](https://topol.io/docs#saved-blocks) |
95
- | @onUndoChange | When user clicks undo button, retunrs number of steps user undone [more info](https://topol.io/docs#redo-and-undo) |
96
- | @unRedoChange | When user clicks redo button, retunrs number of steps user redone [more info](https://topol.io/docs#redo-and-undo) |
97
- | @onPreview | When user switches to preview |
98
- | @onAlert | When alert appears in editor [more info](https://topol.io/docs#show-custom-notification-in-editor)|
99
-
84
+ | `@onSave` | Returns object which contains html and json of the template} [more info](https://topol.io/docs#onsave-and-onsaveandclose) |
85
+ | `@onSaveAndClose` | Returns object which contains html and json of the template [more info](https://topol.io/docs#onsave-and-onsaveandclose) |
86
+ | `@onTestSend` | Returns object which contains email, html and json of the template [more info](https://topol.io/docs#on-test-send) |
87
+ | `@onOpenFileManager` | When user clicks file manager open [more info](https://topol.io/docs#custom-file-manager)|
88
+ | `@onLoaded` | When editor is fully loaded |
89
+ | `@onInit` | When editor inits [more info](https://topol.io/docs#custom-file-manager) |
90
+ | `@onBlockSave` | When user saves block in editor, returns object of type ISavedBlock [more info](https://topol.io/docs#saved-blocks) |
91
+ | `@onBlockRemove` | When user removes saved block, returns id of saved block to be removed [more info](https://topol.io/docs#saved-blocks) |
92
+ | `@onBlockEdit` | When user edits saved block, returns id of saved block to be updated [more info](https://topol.io/docs#saved-blocks) |
93
+ | `@onUndoChange` | When user clicks undo button, retunrs number of steps user undone [more info](https://topol.io/docs#redo-and-undo) |
94
+ | `@unRedoChange` | When user clicks redo button, retunrs number of steps user redone [more info](https://topol.io/docs#redo-and-undo) |
95
+ | `@onPreview` | When user switches to preview |
96
+ | `@onAlert` | When alert appears in editor [more info](https://topol.io/docs#show-custom-notification-in-editor)|
97
+
98
+ <br>
100
99
  ## TypeScript
101
100
 
102
101
  Topol Editor provides full TypeScript integration and exports all necessary types.
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, onMounted, openBlock, createElementBlock } from "vue";
20
+ import { defineComponent, onMounted, onBeforeUnmount, openBlock, createElementBlock } from "vue";
21
21
  import TopolPlugin from "@topol.io/editor";
22
22
  export { default as TopolPlugin } from "@topol.io/editor";
23
23
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -76,6 +76,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
76
76
  const mergedTopolOptinos = mergeOptions();
77
77
  await TopolPlugin.init(mergedTopolOptinos);
78
78
  });
79
+ onBeforeUnmount(() => {
80
+ TopolPlugin.destroy();
81
+ });
79
82
  return (_ctx, _cache) => {
80
83
  return openBlock(), createElementBlock("div", {
81
84
  id: EDITOR_HTML_ID,
@@ -1 +1 @@
1
- var T=Object.defineProperty,B=Object.defineProperties;var _=Object.getOwnPropertyDescriptors;var s=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var p=(e,o,d)=>o in e?T(e,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):e[o]=d,r=(e,o)=>{for(var d in o||(o={}))C.call(o,d)&&p(e,d,o[d]);if(s)for(var d of s(o))y.call(o,d)&&p(e,d,o[d]);return e},f=(e,o)=>B(e,_(o));(function(e,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("vue"),require("@topol.io/editor")):typeof define=="function"&&define.amd?define(["exports","vue","@topol.io/editor"],o):(e=typeof globalThis!="undefined"?globalThis:e||self,o(e["topol-editor-vue"]={},e.Vue,e.TopolPlugin))})(this,function(e,o,d){"use strict";function v(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var c=v(d);const g=o.defineComponent({props:{options:null},emits:["onSave","onSaveAndClose","onTestSend","onOpenFileManager","onLoaded","onBlockSave","onBlockRemove","onBlockEdit","onInit","onUndoChange","onRedoChange","onPreview","onAlert"],setup(l,{emit:t}){const h=l,u="topol-editor-id",S=()=>{const a={onSave(n,i){t("onSave",{json:n,html:i})},onSaveAndClose(n,i){t("onSaveAndClose",{json:n,html:i})},onTestSend(n,i,k){t("onTestSend",{email:n,json:i,html:k})},onOpenFileManager(){t("onOpenFileManager")},onLoaded(){t("onLoaded")},onBlockSave(n){t("onBlockSave",n)},onBlockRemove(n){t("onBlockRemove",n)},onBlockEdit(n){t("onBlockEdit",n)},onInit(){t("onInit")},onUndoChange(n){t("onUndoChange",n)},onRedoChange(n){t("onRedoChange",n)},onPreview(n){t("onPreview",n)},onAlert(n){t("onAlert",n)}};return f(r({id:"#"+u},h.options),{callbacks:r({},a)})};return o.onMounted(async()=>{const a=S();await c.default.init(a)}),(a,n)=>(o.openBlock(),o.createElementBlock("div",{id:u,style:{position:"absolute",width:"100%",height:"100vh"}}))}});Object.defineProperty(e,"TopolPlugin",{enumerable:!0,get:function(){return c.default}}),e.TopolEditor=g,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"});
1
+ var T=Object.defineProperty,B=Object.defineProperties;var _=Object.getOwnPropertyDescriptors;var s=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var p=(e,o,d)=>o in e?T(e,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):e[o]=d,u=(e,o)=>{for(var d in o||(o={}))y.call(o,d)&&p(e,d,o[d]);if(s)for(var d of s(o))C.call(o,d)&&p(e,d,o[d]);return e},f=(e,o)=>B(e,_(o));(function(e,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("vue"),require("@topol.io/editor")):typeof define=="function"&&define.amd?define(["exports","vue","@topol.io/editor"],o):(e=typeof globalThis!="undefined"?globalThis:e||self,o(e["topol-editor-vue"]={},e.Vue,e.TopolPlugin))})(this,function(e,o,d){"use strict";function v(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var r=v(d);const g=o.defineComponent({props:{options:null},emits:["onSave","onSaveAndClose","onTestSend","onOpenFileManager","onLoaded","onBlockSave","onBlockRemove","onBlockEdit","onInit","onUndoChange","onRedoChange","onPreview","onAlert"],setup(l,{emit:t}){const h=l,c="topol-editor-id",S=()=>{const a={onSave(n,i){t("onSave",{json:n,html:i})},onSaveAndClose(n,i){t("onSaveAndClose",{json:n,html:i})},onTestSend(n,i,k){t("onTestSend",{email:n,json:i,html:k})},onOpenFileManager(){t("onOpenFileManager")},onLoaded(){t("onLoaded")},onBlockSave(n){t("onBlockSave",n)},onBlockRemove(n){t("onBlockRemove",n)},onBlockEdit(n){t("onBlockEdit",n)},onInit(){t("onInit")},onUndoChange(n){t("onUndoChange",n)},onRedoChange(n){t("onRedoChange",n)},onPreview(n){t("onPreview",n)},onAlert(n){t("onAlert",n)}};return f(u({id:"#"+c},h.options),{callbacks:u({},a)})};return o.onMounted(async()=>{const a=S();await r.default.init(a)}),o.onBeforeUnmount(()=>{r.default.destroy()}),(a,n)=>(o.openBlock(),o.createElementBlock("div",{id:c,style:{position:"absolute",width:"100%",height:"100vh"}}))}});Object.defineProperty(e,"TopolPlugin",{enumerable:!0,get:function(){return r.default}}),e.TopolEditor=g,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"});
package/package.json CHANGED
@@ -1,17 +1,20 @@
1
1
  {
2
2
  "name": "@topol.io/editor-vue",
3
- "description": "Vue.js integration for Topol Editor.",
3
+ "description": "Official Vue.js package for Topol Editor.",
4
4
  "keywords": [
5
5
  "plugin",
6
6
  "editor",
7
7
  "email",
8
8
  "topol",
9
- "topol.io"
9
+ "topol.io",
10
+ "topol-vue",
11
+ "email-vue",
12
+ "email templates"
10
13
  ],
11
14
  "author": "Topol.io",
12
15
  "homepage": "https://topol.io",
13
16
  "license": "Apache-2.0",
14
- "version": "0.0.0-beta.2",
17
+ "version": "0.0.0-beta.6",
15
18
  "files": [
16
19
  "dist"
17
20
  ],
@@ -31,13 +34,13 @@
31
34
  "build:types": "vue-tsc"
32
35
  },
33
36
  "dependencies": {
34
- "@topol.io/editor": "^0.0.0-alfa.5"
37
+ "@topol.io/editor": "^0.0.0-alfa.7"
35
38
  },
36
39
  "peerDependencies": {
37
40
  "vue": "^3.2.25"
38
41
  },
39
42
  "devDependencies": {
40
- "@types/node": "^17.0.13",
43
+ "@types/node": "^17.0.14",
41
44
  "@vitejs/plugin-vue": "^2.0.0",
42
45
  "typescript": "^4.4.4",
43
46
  "vite": "^2.7.2",