fable-editor 1.2.4 → 1.2.5

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.
@@ -48,17 +48,17 @@ function je() {
48
48
  {
49
49
  for (var f = arguments.length, v = new Array(f > 1 ? f - 1 : 0), T = 1; T < f; T++)
50
50
  v[T - 1] = arguments[T];
51
- A("error", a, v);
51
+ I("error", a, v);
52
52
  }
53
53
  }
54
- function A(a, f, v) {
54
+ function I(a, f, v) {
55
55
  {
56
56
  var T = w.ReactDebugCurrentFrame, L = T.getStackAddendum();
57
57
  L !== "" && (f += "%s", v = v.concat([L]));
58
- var I = v.map(function(M) {
58
+ var A = v.map(function(M) {
59
59
  return String(M);
60
60
  });
61
- I.unshift("Warning: " + f), Function.prototype.apply.call(console[a], console, I);
61
+ A.unshift("Warning: " + f), Function.prototype.apply.call(console[a], console, A);
62
62
  }
63
63
  }
64
64
  var H = !1, $ = !1, O = !1, _ = !1, et = !1, Mt;
@@ -115,9 +115,9 @@ function je() {
115
115
  var T = a.displayName || null;
116
116
  return T !== null ? T : W(a.type) || "Memo";
117
117
  case m: {
118
- var L = a, I = L._payload, M = L._init;
118
+ var L = a, A = L._payload, M = L._init;
119
119
  try {
120
- return W(M(I));
120
+ return W(M(A));
121
121
  } catch {
122
122
  return null;
123
123
  }
@@ -125,14 +125,14 @@ function je() {
125
125
  }
126
126
  return null;
127
127
  }
128
- var V = Object.assign, G = 0, Lt, Ht, It, At, qt, Rt, Pt;
128
+ var V = Object.assign, G = 0, Lt, Ht, At, It, qt, Rt, Pt;
129
129
  function Bt() {
130
130
  }
131
131
  Bt.__reactDisabledLog = !0;
132
132
  function pe() {
133
133
  {
134
134
  if (G === 0) {
135
- Lt = console.log, Ht = console.info, It = console.warn, At = console.error, qt = console.group, Rt = console.groupCollapsed, Pt = console.groupEnd;
135
+ Lt = console.log, Ht = console.info, At = console.warn, It = console.error, qt = console.group, Rt = console.groupCollapsed, Pt = console.groupEnd;
136
136
  var a = {
137
137
  configurable: !0,
138
138
  enumerable: !0,
@@ -168,10 +168,10 @@ function je() {
168
168
  value: Ht
169
169
  }),
170
170
  warn: V({}, a, {
171
- value: It
171
+ value: At
172
172
  }),
173
173
  error: V({}, a, {
174
- value: At
174
+ value: It
175
175
  }),
176
176
  group: V({}, a, {
177
177
  value: qt
@@ -218,8 +218,8 @@ function je() {
218
218
  ft = !0;
219
219
  var L = Error.prepareStackTrace;
220
220
  Error.prepareStackTrace = void 0;
221
- var I;
222
- I = pt.current, pt.current = null, pe();
221
+ var A;
222
+ A = pt.current, pt.current = null, pe();
223
223
  try {
224
224
  if (f) {
225
225
  var M = function() {
@@ -272,7 +272,7 @@ function je() {
272
272
  }
273
273
  }
274
274
  } finally {
275
- ft = !1, pt.current = I, me(), Error.prepareStackTrace = L;
275
+ ft = !1, pt.current = A, me(), Error.prepareStackTrace = L;
276
276
  }
277
277
  var Q = a ? a.displayName || a.name : "", U = Q ? it(Q) : "";
278
278
  return typeof a == "function" && st.set(a, U), U;
@@ -304,9 +304,9 @@ function je() {
304
304
  case u:
305
305
  return nt(a.type, f, v);
306
306
  case m: {
307
- var T = a, L = T._payload, I = T._init;
307
+ var T = a, L = T._payload, A = T._init;
308
308
  try {
309
- return nt(I(L), f, v);
309
+ return nt(A(L), f, v);
310
310
  } catch {
311
311
  }
312
312
  }
@@ -323,9 +323,9 @@ function je() {
323
323
  }
324
324
  function be(a, f, v, T, L) {
325
325
  {
326
- var I = Function.call.bind(K);
326
+ var A = Function.call.bind(K);
327
327
  for (var M in a)
328
- if (I(a, M)) {
328
+ if (A(a, M)) {
329
329
  var S = void 0;
330
330
  try {
331
331
  if (typeof a[M] != "function") {
@@ -411,7 +411,7 @@ function je() {
411
411
  });
412
412
  }
413
413
  }
414
- var Le = function(a, f, v, T, L, I, M) {
414
+ var Le = function(a, f, v, T, L, A, M) {
415
415
  var S = {
416
416
  // This tag allows us to uniquely identify this as a React Element
417
417
  $$typeof: t,
@@ -421,7 +421,7 @@ function je() {
421
421
  ref: v,
422
422
  props: M,
423
423
  // Record the component responsible for creating this element.
424
- _owner: I
424
+ _owner: A
425
425
  };
426
426
  return S._store = {}, Object.defineProperty(S._store, "validated", {
427
427
  configurable: !1,
@@ -442,14 +442,14 @@ function je() {
442
442
  };
443
443
  function He(a, f, v, T, L) {
444
444
  {
445
- var I, M = {}, S = null, N = null;
445
+ var A, M = {}, S = null, N = null;
446
446
  v !== void 0 && (_t(v), S = "" + v), Ee(f) && (_t(f.key), S = "" + f.key), Te(f) && (N = f.ref, Se(f, L));
447
- for (I in f)
448
- K.call(f, I) && !we.hasOwnProperty(I) && (M[I] = f[I]);
447
+ for (A in f)
448
+ K.call(f, A) && !we.hasOwnProperty(A) && (M[A] = f[A]);
449
449
  if (a && a.defaultProps) {
450
450
  var R = a.defaultProps;
451
- for (I in R)
452
- M[I] === void 0 && (M[I] = R[I]);
451
+ for (A in R)
452
+ M[A] === void 0 && (M[A] = R[A]);
453
453
  }
454
454
  if (S || N) {
455
455
  var P = typeof a == "function" ? a.displayName || a.name || "Unknown" : a;
@@ -483,11 +483,11 @@ Check the render method of \`` + a + "`.";
483
483
  return "";
484
484
  }
485
485
  }
486
- function Ie(a) {
486
+ function Ae(a) {
487
487
  return "";
488
488
  }
489
489
  var Ut = {};
490
- function Ae(a) {
490
+ function Ie(a) {
491
491
  {
492
492
  var f = Vt();
493
493
  if (!f) {
@@ -504,7 +504,7 @@ Check the top-level render call using <` + v + ">.");
504
504
  if (!a._store || a._store.validated || a.key != null)
505
505
  return;
506
506
  a._store.validated = !0;
507
- var v = Ae(f);
507
+ var v = Ie(f);
508
508
  if (Ut[v])
509
509
  return;
510
510
  Ut[v] = !0;
@@ -526,7 +526,7 @@ Check the top-level render call using <` + v + ">.");
526
526
  else if (a) {
527
527
  var L = x(a);
528
528
  if (typeof L == "function" && L !== a.entries)
529
- for (var I = L.call(a), M; !(M = I.next()).done; )
529
+ for (var A = L.call(a), M; !(M = A.next()).done; )
530
530
  yt(M.value) && zt(M.value, f);
531
531
  }
532
532
  }
@@ -569,18 +569,18 @@ Check the top-level render call using <` + v + ">.");
569
569
  }
570
570
  }
571
571
  var Yt = {};
572
- function Qt(a, f, v, T, L, I) {
572
+ function Qt(a, f, v, T, L, A) {
573
573
  {
574
574
  var M = de(a);
575
575
  if (!M) {
576
576
  var S = "";
577
577
  (a === void 0 || typeof a == "object" && a !== null && Object.keys(a).length === 0) && (S += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
578
- var N = Ie();
578
+ var N = Ae();
579
579
  N ? S += N : S += Vt();
580
580
  var R;
581
581
  a === null ? R = "null" : gt(a) ? R = "array" : a !== void 0 && a.$$typeof === t ? (R = "<" + (W(a.type) || "Unknown") + " />", S = " Did you accidentally export a JSX literal instead of a component?") : R = typeof a, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, S);
582
582
  }
583
- var P = He(a, f, v, L, I);
583
+ var P = He(a, f, v, L, A);
584
584
  if (P == null)
585
585
  return P;
586
586
  if (M) {
@@ -2516,10 +2516,10 @@ function oi(p) {
2516
2516
  }), e.forEach((s) => {
2517
2517
  const n = [], l = s[0];
2518
2518
  s.forEach((r) => {
2519
- var w, E, A;
2519
+ var w, E, I;
2520
2520
  const c = +(((w = (r.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : w[1]) || 1), d = Array.from(r.querySelectorAll("span")).find(
2521
2521
  (H) => /mso-list\s*:\s*ignore/i.test(H.getAttribute("style") || "")
2522
- ), u = d ? ((E = d.textContent) == null ? void 0 : E.trim()) || "" : (((A = r.textContent) == null ? void 0 : A.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: m, style: b } = li(u);
2522
+ ), u = d ? ((E = d.textContent) == null ? void 0 : E.trim()) || "" : (((I = r.textContent) == null ? void 0 : I.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: m, style: b } = li(u);
2523
2523
  for (d && d.remove(); n.length && n[n.length - 1].level > c; ) n.pop();
2524
2524
  if (!n.length || n[n.length - 1].level < c) {
2525
2525
  const H = p.createElement(m ? "ol" : "ul");
@@ -2887,10 +2887,10 @@ async function bi(p) {
2887
2887
  for (const [y, g] of c) {
2888
2888
  const x = g.startsWith("/") ? g.slice(1) : "word/" + g.replace(/^\.\//, ""), w = e.get(x);
2889
2889
  if (!w) continue;
2890
- const E = (x.split(".").pop() || "").toLowerCase(), A = fi[E];
2891
- if (A)
2890
+ const E = (x.split(".").pop() || "").toLowerCase(), I = fi[E];
2891
+ if (I)
2892
2892
  try {
2893
- u.set(y, `data:${A};base64,${gi(await le(t, w))}`);
2893
+ u.set(y, `data:${I};base64,${gi(await le(t, w))}`);
2894
2894
  } catch {
2895
2895
  }
2896
2896
  }
@@ -2899,8 +2899,8 @@ async function bi(p) {
2899
2899
  const y = /* @__PURE__ */ new Map(), g = Array.from(b.getElementsByTagName("*"));
2900
2900
  for (const x of g) {
2901
2901
  if (x.localName !== "abstractNum") continue;
2902
- const w = q(x, "abstractNumId"), E = dt(x, "lvl").find((H) => q(H, "ilvl") === "0") || dt(x, "lvl")[0], A = E ? q(B(E, "numFmt")) : "";
2903
- y.set(w, A === "bullet" ? "ul" : "ol");
2902
+ const w = q(x, "abstractNumId"), E = dt(x, "lvl").find((H) => q(H, "ilvl") === "0") || dt(x, "lvl")[0], I = E ? q(B(E, "numFmt")) : "";
2903
+ y.set(w, I === "bullet" ? "ul" : "ol");
2904
2904
  }
2905
2905
  for (const x of g) {
2906
2906
  if (x.localName !== "num") continue;
@@ -3148,6 +3148,32 @@ let Ei = (j = class {
3148
3148
  getContent() {
3149
3149
  return this.ed.innerHTML;
3150
3150
  }
3151
+ /** Same HTML as getContent(), wrapped so its RTL/LTR direction survives being
3152
+ * dropped into a fixed-alignment host (e.g. an email template's
3153
+ * `<td align="left">`), which otherwise forces left alignment onto any
3154
+ * descendant that has no `text-align` of its own — even one with its own
3155
+ * dir="rtl". Elements that already carry their own dir (preserved as-is by
3156
+ * the paste engine) each get their own matching text-align only if they
3157
+ * don't already have one, so mixed-direction content and any alignment the
3158
+ * user explicitly set are left untouched. */
3159
+ getContentForEmail() {
3160
+ const t = (l, r) => {
3161
+ const o = (l.getAttribute("style") || "").trim();
3162
+ l.setAttribute("style", o ? o.replace(/;?$/, "; ") + r : r);
3163
+ }, e = document.createElement("div");
3164
+ e.innerHTML = this.ed.innerHTML;
3165
+ let i = null;
3166
+ e.querySelectorAll("[dir]").forEach((l) => {
3167
+ const r = (l.getAttribute("dir") || "").toLowerCase();
3168
+ if (r !== "rtl" && r !== "ltr") return;
3169
+ const o = r;
3170
+ i || (i = o), /text-align\s*:/i.test(l.getAttribute("style") || "") || t(l, `text-align:${o === "rtl" ? "right" : "left"}`);
3171
+ });
3172
+ const s = i || this.ed.getAttribute("dir") || this.dir();
3173
+ return e.querySelectorAll("table:not([dir])").forEach((l) => {
3174
+ l.setAttribute("dir", s), /direction\s*:/i.test(l.getAttribute("style") || "") || t(l, `direction:${s}`);
3175
+ }), `<div dir="${s}" style="direction:${s};text-align:${s === "rtl" ? "right" : "left"}">${e.innerHTML}</div>`;
3176
+ }
3151
3177
  setContent(t) {
3152
3178
  this.ed.innerHTML = t || "<p><br></p>", this.refreshState(), this.clearTableHandles(), this.clearImageHandles(), this.clearImgPlaceholderSel(), this.clearTplSel(), this.clearVphPlaceholderSel(), this.clearVidHandles(), this.clearCodeSel(), this.clearSelToolbar(), this.onChange();
3153
3179
  }
@@ -4066,13 +4092,13 @@ let Ei = (j = class {
4066
4092
  this.dialog(
4067
4093
  this.t("tablepropsttl"),
4068
4094
  (E) => {
4069
- const A = (H, $) => {
4095
+ const I = (H, $) => {
4070
4096
  const O = document.createElement("div");
4071
4097
  O.style.cssText = r;
4072
4098
  const _ = document.createElement("span");
4073
4099
  _.style.cssText = o, _.textContent = this.t(H), O.append(_, $), E.appendChild(O);
4074
4100
  };
4075
- e = document.createElement("input"), e.type = "text", e.style.cssText = c, e.placeholder = "e.g. 600px or 100%", e.value = u, A("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = c, i.value = String(m), A("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = c, s.value = String(b), A("tblcellspacing", s), n = document.createElement("input"), n.type = "number", n.min = "0", n.style.cssText = c, n.value = String(y), A("tblborder", n), l = document.createElement("select"), l.style.cssText = c, [
4101
+ e = document.createElement("input"), e.type = "text", e.style.cssText = c, e.placeholder = "e.g. 600px or 100%", e.value = u, I("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = c, i.value = String(m), I("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = c, s.value = String(b), I("tblcellspacing", s), n = document.createElement("input"), n.type = "number", n.min = "0", n.style.cssText = c, n.value = String(y), I("tblborder", n), l = document.createElement("select"), l.style.cssText = c, [
4076
4102
  ["", "alignnone"],
4077
4103
  ["left", "alignleft"],
4078
4104
  ["center", "aligncenter"],
@@ -4080,7 +4106,7 @@ let Ei = (j = class {
4080
4106
  ].forEach(([H, $]) => {
4081
4107
  const O = document.createElement("option");
4082
4108
  O.value = H, O.textContent = this.t($), H === w && (O.selected = !0), l.appendChild(O);
4083
- }), A("tblalign", l);
4109
+ }), I("tblalign", l);
4084
4110
  },
4085
4111
  [
4086
4112
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4652,8 +4678,8 @@ let Ei = (j = class {
4652
4678
  w.type = "button", w.textContent = this.t(g);
4653
4679
  const E = document.createElement("div");
4654
4680
  E.className = "dtabpanel", x(E);
4655
- const A = u.length;
4656
- u.push(E), w.addEventListener("click", () => b(A)), d.appendChild(w);
4681
+ const I = u.length;
4682
+ u.push(E), w.addEventListener("click", () => b(I)), d.appendChild(w);
4657
4683
  }, b = (g) => {
4658
4684
  d.querySelectorAll("button").forEach((x, w) => x.classList.toggle("on", w === g)), u.forEach((x, w) => x.style.display = w === g ? "" : "none");
4659
4685
  };
@@ -4684,8 +4710,8 @@ let Ei = (j = class {
4684
4710
  _.onload = () => $(_.result), _.readAsDataURL(H);
4685
4711
  }
4686
4712
  }), x.append(t, w, E), t.style.flex = "1", g.appendChild(r("vidsource", x));
4687
- const A = document.createElement("div");
4688
- A.className = "drow", e = document.createElement("input"), e.type = "number", e.value = "560", i = document.createElement("input"), i.type = "number", i.value = "314", A.append(r("tblwidth", e), r("tblheight", i)), g.appendChild(A);
4713
+ const I = document.createElement("div");
4714
+ I.className = "drow", e = document.createElement("input"), e.type = "number", e.value = "560", i = document.createElement("input"), i.type = "number", i.value = "314", I.append(r("tblwidth", e), r("tblheight", i)), g.appendChild(I);
4689
4715
  }), m("vidembed", (g) => {
4690
4716
  const x = document.createElement("p");
4691
4717
  x.textContent = this.t("vidembedhint"), x.style.cssText = "margin:0 0 8px;color:#556;font-size:13.5px", s = document.createElement("textarea"), s.style.cssText = "width:100%;box-sizing:border-box;height:160px", g.append(x, s);
@@ -5378,6 +5404,10 @@ const Si = _e(
5378
5404
  var g;
5379
5405
  return ((g = c.current) == null ? void 0 : g.getContent()) ?? "";
5380
5406
  },
5407
+ getContentForEmail: () => {
5408
+ var g;
5409
+ return ((g = c.current) == null ? void 0 : g.getContentForEmail()) ?? "";
5410
+ },
5381
5411
  setContent: (g) => {
5382
5412
  var x;
5383
5413
  return (x = c.current) == null ? void 0 : x.setContent(g);
@@ -5449,8 +5479,8 @@ const Si = _e(
5449
5479
  if (m.current === null) return;
5450
5480
  const E = w.relatedTarget;
5451
5481
  if (E && g.contains(E)) return;
5452
- const A = m.current;
5453
- m.current = null, u.current = A, (H = c.current) == null || H.setContent(A);
5482
+ const I = m.current;
5483
+ m.current = null, u.current = I, (H = c.current) == null || H.setContent(I);
5454
5484
  };
5455
5485
  return g.addEventListener("focusout", x), () => g.removeEventListener("focusout", x);
5456
5486
  }, []), ot(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fable-editor",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "FableEditor — a rich text editor with React and Angular wrappers",
5
5
  "author": "Sajin Satheesan <an.sajinsatheesan@gmail.com>",
6
6
  "repository": {