@useinsider/guido 3.3.0-beta.64c7838 → 3.3.0-beta.7f3bdce

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.
@@ -9,14 +9,14 @@ class B {
9
9
  }
10
10
  migrate(e) {
11
11
  try {
12
- const t = this.parser.parseFromString(e, "text/html"), i = t.querySelectorAll("td.radio-button-block"), s = t.querySelectorAll("td.radio-button-v2");
13
- if (i.length === 0 && s.length === 0)
12
+ const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll("td.radio-button-block"), i = t.querySelectorAll("td.radio-button-v2");
13
+ if (s.length === 0 && i.length === 0)
14
14
  return e;
15
15
  let o = !1;
16
- return i.forEach((r) => {
16
+ return s.forEach((r) => {
17
17
  if (r.classList.contains("radio-button-v2"))
18
18
  return;
19
- const n = r.getAttribute("id"), a = this.extractTextFromElement(r, "ins-title"), g = this.extractTextFromElement(r, "ins-description"), c = this.extractTextFromElement(r, "ins-subscribe"), u = this.extractTextFromElement(r, "ins-unsubscribe"), d = this.buildTextBlock(a), p = this.buildTextBlock(g), y = this.buildTextBlock({ ...c, classList: "" }), f = this.buildTextBlock({ ...u, classList: "" }), h = S.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", p).replace("{-{-YES-}-}", y).replace("{-{-NO-}-}", f), m = this.parser.parseFromString(
19
+ const n = r.getAttribute("id"), a = this.extractTextFromElement(r, "ins-title"), g = this.extractTextFromElement(r, "ins-description"), c = this.extractTextFromElement(r, "ins-subscribe"), u = this.extractTextFromElement(r, "ins-unsubscribe"), p = this.buildTextBlock(a), d = this.buildTextBlock(g), y = this.buildTextBlock({ ...c, classList: "" }), f = this.buildTextBlock({ ...u, classList: "" }), h = S.replace("{-{-TITLE-}-}", p).replace("{-{-DESCRIPTION-}-}", d).replace("{-{-YES-}-}", y).replace("{-{-NO-}-}", f), m = this.parser.parseFromString(
20
20
  `<table id="tempDoc"><tbody><tr>${h}</tr></tbody></table>`,
21
21
  "text/html"
22
22
  ).querySelector(".radio-button-v2");
@@ -28,25 +28,26 @@ class B {
28
28
  }
29
29
  healRadioButtonV2(e) {
30
30
  let t = !1;
31
- return e.querySelectorAll("td.radio-button-v2").forEach((i) => {
32
- var p;
33
- const s = i.querySelector("input#radioYes"), o = i.querySelector("input#radioNo");
34
- if (!s || !o)
31
+ return e.querySelectorAll("td.radio-button-v2").forEach((s) => {
32
+ var d;
33
+ s.classList.contains("radio-button-block") || (s.classList.add("radio-button-block"), t = !0);
34
+ const i = s.querySelector("input#radioYes"), o = s.querySelector("input#radioNo");
35
+ if (!i || !o)
35
36
  return;
36
- const r = ((p = s.parentElement) == null ? void 0 : p.querySelector(":scope > p")) || null;
37
- if (!r && !s.hasAttribute("align"))
37
+ const r = ((d = i.parentElement) == null ? void 0 : d.querySelector(":scope > p")) || null;
38
+ if (!r && !i.hasAttribute("align"))
38
39
  return;
39
- const n = s.closest("tr"), a = o.closest("tr");
40
+ const n = i.closest("tr"), a = o.closest("tr");
40
41
  if (!n || !a || n === a || !n.parentNode)
41
42
  return;
42
- const g = (r == null ? void 0 : r.innerHTML.trim()) || "Yes", c = a.cloneNode(!0), u = c.querySelector("input#radioNo"), d = c.querySelector("p");
43
- u && (u.setAttribute("id", "radioYes"), u.removeAttribute("align")), d && (d.innerHTML = g), n.parentNode.replaceChild(c, n), t = !0;
43
+ const g = (r == null ? void 0 : r.innerHTML.trim()) || "Yes", c = a.cloneNode(!0), u = c.querySelector("input#radioNo"), p = c.querySelector("p");
44
+ u && (u.setAttribute("id", "radioYes"), u.removeAttribute("align")), p && (p.innerHTML = g), n.parentNode.replaceChild(c, n), t = !0;
44
45
  }), t;
45
46
  }
46
47
  extractTextFromElement(e, t) {
47
- var p, y;
48
- const i = e.querySelector(`.${t}`);
49
- if (!i)
48
+ var d, y;
49
+ const s = e.querySelector(`.${t}`);
50
+ if (!s)
50
51
  return {
51
52
  text: t === "ins-title" ? "Title" : "Description",
52
53
  isBold: !1,
@@ -55,42 +56,42 @@ class B {
55
56
  styles: "",
56
57
  classList: ""
57
58
  };
58
- const s = i.querySelector("p");
59
- if (!s)
59
+ const i = s.querySelector("p");
60
+ if (!i)
60
61
  return {
61
- text: ((p = i.textContent) == null ? void 0 : p.trim()) || (t === "ins-title" ? "Title" : "Description"),
62
+ text: ((d = s.textContent) == null ? void 0 : d.trim()) || (t === "ins-title" ? "Title" : "Description"),
62
63
  isBold: !1,
63
64
  isItalic: !1,
64
- align: i.getAttribute("align") || "left",
65
+ align: s.getAttribute("align") || "left",
65
66
  styles: "",
66
67
  classList: ""
67
68
  };
68
- const o = ((y = s.textContent) == null ? void 0 : y.trim()) || (t === "ins-title" ? "Title" : "Description"), r = s.getAttribute("style") || "", n = i.getAttribute("align") || s.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(r) || !!s.querySelector("b, strong"), g = /font-style\s*:\s*italic/i.test(r) || !!s.querySelector("i, em"), c = this.removeStyleProperties(r, ["font-weight", "font-style"]), u = this.convertInlineToBlock(c), d = i.getAttribute("class") || "";
69
+ const o = ((y = i.textContent) == null ? void 0 : y.trim()) || (t === "ins-title" ? "Title" : "Description"), r = i.getAttribute("style") || "", n = s.getAttribute("align") || i.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(r) || !!i.querySelector("b, strong"), g = /font-style\s*:\s*italic/i.test(r) || !!i.querySelector("i, em"), c = this.removeStyleProperties(r, ["font-weight", "font-style"]), u = this.convertInlineToBlock(c), p = s.getAttribute("class") || "";
69
70
  return {
70
71
  text: o,
71
72
  isBold: a,
72
73
  isItalic: g,
73
74
  align: n,
74
75
  styles: u,
75
- classList: d
76
+ classList: p
76
77
  };
77
78
  }
78
79
  buildTextBlock(e) {
79
80
  let t = e.text;
80
81
  e.isBold && e.isItalic ? t = `<strong path="1,0"><em path="1,0,0">${t}</em></strong>` : e.isBold ? t = `<strong path="1,0">${t}</strong>` : e.isItalic && (t = `<em path="1,0">${t}</em>`);
81
- const i = e.align ? ` align="${e.align}"` : "", s = e.styles ? ` style="${e.styles.replaceAll('"', "'")}"` : "";
82
+ const s = e.align ? ` align="${e.align}"` : "", i = e.styles ? ` style="${e.styles.replaceAll('"', "'")}"` : "";
82
83
  return `
83
- <td class="esd-block-text ${e.classList}" ${i}>
84
- <p path="1" ${s}>
84
+ <td class="esd-block-text ${e.classList}" ${s}>
85
+ <p path="1" ${i}>
85
86
  ${t}
86
87
  </p>
87
88
  </td>
88
89
  `;
89
90
  }
90
91
  removeStyleProperties(e, t) {
91
- return e ? t.reduce((s, o) => {
92
+ return e ? t.reduce((i, o) => {
92
93
  const r = new RegExp(`${o}\\s*:\\s*[^;]*;?`, "gi");
93
- return s.replace(r, "");
94
+ return i.replace(r, "");
94
95
  }, e).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
95
96
  }
96
97
  convertInlineToBlock(e) {
@@ -100,9 +101,9 @@ class B {
100
101
  return /display\s*:/i.test(t) || (t = t ? `${t}; display: block` : "display: block"), t.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
101
102
  }
102
103
  }
103
- function q(l) {
104
+ function L(l) {
104
105
  return new B().migrate(l);
105
106
  }
106
107
  export {
107
- q as migrateRadioButton
108
+ L as migrateRadioButton
108
109
  };
@@ -5,7 +5,7 @@ const e = {
5
5
  YES: "Yes",
6
6
  NO: "No"
7
7
  }, d = `
8
- <td align="left" class="radio-button radio-button-v2 esd-block-radio es-p10t es-p10b es-p30r es-p30l">
8
+ <td align="left" class="radio-button-block radio-button-v2 esd-block-radio es-p10t es-p10b es-p30r es-p30l">
9
9
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
10
10
  <tbody>
11
11
  <tr>
@@ -75,13 +75,13 @@ const e = {
75
75
  </tbody>
76
76
  </table>
77
77
  </td>
78
- `, a = `
78
+ `, l = `
79
79
  <td
80
80
  align="left"
81
81
  esd-extension-block-id="radio-button-block"
82
82
  esd-handler-name="esd-extension-RadioButtonBlock"
83
83
  class="
84
- radio-button
84
+ radio-button-block
85
85
  radio-button-v2
86
86
  esd-block-ra
87
87
  esd-radio-button-block
@@ -149,10 +149,10 @@ const e = {
149
149
  </table>
150
150
  </td>
151
151
  `;
152
- function l() {
152
+ function a() {
153
153
  return d.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`).replace("{-{-YES-}-}", `<p path="1">${e.YES}</p>`).replace("{-{-NO-}-}", `<p path="1">${e.NO}</p>`);
154
154
  }
155
155
  export {
156
- a as default,
157
- l as getDefaultTemplate
156
+ l as default,
157
+ a as getDefaultTemplate
158
158
  };
@@ -1,4 +1,4 @@
1
- declare const migrationTemplate = "\n <td\n align=\"left\"\n esd-extension-block-id=\"radio-button-block\"\n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"\n radio-button\n radio-button-v2\n esd-block-ra\n esd-radio-button-block\n esd-extension-block\n es-p10t\n es-p10b\n es-p30r\n es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-YES-}-}\n </tr>\n </table>\n </td>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioNo\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-NO-}-}\n </tr>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
1
+ declare const migrationTemplate = "\n <td\n align=\"left\"\n esd-extension-block-id=\"radio-button-block\"\n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"\n radio-button-block\n radio-button-v2\n esd-block-ra\n esd-radio-button-block\n esd-extension-block\n es-p10t\n es-p10b\n es-p30r\n es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-YES-}-}\n </tr>\n </table>\n </td>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioNo\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-NO-}-}\n </tr>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
2
2
  /**
3
3
  * @returns The template for the default checkbox block
4
4
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.3.0-beta.64c7838",
3
+ "version": "3.3.0-beta.7f3bdce",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",