@topol.io/editor 0.1.0 → 0.2.1

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
@@ -82,32 +82,33 @@ TopolPlugin.save();
82
82
  | `TopolPlugin.setTemplateName(name: string)` | Sets the name of template [more info](https://docs.topol.io/guide/rename-template.html) |
83
83
  | `TopolPlugin.updateApiAuthorizationHeader(newHeader: string \| Record<string, string>)` | Refreshes the authorization tokens [more info](https://docs.topol.io/guide/security.html#refresh-token) |
84
84
  | `TopolPlugin.updateCustomBlockContent(content: string)` | Refreshes the authorization tokens [more info](https://docs.topol.io/guide/custom-block.html#inserting-custom-html-in-custom-dialog-component) |
85
+ | `TopolPlugin.setMergeTags(mergeTags: Array<IMergeTagGroup \| IMergeTag>)` | Sets new array of merge tags. [more info](https://docs.topol.io/guide/merge-tags.html#update-merge-tags) |
85
86
 
86
87
  <br>
87
88
 
88
- ### List of all editor events
89
-
90
- | Event | Description |
91
- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
92
- | `@onSave` | Returns object which contains html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-save) |
93
- | `@onSaveAndClose` | Returns object which contains html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-save-and-close) |
94
- | `@onTestSend` | Returns object which contains email, html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-test-email-send) |
95
- | `@onOpenFileManager` | When user clicks file manager open [more info](https://docs.topol.io/guide/custom-filemanager.html#onopenfilemanager) |
96
- | `@onLoaded` | After editor template is loaded using `TopolPlugin.load()` [more info](https://docs.topol.io/guide/callbacks.html#on-loaded) |
97
- | `@onInit` | When editor inits [more info](https://docs.topol.io/guide/callbacks.html#on-init) |
98
- | `@onBlockSave` | When user saves block in editor, returns object of type ISavedBlock [more info](https://docs.topol.io/guide/callbacks.html#on-block-save) |
99
- | `@onBlockRemove` | When user removes saved block, returns id of saved block to be removed [more info](https://docs.topol.io/guide/callbacks.html#on-block-remove) |
100
- | `@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) |
101
- | `@onUndoChange` | When user clicks undo button, retunrs number of steps user undone [more info](https://docs.topol.io/guide/callbacks.html#on-undo-change) |
102
- | `@onRedoChange` | When user clicks redo button, retunrs number of steps user redone [more info](https://docs.topol.io/guide/callbacks.html#on-redo-change) |
103
- | `@onPreview` | When user switches to preview [more info](https://docs.topol.io/guide/callbacks.html#on-preview) |
104
- | `@onAlert` | When alert appears in editor [more info](https://docs.topol.io/guide/callbacks.html#on-alert) |
105
- | `@onClose` | When close is click inside WindowBar [more info](https://docs.topol.io/guide/top-bar.html#window-bar) |
106
- | `@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) |
107
- | `@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) |
108
- | `@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) |
109
- | `@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) |
110
- | `@onError` | When an error that cannot be handled happened in the editor [more info](https://docs.topol.io/guide/callbacks.html#onerror) |
89
+ ### List of all editor callbacks
90
+
91
+ | Event | Description |
92
+ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
93
+ | `onSave` | Returns object which contains html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-save) |
94
+ | `onSaveAndClose` | Returns object which contains html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-save-and-close) |
95
+ | `onTestSend` | Returns object which contains email, html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-test-email-send) |
96
+ | `onOpenFileManager` | When user clicks file manager open [more info](https://docs.topol.io/guide/custom-filemanager.html#onopenfilemanager) |
97
+ | `onLoaded` | After editor template is loaded using `TopolPlugin.load()` [more info](https://docs.topol.io/guide/callbacks.html#on-loaded) |
98
+ | `onInit` | When editor inits [more info](https://docs.topol.io/guide/callbacks.html#on-init) |
99
+ | `onBlockSave` | When user saves block in editor, returns object of type ISavedBlock [more info](https://docs.topol.io/guide/callbacks.html#on-block-save) |
100
+ | `onBlockRemove` | When user removes saved block, returns id of saved block to be removed [more info](https://docs.topol.io/guide/callbacks.html#on-block-remove) |
101
+ | `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) |
102
+ | `onUndoChange` | When user clicks undo button, retunrs number of steps user undone [more info](https://docs.topol.io/guide/callbacks.html#on-undo-change) |
103
+ | `onRedoChange` | When user clicks redo button, retunrs number of steps user redone [more info](https://docs.topol.io/guide/callbacks.html#on-redo-change) |
104
+ | `onPreview` | When user switches to preview [more info](https://docs.topol.io/guide/callbacks.html#on-preview) |
105
+ | `onAlert` | When alert appears in editor [more info](https://docs.topol.io/guide/callbacks.html#on-alert) |
106
+ | `onClose` | When close is click inside WindowBar [more info](https://docs.topol.io/guide/top-bar.html#window-bar) |
107
+ | `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) |
108
+ | `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) |
109
+ | `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) |
110
+ | `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) |
111
+ | `onError` | When an error that cannot be handled happened in the editor [more info](https://docs.topol.io/guide/callbacks.html#onerror) |
111
112
 
112
113
  <br>
113
114
 
@@ -1,45 +1,63 @@
1
- function r(e) {
1
+ function c(e) {
2
2
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3
3
  }
4
- var u = function(t, o, i) {
5
- var l = document.head || document.getElementsByTagName("head")[0], n = document.createElement("script");
4
+ var s = function(n, o, i) {
5
+ var l = document.head || document.getElementsByTagName("head")[0], t = document.createElement("script");
6
6
  typeof o == "function" && (i = o, o = {}), o = o || {}, i = i || function() {
7
- }, n.type = o.type || "text/javascript", n.charset = o.charset || "utf8", n.async = "async" in o ? !!o.async : !0, n.src = t, o.attrs && s(n, o.attrs), o.text && (n.text = "" + o.text);
8
- var d = "onload" in n ? a : c;
9
- d(n, i), n.onload || a(n, i), l.appendChild(n);
7
+ }, t.type = o.type || "text/javascript", t.charset = o.charset || "utf8", t.async = "async" in o ? !!o.async : !0, t.src = n, o.attrs && w(t, o.attrs), o.text && (t.text = "" + o.text);
8
+ var r = "onload" in t ? d : g;
9
+ r(t, i), t.onload || d(t, i), l.appendChild(t);
10
10
  };
11
- function s(e, t) {
12
- for (var o in t)
13
- e.setAttribute(o, t[o]);
11
+ function w(e, n) {
12
+ for (var o in n)
13
+ e.setAttribute(o, n[o]);
14
14
  }
15
- function a(e, t) {
15
+ function d(e, n) {
16
16
  e.onload = function() {
17
- this.onerror = this.onload = null, t(null, e);
17
+ this.onerror = this.onload = null, n(null, e);
18
18
  }, e.onerror = function() {
19
- this.onerror = this.onload = null, t(new Error("Failed to load " + this.src), e);
19
+ this.onerror = this.onload = null, n(new Error("Failed to load " + this.src), e);
20
20
  };
21
21
  }
22
- function c(e, t) {
22
+ function g(e, n) {
23
23
  e.onreadystatechange = function() {
24
- this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, t(null, e));
24
+ this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, n(null, e));
25
25
  };
26
26
  }
27
- const w = /* @__PURE__ */ r(u), g = "https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js", p = "https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js", T = "https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";
28
- function P(e = "production") {
27
+ const u = /* @__PURE__ */ c(s), a = "https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js", p = "https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js", f = "https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";
28
+ function T(e = "production") {
29
29
  switch (e) {
30
30
  case "dev":
31
31
  return p;
32
32
  case "staging":
33
- return T;
33
+ return f;
34
+ case "production":
35
+ return a;
34
36
  default:
35
- return g;
37
+ return `https://d10h8ga60f7b91.cloudfront.net/preview-app-${e}/loader/build.js`;
36
38
  }
37
39
  }
38
- const f = {
39
- init: (e, t) => new Promise((o, i) => {
40
- const l = P(t == null ? void 0 : t.stage);
41
- w(l, (n) => {
42
- n !== null && i(n), window.TopolPlugin.init(e), o(!0);
40
+ async function P(e) {
41
+ return new Promise((n, o) => {
42
+ u(a, (i) => {
43
+ i !== null && o(i), window.TopolPlugin.init(e), n(!0);
44
+ });
45
+ });
46
+ }
47
+ const h = {
48
+ init: (e, n) => new Promise((o, i) => {
49
+ const l = T(n == null ? void 0 : n.stage);
50
+ u(l, async (t) => {
51
+ if (t !== null) {
52
+ if (l !== a)
53
+ try {
54
+ return await P(e), o(!0);
55
+ } catch (r) {
56
+ i(r);
57
+ }
58
+ i(t);
59
+ }
60
+ window.TopolPlugin.init(e), o(!0);
43
61
  });
44
62
  }),
45
63
  save: () => {
@@ -107,5 +125,5 @@ const f = {
107
125
  }
108
126
  };
109
127
  export {
110
- f as default
128
+ h as default
111
129
  };
@@ -1 +1 @@
1
- (function(l,d){typeof exports=="object"&&typeof module<"u"?module.exports=d():typeof define=="function"&&define.amd?define(d):(l=typeof globalThis<"u"?globalThis:l||self,l["topol-plugin"]=d())})(this,function(){"use strict";function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d=function(t,o,i){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("script");typeof o=="function"&&(i=o,o={}),o=o||{},i=i||function(){},n.type=o.type||"text/javascript",n.charset=o.charset||"utf8",n.async="async"in o?!!o.async:!0,n.src=t,o.attrs&&u(n,o.attrs),o.text&&(n.text=""+o.text);var T="onload"in n?a:s;T(n,i),n.onload||a(n,i),r.appendChild(n)};function u(e,t){for(var o in t)e.setAttribute(o,t[o])}function a(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function s(e,t){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,e))}}const c=l(d),g="https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js",w="https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js",p="https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";function f(e="production"){switch(e){case"dev":return w;case"staging":return p;default:return g}}return{init:(e,t)=>new Promise((o,i)=>{const r=f(t==null?void 0:t.stage);c(r,n=>{n!==null&&i(n),window.TopolPlugin.init(e),o(!0)})}),save:()=>{window.TopolPlugin.save()},load:e=>{window.TopolPlugin.load(e)},togglePreview:()=>{window.TopolPlugin.togglePreview()},togglePreviewSize:()=>{window.TopolPlugin.togglePreviewSize()},chooseFile:e=>{window.TopolPlugin.chooseFile(e)},undo:()=>{window.TopolPlugin.undo()},redo:()=>{window.TopolPlugin.redo()},destroy:()=>{window.TopolPlugin.destroy()},setSavedBlocks:e=>{window.TopolPlugin.setSavedBlocks(e)},setPreviewHTML:e=>{window.TopolPlugin.setPreviewHTML(e)},createNotification:e=>{window.TopolPlugin.createNotification(e)},setActiveMembers:e=>{window.TopolPlugin.setActiveMembers(e)},changeEmailToMobile:()=>{window.TopolPlugin.changeEmailToMobile()},changeEmailToDesktop:()=>{window.TopolPlugin.changeEmailToDesktop()},toggleBlocksAndStructuresVisibility:()=>{window.TopolPlugin.toggleBlocksAndStructuresVisibility()},updateCustomBlockContent:e=>{window.TopolPlugin.updateCustomBlockContent(e)},refreshComments:e=>{window.TopolPlugin.refreshComments(e)},refreshSyncedRows:()=>{window.TopolPlugin.refreshSyncedRows()},openPremadeTemplatesSelection:()=>{window.TopolPlugin.openPremadeTemplatesSelection()},updateApiAuthorizationHeader:e=>{window.TopolPlugin.updateApiAuthorizationHeader(e)},setTemplateName:e=>{window.TopolPlugin.setTemplateName(e)}}});
1
+ (function(l,d){typeof exports=="object"&&typeof module<"u"?module.exports=d():typeof define=="function"&&define.amd?define(d):(l=typeof globalThis<"u"?globalThis:l||self,l["topol-plugin"]=d())})(this,function(){"use strict";function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d=function(n,o,i){var r=document.head||document.getElementsByTagName("head")[0],t=document.createElement("script");typeof o=="function"&&(i=o,o={}),o=o||{},i=i||function(){},t.type=o.type||"text/javascript",t.charset=o.charset||"utf8",t.async="async"in o?!!o.async:!0,t.src=n,o.attrs&&w(t,o.attrs),o.text&&(t.text=""+o.text);var a="onload"in t?s:g;a(t,i),t.onload||s(t,i),r.appendChild(t)};function w(e,n){for(var o in n)e.setAttribute(o,n[o])}function s(e,n){e.onload=function(){this.onerror=this.onload=null,n(null,e)},e.onerror=function(){this.onerror=this.onload=null,n(new Error("Failed to load "+this.src),e)}}function g(e,n){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,n(null,e))}}const c=l(d),u="https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js",p="https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js",f="https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";function T(e="production"){switch(e){case"dev":return p;case"staging":return f;case"production":return u;default:return`https://d10h8ga60f7b91.cloudfront.net/preview-app-${e}/loader/build.js`}}async function h(e){return new Promise((n,o)=>{c(u,i=>{i!==null&&o(i),window.TopolPlugin.init(e),n(!0)})})}return{init:(e,n)=>new Promise((o,i)=>{const r=T(n==null?void 0:n.stage);c(r,async t=>{if(t!==null){if(r!==u)try{return await h(e),o(!0)}catch(a){i(a)}i(t)}window.TopolPlugin.init(e),o(!0)})}),save:()=>{window.TopolPlugin.save()},load:e=>{window.TopolPlugin.load(e)},togglePreview:()=>{window.TopolPlugin.togglePreview()},togglePreviewSize:()=>{window.TopolPlugin.togglePreviewSize()},chooseFile:e=>{window.TopolPlugin.chooseFile(e)},undo:()=>{window.TopolPlugin.undo()},redo:()=>{window.TopolPlugin.redo()},destroy:()=>{window.TopolPlugin.destroy()},setSavedBlocks:e=>{window.TopolPlugin.setSavedBlocks(e)},setPreviewHTML:e=>{window.TopolPlugin.setPreviewHTML(e)},createNotification:e=>{window.TopolPlugin.createNotification(e)},setActiveMembers:e=>{window.TopolPlugin.setActiveMembers(e)},changeEmailToMobile:()=>{window.TopolPlugin.changeEmailToMobile()},changeEmailToDesktop:()=>{window.TopolPlugin.changeEmailToDesktop()},toggleBlocksAndStructuresVisibility:()=>{window.TopolPlugin.toggleBlocksAndStructuresVisibility()},updateCustomBlockContent:e=>{window.TopolPlugin.updateCustomBlockContent(e)},refreshComments:e=>{window.TopolPlugin.refreshComments(e)},refreshSyncedRows:()=>{window.TopolPlugin.refreshSyncedRows()},openPremadeTemplatesSelection:()=>{window.TopolPlugin.openPremadeTemplatesSelection()},updateApiAuthorizationHeader:e=>{window.TopolPlugin.updateApiAuthorizationHeader(e)},setTemplateName:e=>{window.TopolPlugin.setTemplateName(e)}}});
@@ -1,6 +1,8 @@
1
1
  import INotification from "./Notification/INotification";
2
2
  import ISavedBlock from "./SavedBlock/ISavedBlock";
3
3
  import ITopolOptions from "./ITopolOptions";
4
+ import IMergeTagGroup from "./MergeTag/IMergeTagGroup";
5
+ import IMergeTag from "./MergeTag/IMergeTag";
4
6
  export default interface ITopolPlugin {
5
7
  init: (topolOptions: ITopolOptions) => void;
6
8
  save: () => void;
@@ -24,4 +26,5 @@ export default interface ITopolPlugin {
24
26
  openPremadeTemplatesSelection: () => void;
25
27
  updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => void;
26
28
  setTemplateName: (name: string) => void;
29
+ setMergeTags: (mergeTags: Array<IMergeTagGroup | IMergeTag>) => void;
27
30
  }
@@ -1 +1 @@
1
- export type Stage = "dev" | "staging" | "production";
1
+ export type Stage = "dev" | "staging" | "production" | number;
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "author": "Topol.io",
13
13
  "homepage": "https://topol.io",
14
14
  "license": "Apache-2.0",
15
- "version": "0.1.0",
15
+ "version": "0.2.1",
16
16
  "files": [
17
17
  "dist"
18
18
  ],