@topol.io/editor 0.0.0 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,45 +1,45 @@
1
1
  function r(o) {
2
2
  return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
3
3
  }
4
- var u = function(t, e, l) {
5
- var i = document.head || document.getElementsByTagName("head")[0], n = document.createElement("script");
4
+ var u = function(n, e, l) {
5
+ var i = document.head || document.getElementsByTagName("head")[0], t = document.createElement("script");
6
6
  typeof e == "function" && (l = e, e = {}), e = e || {}, l = l || function() {
7
- }, n.type = e.type || "text/javascript", n.charset = e.charset || "utf8", n.async = "async" in e ? !!e.async : !0, n.src = t, e.attrs && c(n, e.attrs), e.text && (n.text = "" + e.text);
8
- var d = "onload" in n ? a : s;
9
- d(n, l), n.onload || a(n, l), i.appendChild(n);
7
+ }, t.type = e.type || "text/javascript", t.charset = e.charset || "utf8", t.async = "async" in e ? !!e.async : !0, t.src = n, e.attrs && c(t, e.attrs), e.text && (t.text = "" + e.text);
8
+ var d = "onload" in t ? a : s;
9
+ d(t, l), t.onload || a(t, l), i.appendChild(t);
10
10
  };
11
- function c(o, t) {
12
- for (var e in t)
13
- o.setAttribute(e, t[e]);
11
+ function c(o, n) {
12
+ for (var e in n)
13
+ o.setAttribute(e, n[e]);
14
14
  }
15
- function a(o, t) {
15
+ function a(o, n) {
16
16
  o.onload = function() {
17
- this.onerror = this.onload = null, t(null, o);
17
+ this.onerror = this.onload = null, n(null, o);
18
18
  }, o.onerror = function() {
19
- this.onerror = this.onload = null, t(new Error("Failed to load " + this.src), o);
19
+ this.onerror = this.onload = null, n(new Error("Failed to load " + this.src), o);
20
20
  };
21
21
  }
22
- function s(o, t) {
22
+ function s(o, n) {
23
23
  o.onreadystatechange = function() {
24
- this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, t(null, o));
24
+ this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, n(null, o));
25
25
  };
26
26
  }
27
- const g = /* @__PURE__ */ r(u), w = "https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js", f = "https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js", h = "https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";
28
- function T(o = "production") {
27
+ const g = /* @__PURE__ */ r(u), w = "https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js", f = "https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js", T = "https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";
28
+ function P(o = "production") {
29
29
  switch (o) {
30
30
  case "dev":
31
31
  return f;
32
32
  case "staging":
33
- return h;
33
+ return T;
34
34
  default:
35
35
  return w;
36
36
  }
37
37
  }
38
- const P = {
39
- init: (o, t) => new Promise((e, l) => {
40
- const i = T(t == null ? void 0 : t.stage);
41
- g(i, (n) => {
42
- n !== null && l(n), window.TopolPlugin.init(o), e(!0);
38
+ const p = {
39
+ init: (o, n) => new Promise((e, l) => {
40
+ const i = P(n == null ? void 0 : n.stage);
41
+ g(i, (t) => {
42
+ t !== null && l(t), window.TopolPlugin.init(o), e(!0);
43
43
  });
44
44
  }),
45
45
  save: () => {
@@ -80,8 +80,17 @@ const P = {
80
80
  },
81
81
  destroy: () => {
82
82
  window.TopolPlugin.destroy();
83
+ },
84
+ setPreviewHTML: (o) => {
85
+ window.TopolPlugin.setPreviewHTML(o);
86
+ },
87
+ setActiveMembers: (o) => {
88
+ window.TopolPlugin.setActiveMembers(o);
89
+ },
90
+ updateCustomBlockContent: (o) => {
91
+ window.TopolPlugin.updateCustomBlockContent(o);
83
92
  }
84
93
  };
85
94
  export {
86
- P as default
95
+ p as default
87
96
  };
@@ -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(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var d=function(t,e,i){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("script");typeof e=="function"&&(i=e,e={}),e=e||{},i=i||function(){},n.type=e.type||"text/javascript",n.charset=e.charset||"utf8",n.async="async"in e?!!e.async:!0,n.src=t,e.attrs&&u(n,e.attrs),e.text&&(n.text=""+e.text);var h="onload"in n?a:c;h(n,i),n.onload||a(n,i),r.appendChild(n)};function u(o,t){for(var e in t)o.setAttribute(e,t[e])}function a(o,t){o.onload=function(){this.onerror=this.onload=null,t(null,o)},o.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),o)}}function c(o,t){o.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,o))}}const s=l(d),g="https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js",f="https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js",w="https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";function p(o="production"){switch(o){case"dev":return f;case"staging":return w;default:return g}}return{init:(o,t)=>new Promise((e,i)=>{const r=p(t==null?void 0:t.stage);s(r,n=>{n!==null&&i(n),window.TopolPlugin.init(o),e(!0)})}),save:()=>{window.TopolPlugin.save()},load:o=>{window.TopolPlugin.load(o)},togglePreview:()=>{window.TopolPlugin.togglePreview()},togglePreviewSize:()=>{window.TopolPlugin.togglePreviewSize()},chooseFile:o=>{window.TopolPlugin.chooseFile(o)},undo:()=>{window.TopolPlugin.undo()},redo:()=>{window.TopolPlugin.redo()},setSavedBlocks:o=>{window.TopolPlugin.setSavedBlocks(o)},createNotification:o=>{window.TopolPlugin.createNotification(o)},changeEmailToMobile:()=>{window.TopolPlugin.changeEmailToMobile()},changeEmailToDesktop:()=>{window.TopolPlugin.changeEmailToDesktop()},toggleBlocksAndStructuresVisibility:()=>{window.TopolPlugin.toggleBlocksAndStructuresVisibility()},destroy:()=>{window.TopolPlugin.destroy()}}});
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 u=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&&a(n,o.attrs),o.text&&(n.text=""+o.text);var T="onload"in n?r:c;T(n,i),n.onload||r(n,i),u.appendChild(n)};function a(e,t){for(var o in t)e.setAttribute(o,t[o])}function r(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 c(e,t){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,e))}}const s=l(d),g="https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js",w="https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js",f="https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";function p(e="production"){switch(e){case"dev":return w;case"staging":return f;default:return g}}return{init:(e,t)=>new Promise((o,i)=>{const u=p(t==null?void 0:t.stage);s(u,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()},setSavedBlocks:e=>{window.TopolPlugin.setSavedBlocks(e)},createNotification:e=>{window.TopolPlugin.createNotification(e)},changeEmailToMobile:()=>{window.TopolPlugin.changeEmailToMobile()},changeEmailToDesktop:()=>{window.TopolPlugin.changeEmailToDesktop()},toggleBlocksAndStructuresVisibility:()=>{window.TopolPlugin.toggleBlocksAndStructuresVisibility()},destroy:()=>{window.TopolPlugin.destroy()},setPreviewHTML:e=>{window.TopolPlugin.setPreviewHTML(e)},setActiveMembers:e=>{window.TopolPlugin.setActiveMembers(e)},updateCustomBlockContent:e=>{window.TopolPlugin.updateCustomBlockContent(e)}}});
@@ -34,6 +34,9 @@ declare const TopolPlugin: {
34
34
  changeEmailToDesktop: () => void;
35
35
  toggleBlocksAndStructuresVisibility: () => void;
36
36
  destroy: () => void;
37
+ setPreviewHTML: (html: unknown) => void;
38
+ setActiveMembers: (activeMemers: string[]) => void;
39
+ updateCustomBlockContent: (content: string) => void;
37
40
  };
38
41
  export default TopolPlugin;
39
42
  export type { ITopolOptions, INotification, ISavedBlock, IMergeTagGroup, IMergeTag, IContentBlockOptions, ITheme, IAuthHeaderConfig, IFont, IAPI, ICustomBlockData, Stage as IStage };
@@ -50,6 +50,7 @@ export default interface ITopolOptions {
50
50
  onAlert?(notification: INotification): void;
51
51
  onClose?(): void;
52
52
  onEdittedWithoutSaveChanged?(hasUnsavedChanges: boolean): void;
53
+ onOpenCustomBlockDialog?(customBLock: unknown): void;
53
54
  };
54
55
  api?: IAPI;
55
56
  mobileFirstEnabled?: boolean;
package/package.json CHANGED
@@ -12,10 +12,11 @@
12
12
  "author": "Topol.io",
13
13
  "homepage": "https://topol.io",
14
14
  "license": "Apache-2.0",
15
- "version": "0.0.0",
15
+ "version": "0.0.2",
16
16
  "files": [
17
17
  "dist"
18
18
  ],
19
+ "type": "module",
19
20
  "module": "./dist/topol-plugin.es.js",
20
21
  "types": "./dist/types/src/main.d.ts",
21
22
  "exports": {
@@ -31,9 +32,9 @@
31
32
  "@typescript-eslint/parser": "^6.7.2",
32
33
  "eslint": "^8.50.0",
33
34
  "eslint-config-prettier": "^9.0.0",
34
- "prettier": "3.0.3",
35
+ "prettier": "3.1.1",
35
36
  "typescript": "^5.2.2",
36
- "vite": "^4.4.9"
37
+ "vite": "^5.0.11"
37
38
  },
38
39
  "dependencies": {
39
40
  "load-script": "^2.0.0"
@@ -42,8 +43,8 @@
42
43
  "access": "public"
43
44
  },
44
45
  "scripts": {
45
- "dev": "vite build --watch",
46
- "build": "vite build && yarn run build:types",
46
+ "build-watch": "vite build --watch",
47
+ "build-with-types": "vite build && pnpm run build:types",
47
48
  "lint": "eslint --config '.eslintrc.js' ./**/*.ts --fix",
48
49
  "format": "prettier --write .",
49
50
  "build:types": "tsc -p tsconfig.prod.json"