ct-rich-text-editor 1.2.2 → 1.2.4

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,20 +1,22 @@
1
- import { u as Y, L as J, c as le, j as ce, a, b as Ce, d as be, $ as H, R as he, C as xe, e as Ee, O as Ie, H as Re, f as De, i as ve } from "./index-7dc03909.js";
2
- import { CodeNode as Oe } from "@lexical/code";
3
- import { LinkNode as we } from "@lexical/link";
4
- import { useEffect as z, createContext as ue, useContext as W, useRef as T, useMemo as me, useState as K, useCallback as L, Suspense as Me } from "react";
5
- import { calculateZoomLevel as Z, mergeRegister as Se } from "@lexical/utils";
6
- import { $getSelection as $, $isNodeSelection as X, $setSelection as Q, $isRangeSelection as Pe, SELECTION_CHANGE_COMMAND as _e, COMMAND_PRIORITY_LOW as A, CLICK_COMMAND as ye, DRAGSTART_COMMAND as Ve, KEY_DELETE_COMMAND as Ae, KEY_BACKSPACE_COMMAND as Te, KEY_ENTER_COMMAND as ze, KEY_ESCAPE_COMMAND as je, RootNode as ke, TextNode as Le, LineBreakNode as Xe, ParagraphNode as Ue, createCommand as $e, $getNodeByKey as ee } from "lexical";
1
+ import { jsxDEV as l, Fragment as Ce } from "react/jsx-dev-runtime";
2
+ import { CodeNode as be } from "@lexical/code";
3
+ import { LinkNode as he } from "@lexical/link";
4
+ import { u as Y, L as W, c as le, a as Ie, b as Re, $ as j, R as xe, C as ve, d as Oe, O as Ee, H as we, e as Me, i as Se } from "./index-bd25a91b.js";
5
+ import { useEffect as k, createContext as ce, useContext as H, useRef as z, useMemo as ue, useState as K, useCallback as V, Suspense as De } from "react";
6
+ import { jsx as me } from "react/jsx-runtime";
7
+ import { calculateZoomLevel as Z, mergeRegister as Pe } from "@lexical/utils";
8
+ import { $getSelection as J, $isNodeSelection as U, $setSelection as Q, $isRangeSelection as _e, SELECTION_CHANGE_COMMAND as ye, COMMAND_PRIORITY_LOW as T, CLICK_COMMAND as Ae, DRAGSTART_COMMAND as Te, KEY_DELETE_COMMAND as ze, KEY_BACKSPACE_COMMAND as ke, KEY_ENTER_COMMAND as Le, KEY_ESCAPE_COMMAND as Xe, RootNode as Ve, TextNode as Ue, LineBreakNode as $e, ParagraphNode as Je, createCommand as We, $getNodeByKey as ee } from "lexical";
7
9
  import "axios";
8
10
  import "@emotion/styled";
9
11
  import "react-dom";
10
12
  import "@lexical/table";
11
13
  import "@emotion/react";
12
14
  import "emoji-picker-react";
13
- function Je({
15
+ function He({
14
16
  defaultSelection: e
15
17
  }) {
16
18
  const [r] = Y();
17
- return z(() => {
19
+ return k(() => {
18
20
  r.focus(() => {
19
21
  const o = document.activeElement, N = r.getRootElement();
20
22
  N !== null && (o === null || !N.contains(o)) && N.focus({
@@ -25,86 +27,86 @@ function Je({
25
27
  });
26
28
  }, [e, r]), null;
27
29
  }
28
- const We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
30
+ const je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
29
31
  __proto__: null,
30
- AutoFocusPlugin: Je
32
+ AutoFocusPlugin: He
31
33
  }, Symbol.toStringTag, { value: "Module" }));
32
- function He({ defaultSelection: e }) {
34
+ function Ke({ defaultSelection: e }) {
33
35
  const [r] = Y();
34
- return z(() => {
36
+ return k(() => {
35
37
  r.focus(() => {
36
38
  const o = document.activeElement, N = r.getRootElement();
37
39
  N === null || o !== null && N.contains(o) || N.focus({ preventScroll: !0 });
38
40
  }, { defaultSelection: e });
39
41
  }, [e, r]), null;
40
42
  }
41
- const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
43
+ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
42
44
  __proto__: null,
43
- AutoFocusPlugin: He
44
- }, Symbol.toStringTag, { value: "Module" })), Fe = process.env.NODE_ENV !== "production" ? We : Ke, Be = Fe.AutoFocusPlugin, te = [["Cat", "rgb(125, 50, 0)"], ["Dog", "rgb(100, 0, 0)"], ["Rabbit", "rgb(150, 0, 0)"], ["Frog", "rgb(200, 0, 0)"], ["Fox", "rgb(200, 75, 0)"], ["Hedgehog", "rgb(0, 75, 0)"], ["Pigeon", "rgb(0, 125, 0)"], ["Squirrel", "rgb(75, 100, 0)"], ["Bear", "rgb(125, 100, 0)"], ["Tiger", "rgb(0, 0, 150)"], ["Leopard", "rgb(0, 0, 200)"], ["Zebra", "rgb(0, 0, 250)"], ["Wolf", "rgb(0, 100, 150)"], ["Owl", "rgb(0, 100, 100)"], ["Gull", "rgb(100, 0, 100)"], ["Squid", "rgb(150, 0, 150)"]], oe = te[Math.floor(Math.random() * te.length)], de = /* @__PURE__ */ ue({
45
+ AutoFocusPlugin: Ke
46
+ }, Symbol.toStringTag, { value: "Module" })), Be = process.env.NODE_ENV !== "production" ? je : Fe, Ye = Be.AutoFocusPlugin, te = [["Cat", "rgb(125, 50, 0)"], ["Dog", "rgb(100, 0, 0)"], ["Rabbit", "rgb(150, 0, 0)"], ["Frog", "rgb(200, 0, 0)"], ["Fox", "rgb(200, 75, 0)"], ["Hedgehog", "rgb(0, 75, 0)"], ["Pigeon", "rgb(0, 125, 0)"], ["Squirrel", "rgb(75, 100, 0)"], ["Bear", "rgb(125, 100, 0)"], ["Tiger", "rgb(0, 0, 150)"], ["Leopard", "rgb(0, 0, 200)"], ["Zebra", "rgb(0, 0, 250)"], ["Wolf", "rgb(0, 100, 150)"], ["Owl", "rgb(0, 100, 100)"], ["Gull", "rgb(100, 0, 100)"], ["Squid", "rgb(150, 0, 150)"]], oe = te[Math.floor(Math.random() * te.length)], de = /* @__PURE__ */ ce({
45
47
  clientID: 0,
46
48
  color: oe[1],
47
49
  isCollabActive: !1,
48
50
  name: oe[0],
49
51
  yjsDocMap: /* @__PURE__ */ new Map()
50
52
  });
51
- function Ye(e, r) {
52
- const o = W(de);
53
+ function Ge(e, r) {
54
+ const o = H(de);
53
55
  return e != null && (o.name = e), r != null && (o.color = r), o;
54
56
  }
55
- const Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
57
+ const qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
56
58
  __proto__: null,
57
59
  CollaborationContext: de,
58
- useCollaborationContext: Ye
59
- }, Symbol.toStringTag, { value: "Module" })), re = [["Cat", "rgb(125, 50, 0)"], ["Dog", "rgb(100, 0, 0)"], ["Rabbit", "rgb(150, 0, 0)"], ["Frog", "rgb(200, 0, 0)"], ["Fox", "rgb(200, 75, 0)"], ["Hedgehog", "rgb(0, 75, 0)"], ["Pigeon", "rgb(0, 125, 0)"], ["Squirrel", "rgb(75, 100, 0)"], ["Bear", "rgb(125, 100, 0)"], ["Tiger", "rgb(0, 0, 150)"], ["Leopard", "rgb(0, 0, 200)"], ["Zebra", "rgb(0, 0, 250)"], ["Wolf", "rgb(0, 100, 150)"], ["Owl", "rgb(0, 100, 100)"], ["Gull", "rgb(100, 0, 100)"], ["Squid", "rgb(150, 0, 150)"]], se = re[Math.floor(Math.random() * re.length)], pe = ue({ clientID: 0, color: se[1], isCollabActive: !1, name: se[0], yjsDocMap: /* @__PURE__ */ new Map() });
60
- function qe(e, r) {
61
- const o = W(pe);
60
+ useCollaborationContext: Ge
61
+ }, Symbol.toStringTag, { value: "Module" })), re = [["Cat", "rgb(125, 50, 0)"], ["Dog", "rgb(100, 0, 0)"], ["Rabbit", "rgb(150, 0, 0)"], ["Frog", "rgb(200, 0, 0)"], ["Fox", "rgb(200, 75, 0)"], ["Hedgehog", "rgb(0, 75, 0)"], ["Pigeon", "rgb(0, 125, 0)"], ["Squirrel", "rgb(75, 100, 0)"], ["Bear", "rgb(125, 100, 0)"], ["Tiger", "rgb(0, 0, 150)"], ["Leopard", "rgb(0, 0, 200)"], ["Zebra", "rgb(0, 0, 250)"], ["Wolf", "rgb(0, 100, 150)"], ["Owl", "rgb(0, 100, 100)"], ["Gull", "rgb(100, 0, 100)"], ["Squid", "rgb(150, 0, 150)"]], se = re[Math.floor(Math.random() * re.length)], pe = ce({ clientID: 0, color: se[1], isCollabActive: !1, name: se[0], yjsDocMap: /* @__PURE__ */ new Map() });
62
+ function Ze(e, r) {
63
+ const o = H(pe);
62
64
  return e != null && (o.name = e), r != null && (o.color = r), o;
63
65
  }
64
- const Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
66
+ const Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
65
67
  __proto__: null,
66
68
  CollaborationContext: pe,
67
- useCollaborationContext: qe
68
- }, Symbol.toStringTag, { value: "Module" })), Qe = process.env.NODE_ENV !== "production" ? Ge : Ze, G = Qe.useCollaborationContext;
69
+ useCollaborationContext: Ze
70
+ }, Symbol.toStringTag, { value: "Module" })), et = process.env.NODE_ENV !== "production" ? qe : Qe, G = et.useCollaborationContext;
69
71
  function ne(e) {
70
72
  const r = e.transform();
71
73
  return r !== null ? /* @__PURE__ */ new Set([r]) : /* @__PURE__ */ new Set();
72
74
  }
73
- function et({
75
+ function tt({
74
76
  initialEditor: e,
75
77
  children: r,
76
78
  initialNodes: o,
77
79
  initialTheme: N,
78
- skipCollabChecks: S
80
+ skipCollabChecks: D
79
81
  }) {
80
- const I = T(!1), x = W(J);
81
- if (x == null)
82
+ const x = z(!1), I = H(W);
83
+ if (I == null)
82
84
  throw Error("Unexpected parent context null on a nested composer");
83
85
  const [d, {
84
- getTheme: v
85
- }] = x, _ = me(
86
+ getTheme: E
87
+ }] = I, _ = ue(
86
88
  () => {
87
- const p = N || v() || void 0, y = le(x, p);
89
+ const p = N || E() || void 0, y = le(I, p);
88
90
  if (p !== void 0 && (e._config.theme = p), e._parentEditor = d, o)
89
91
  for (let i of o) {
90
- let E = null, t = null;
92
+ let R = null, t = null;
91
93
  if (typeof i != "function") {
92
94
  const b = i;
93
- i = b.replace, E = b.with, t = b.withKlass || null;
95
+ i = b.replace, R = b.with, t = b.withKlass || null;
94
96
  }
95
- const w = e._nodes.get(i.getType());
97
+ const M = e._nodes.get(i.getType());
96
98
  e._nodes.set(i.getType(), {
97
- exportDOM: w ? w.exportDOM : void 0,
99
+ exportDOM: M ? M.exportDOM : void 0,
98
100
  klass: i,
99
- replace: E,
101
+ replace: R,
100
102
  replaceWithKlass: t,
101
103
  transforms: ne(i)
102
104
  });
103
105
  }
104
106
  else {
105
107
  const i = e._nodes = new Map(d._nodes);
106
- for (const [E, t] of i)
107
- e._nodes.set(E, {
108
+ for (const [R, t] of i)
109
+ e._nodes.set(R, {
108
110
  exportDOM: t.exportDOM,
109
111
  klass: t.klass,
110
112
  replace: t.replace,
@@ -118,26 +120,26 @@ function et({
118
120
  // eslint-disable-next-line react-hooks/exhaustive-deps
119
121
  []
120
122
  ), {
121
- isCollabActive: R,
122
- yjsDocMap: O
123
- } = G(), c = S || I.current || O.has(e.getKey());
124
- return z(() => {
125
- c && (I.current = !0);
126
- }, [c]), z(() => d.registerEditableListener((p) => {
123
+ isCollabActive: v,
124
+ yjsDocMap: w
125
+ } = G(), c = D || x.current || w.has(e.getKey());
126
+ return k(() => {
127
+ c && (x.current = !0);
128
+ }, [c]), k(() => d.registerEditableListener((p) => {
127
129
  e.setEditable(p);
128
- }), [e, d]), /* @__PURE__ */ ce.jsx(J.Provider, {
130
+ }), [e, d]), /* @__PURE__ */ me(W.Provider, {
129
131
  value: _,
130
- children: !R || c ? r : null
132
+ children: !v || c ? r : null
131
133
  });
132
134
  }
133
- const tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
135
+ const ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
134
136
  __proto__: null,
135
- LexicalNestedComposer: et
137
+ LexicalNestedComposer: tt
136
138
  }, Symbol.toStringTag, { value: "Module" }));
137
- function ot(e) {
139
+ function rt(e) {
138
140
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
139
141
  }
140
- var rt = ot(function(e) {
142
+ var st = rt(function(e) {
141
143
  const r = new URLSearchParams();
142
144
  r.append("code", e);
143
145
  for (let o = 1; o < arguments.length; o++)
@@ -148,62 +150,62 @@ function ie(e) {
148
150
  const r = e.transform();
149
151
  return r !== null ? /* @__PURE__ */ new Set([r]) : /* @__PURE__ */ new Set();
150
152
  }
151
- function st({ initialEditor: e, children: r, initialNodes: o, initialTheme: N, skipCollabChecks: S }) {
152
- const I = T(!1), x = W(J);
153
- x == null && rt(9);
154
- const [d, { getTheme: v }] = x, _ = me(() => {
155
- const p = N || v() || void 0, y = le(x, p);
153
+ function nt({ initialEditor: e, children: r, initialNodes: o, initialTheme: N, skipCollabChecks: D }) {
154
+ const x = z(!1), I = H(W);
155
+ I == null && st(9);
156
+ const [d, { getTheme: E }] = I, _ = ue(() => {
157
+ const p = N || E() || void 0, y = le(I, p);
156
158
  if (p !== void 0 && (e._config.theme = p), e._parentEditor = d, o)
157
159
  for (let i of o) {
158
- let E = null, t = null;
160
+ let R = null, t = null;
159
161
  if (typeof i != "function") {
160
162
  const b = i;
161
- i = b.replace, E = b.with, t = b.withKlass || null;
163
+ i = b.replace, R = b.with, t = b.withKlass || null;
162
164
  }
163
- const w = e._nodes.get(i.getType());
164
- e._nodes.set(i.getType(), { exportDOM: w ? w.exportDOM : void 0, klass: i, replace: E, replaceWithKlass: t, transforms: ie(i) });
165
+ const M = e._nodes.get(i.getType());
166
+ e._nodes.set(i.getType(), { exportDOM: M ? M.exportDOM : void 0, klass: i, replace: R, replaceWithKlass: t, transforms: ie(i) });
165
167
  }
166
168
  else {
167
169
  const i = e._nodes = new Map(d._nodes);
168
- for (const [E, t] of i)
169
- e._nodes.set(E, { exportDOM: t.exportDOM, klass: t.klass, replace: t.replace, replaceWithKlass: t.replaceWithKlass, transforms: ie(t.klass) });
170
+ for (const [R, t] of i)
171
+ e._nodes.set(R, { exportDOM: t.exportDOM, klass: t.klass, replace: t.replace, replaceWithKlass: t.replaceWithKlass, transforms: ie(t.klass) });
170
172
  }
171
173
  return e._config.namespace = d._config.namespace, e._editable = d._editable, [e, y];
172
- }, []), { isCollabActive: R, yjsDocMap: O } = G(), c = S || I.current || O.has(e.getKey());
173
- return z(() => {
174
- c && (I.current = !0);
175
- }, [c]), z(() => d.registerEditableListener((p) => {
174
+ }, []), { isCollabActive: v, yjsDocMap: w } = G(), c = D || x.current || w.has(e.getKey());
175
+ return k(() => {
176
+ c && (x.current = !0);
177
+ }, [c]), k(() => d.registerEditableListener((p) => {
176
178
  e.setEditable(p);
177
- }), [e, d]), ce.jsx(J.Provider, { value: _, children: !R || c ? r : null });
179
+ }), [e, d]), me(W.Provider, { value: _, children: !v || c ? r : null });
178
180
  }
179
- const nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
181
+ const it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
180
182
  __proto__: null,
181
- LexicalNestedComposer: st
182
- }, Symbol.toStringTag, { value: "Module" })), it = process.env.NODE_ENV !== "production" ? tt : nt, at = it.LexicalNestedComposer;
183
+ LexicalNestedComposer: nt
184
+ }, Symbol.toStringTag, { value: "Module" })), at = process.env.NODE_ENV !== "production" ? ot : it, lt = at.LexicalNestedComposer;
183
185
  function F(e, r, o) {
184
186
  return Math.min(Math.max(e, r), o);
185
187
  }
186
- const l = {
188
+ const a = {
187
189
  east: 1,
188
190
  north: 8,
189
191
  south: 2,
190
192
  west: 4
191
193
  };
192
- function lt({
194
+ function ct({
193
195
  onResizeStart: e,
194
196
  onResizeEnd: r,
195
197
  buttonRef: o,
196
198
  imageRef: N,
197
- maxWidth: S,
198
- editor: I,
199
- showCaption: x,
199
+ maxWidth: D,
200
+ editor: x,
201
+ showCaption: I,
200
202
  setShowCaption: d,
201
- captionsEnabled: v
203
+ captionsEnabled: E
202
204
  }) {
203
- const _ = T(null), R = T({
205
+ const _ = z(null), v = z({
204
206
  priority: "",
205
207
  value: "default"
206
- }), O = T({
208
+ }), w = z({
207
209
  currentHeight: 0,
208
210
  currentWidth: 0,
209
211
  direction: 0,
@@ -213,8 +215,8 @@ function lt({
213
215
  startWidth: 0,
214
216
  startX: 0,
215
217
  startY: 0
216
- }), c = I.getRootElement(), p = S || (c !== null ? c.getBoundingClientRect().width - 20 : 100), y = c !== null ? c.getBoundingClientRect().height - 20 : 100, i = 100, E = 100, t = (s) => {
217
- const u = s === l.east || s === l.west, n = s === l.north || s === l.south, M = s & l.north && s & l.west || s & l.south && s & l.east, h = u ? "ew" : n ? "ns" : M ? "nwse" : "nesw";
218
+ }), c = x.getRootElement(), p = D || (c !== null ? c.getBoundingClientRect().width - 20 : 100), y = c !== null ? c.getBoundingClientRect().height - 20 : 100, i = 100, R = 100, t = (s) => {
219
+ const u = s === a.east || s === a.west, n = s === a.north || s === a.south, S = s & a.north && s & a.west || s & a.south && s & a.east, h = u ? "ew" : n ? "ns" : S ? "nwse" : "nesw";
218
220
  c !== null && c.style.setProperty(
219
221
  "cursor",
220
222
  `${h}-resize`,
@@ -223,55 +225,55 @@ function lt({
223
225
  "cursor",
224
226
  `${h}-resize`,
225
227
  "important"
226
- ), R.current.value = document.body.style.getPropertyValue(
228
+ ), v.current.value = document.body.style.getPropertyValue(
227
229
  "-webkit-user-select"
228
- ), R.current.priority = document.body.style.getPropertyPriority(
230
+ ), v.current.priority = document.body.style.getPropertyPriority(
229
231
  "-webkit-user-select"
230
232
  ), document.body.style.setProperty(
231
233
  "-webkit-user-select",
232
234
  "none",
233
235
  "important"
234
236
  ));
235
- }, w = () => {
237
+ }, M = () => {
236
238
  c !== null && c.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
237
239
  "-webkit-user-select",
238
- R.current.value,
239
- R.current.priority
240
+ v.current.value,
241
+ v.current.priority
240
242
  ));
241
243
  }, b = (s, u) => {
242
- if (!I.isEditable())
244
+ if (!x.isEditable())
243
245
  return;
244
- const n = N.current, M = _.current;
245
- if (n !== null && M !== null) {
246
+ const n = N.current, S = _.current;
247
+ if (n !== null && S !== null) {
246
248
  s.preventDefault();
247
- const { width: h, height: D } = n.getBoundingClientRect(), g = Z(n), f = O.current;
248
- f.startWidth = h, f.startHeight = D, f.ratio = h / D, f.currentWidth = h, f.currentHeight = D, f.startX = s.clientX / g, f.startY = s.clientY / g, f.isResizing = !0, f.direction = u, t(u), e(), M.classList.add("image-control-wrapper--resizing"), n.style.height = `${D}px`, n.style.width = `${h}px`, document.addEventListener("pointermove", j), document.addEventListener("pointerup", k);
249
+ const { width: h, height: O } = n.getBoundingClientRect(), g = Z(n), f = w.current;
250
+ f.startWidth = h, f.startHeight = O, f.ratio = h / O, f.currentWidth = h, f.currentHeight = O, f.startX = s.clientX / g, f.startY = s.clientY / g, f.isResizing = !0, f.direction = u, t(u), e(), S.classList.add("image-control-wrapper--resizing"), n.style.height = `${O}px`, n.style.width = `${h}px`, document.addEventListener("pointermove", L), document.addEventListener("pointerup", X);
249
251
  }
250
- }, j = (s) => {
251
- const u = N.current, n = O.current, M = n.direction & (l.east | l.west), h = n.direction & (l.south | l.north);
252
+ }, L = (s) => {
253
+ const u = N.current, n = w.current, S = n.direction & (a.east | a.west), h = n.direction & (a.south | a.north);
252
254
  if (u !== null && n.isResizing) {
253
- const D = Z(u);
254
- if (M && h) {
255
- let g = Math.floor(n.startX - s.clientX / D);
256
- g = n.direction & l.east ? -g : g;
255
+ const O = Z(u);
256
+ if (S && h) {
257
+ let g = Math.floor(n.startX - s.clientX / O);
258
+ g = n.direction & a.east ? -g : g;
257
259
  const f = F(
258
260
  n.startWidth + g,
259
261
  i,
260
262
  p
261
- ), U = f / n.ratio;
262
- u.style.width = `${f}px`, u.style.height = `${U}px`, n.currentHeight = U, n.currentWidth = f;
263
+ ), $ = f / n.ratio;
264
+ u.style.width = `${f}px`, u.style.height = `${$}px`, n.currentHeight = $, n.currentWidth = f;
263
265
  } else if (h) {
264
- let g = Math.floor(n.startY - s.clientY / D);
265
- g = n.direction & l.south ? -g : g;
266
+ let g = Math.floor(n.startY - s.clientY / O);
267
+ g = n.direction & a.south ? -g : g;
266
268
  const f = F(
267
269
  n.startHeight + g,
268
- E,
270
+ R,
269
271
  y
270
272
  );
271
273
  u.style.height = `${f}px`, n.currentHeight = f;
272
274
  } else {
273
- let g = Math.floor(n.startX - s.clientX / D);
274
- g = n.direction & l.east ? -g : g;
275
+ let g = Math.floor(n.startX - s.clientX / O);
276
+ g = n.direction & a.east ? -g : g;
275
277
  const f = F(
276
278
  n.startWidth + g,
277
279
  i,
@@ -280,21 +282,21 @@ function lt({
280
282
  u.style.width = `${f}px`, n.currentWidth = f;
281
283
  }
282
284
  }
283
- }, k = () => {
284
- const s = N.current, u = O.current, n = _.current;
285
+ }, X = () => {
286
+ const s = N.current, u = w.current, n = _.current;
285
287
  if (s !== null && n !== null && u.isResizing) {
286
- const M = u.currentWidth, h = u.currentHeight;
287
- u.startWidth = 0, u.startHeight = 0, u.ratio = 0, u.startX = 0, u.startY = 0, u.currentWidth = 0, u.currentHeight = 0, u.isResizing = !1, n.classList.remove("image-control-wrapper--resizing"), w(), r(M, h), document.removeEventListener("pointermove", j), document.removeEventListener("pointerup", k);
288
+ const S = u.currentWidth, h = u.currentHeight;
289
+ u.startWidth = 0, u.startHeight = 0, u.ratio = 0, u.startX = 0, u.startY = 0, u.currentWidth = 0, u.currentHeight = 0, u.isResizing = !1, n.classList.remove("image-control-wrapper--resizing"), M(), r(S, h), document.removeEventListener("pointermove", L), document.removeEventListener("pointerup", X);
288
290
  }
289
291
  };
290
- return /* @__PURE__ */ a.jsxDEV("div", { ref: _, children: [
291
- !x && v && /* @__PURE__ */ a.jsxDEV(
292
+ return /* @__PURE__ */ l("div", { ref: _, children: [
293
+ !I && E && /* @__PURE__ */ l(
292
294
  "button",
293
295
  {
294
296
  className: "image-caption-button",
295
297
  ref: o,
296
298
  onClick: () => {
297
- d(!x);
299
+ d(!I);
298
300
  },
299
301
  children: "Add Caption"
300
302
  },
@@ -307,12 +309,12 @@ function lt({
307
309
  },
308
310
  this
309
311
  ),
310
- /* @__PURE__ */ a.jsxDEV(
312
+ /* @__PURE__ */ l(
311
313
  "div",
312
314
  {
313
315
  className: "image-resizer image-resizer-n",
314
316
  onPointerDown: (s) => {
315
- b(s, l.north);
317
+ b(s, a.north);
316
318
  }
317
319
  },
318
320
  void 0,
@@ -324,12 +326,12 @@ function lt({
324
326
  },
325
327
  this
326
328
  ),
327
- /* @__PURE__ */ a.jsxDEV(
329
+ /* @__PURE__ */ l(
328
330
  "div",
329
331
  {
330
332
  className: "image-resizer image-resizer-ne",
331
333
  onPointerDown: (s) => {
332
- b(s, l.north | l.east);
334
+ b(s, a.north | a.east);
333
335
  }
334
336
  },
335
337
  void 0,
@@ -341,12 +343,12 @@ function lt({
341
343
  },
342
344
  this
343
345
  ),
344
- /* @__PURE__ */ a.jsxDEV(
346
+ /* @__PURE__ */ l(
345
347
  "div",
346
348
  {
347
349
  className: "image-resizer image-resizer-e",
348
350
  onPointerDown: (s) => {
349
- b(s, l.east);
351
+ b(s, a.east);
350
352
  }
351
353
  },
352
354
  void 0,
@@ -358,12 +360,12 @@ function lt({
358
360
  },
359
361
  this
360
362
  ),
361
- /* @__PURE__ */ a.jsxDEV(
363
+ /* @__PURE__ */ l(
362
364
  "div",
363
365
  {
364
366
  className: "image-resizer image-resizer-se",
365
367
  onPointerDown: (s) => {
366
- b(s, l.south | l.east);
368
+ b(s, a.south | a.east);
367
369
  }
368
370
  },
369
371
  void 0,
@@ -375,12 +377,12 @@ function lt({
375
377
  },
376
378
  this
377
379
  ),
378
- /* @__PURE__ */ a.jsxDEV(
380
+ /* @__PURE__ */ l(
379
381
  "div",
380
382
  {
381
383
  className: "image-resizer image-resizer-s",
382
384
  onPointerDown: (s) => {
383
- b(s, l.south);
385
+ b(s, a.south);
384
386
  }
385
387
  },
386
388
  void 0,
@@ -392,12 +394,12 @@ function lt({
392
394
  },
393
395
  this
394
396
  ),
395
- /* @__PURE__ */ a.jsxDEV(
397
+ /* @__PURE__ */ l(
396
398
  "div",
397
399
  {
398
400
  className: "image-resizer image-resizer-sw",
399
401
  onPointerDown: (s) => {
400
- b(s, l.south | l.west);
402
+ b(s, a.south | a.west);
401
403
  }
402
404
  },
403
405
  void 0,
@@ -409,12 +411,12 @@ function lt({
409
411
  },
410
412
  this
411
413
  ),
412
- /* @__PURE__ */ a.jsxDEV(
414
+ /* @__PURE__ */ l(
413
415
  "div",
414
416
  {
415
417
  className: "image-resizer image-resizer-w",
416
418
  onPointerDown: (s) => {
417
- b(s, l.west);
419
+ b(s, a.west);
418
420
  }
419
421
  },
420
422
  void 0,
@@ -426,12 +428,12 @@ function lt({
426
428
  },
427
429
  this
428
430
  ),
429
- /* @__PURE__ */ a.jsxDEV(
431
+ /* @__PURE__ */ l(
430
432
  "div",
431
433
  {
432
434
  className: "image-resizer image-resizer-nw",
433
435
  onPointerDown: (s) => {
434
- b(s, l.north | l.west);
436
+ b(s, a.north | a.west);
435
437
  }
436
438
  },
437
439
  void 0,
@@ -449,8 +451,8 @@ function lt({
449
451
  columnNumber: 5
450
452
  }, this);
451
453
  }
452
- const B = /* @__PURE__ */ new Set(), ae = $e("RIGHT_CLICK_IMAGE_COMMAND");
453
- function ct(e) {
454
+ const B = /* @__PURE__ */ new Set(), ae = We("RIGHT_CLICK_IMAGE_COMMAND");
455
+ function ut(e) {
454
456
  if (!B.has(e))
455
457
  throw new Promise((r) => {
456
458
  const o = new Image();
@@ -461,17 +463,17 @@ function ct(e) {
461
463
  };
462
464
  });
463
465
  }
464
- function ut({
466
+ function mt({
465
467
  altText: e,
466
468
  className: r,
467
469
  imageRef: o,
468
470
  src: N,
469
- width: S,
470
- height: I,
471
- maxWidth: x,
471
+ width: D,
472
+ height: x,
473
+ maxWidth: I,
472
474
  onError: d
473
475
  }) {
474
- return ct(N), /* @__PURE__ */ a.jsxDEV(
476
+ return ut(N), /* @__PURE__ */ l(
475
477
  "img",
476
478
  {
477
479
  className: r || void 0,
@@ -479,9 +481,9 @@ function ut({
479
481
  alt: e,
480
482
  ref: o,
481
483
  style: {
482
- height: I,
483
- maxWidth: x,
484
- width: S
484
+ height: x,
485
+ maxWidth: I,
486
+ width: D
485
487
  },
486
488
  onError: d,
487
489
  draggable: "false"
@@ -496,8 +498,8 @@ function ut({
496
498
  this
497
499
  );
498
500
  }
499
- function mt() {
500
- return /* @__PURE__ */ a.jsxDEV(
501
+ function dt() {
502
+ return /* @__PURE__ */ l(
501
503
  "img",
502
504
  {
503
505
  src: "",
@@ -518,60 +520,60 @@ function mt() {
518
520
  this
519
521
  );
520
522
  }
521
- function Dt({
523
+ function Mt({
522
524
  src: e,
523
525
  altText: r,
524
526
  nodeKey: o,
525
527
  width: N,
526
- height: S,
527
- maxWidth: I,
528
- resizable: x,
528
+ height: D,
529
+ maxWidth: x,
530
+ resizable: I,
529
531
  showCaption: d,
530
- caption: v,
532
+ caption: E,
531
533
  captionsEnabled: _
532
534
  }) {
533
- const R = T(null), O = T(null), [c, p, y] = Ce(o), [i, E] = K(!1);
535
+ const v = z(null), w = z(null), [c, p, y] = Ie(o), [i, R] = K(!1);
534
536
  G();
535
- const [t] = Y(), [w, b] = K(null), j = T(null), [k, s] = K(!1), u = be(), n = L(
537
+ const [t] = Y(), [M, b] = K(null), L = z(null), [X, s] = K(!1), u = Re(), n = V(
536
538
  (C) => {
537
- const m = $();
538
- return c && X(m) && (C.preventDefault(), t.update(() => {
539
- m.getNodes().forEach((V) => {
540
- H(V) && V.remove();
539
+ const m = J();
540
+ return c && U(m) && (C.preventDefault(), t.update(() => {
541
+ m.getNodes().forEach((A) => {
542
+ j(A) && A.remove();
541
543
  });
542
544
  })), !1;
543
545
  },
544
546
  [t, c]
545
- ), M = L(
547
+ ), S = V(
546
548
  (C) => {
547
- const m = $(), P = O.current;
548
- if (c && X(m) && m.getNodes().length === 1) {
549
+ const m = J(), P = w.current;
550
+ if (c && U(m) && m.getNodes().length === 1) {
549
551
  if (d)
550
- return Q(null), C.preventDefault(), v.focus(), !0;
552
+ return Q(null), C.preventDefault(), E.focus(), !0;
551
553
  if (P !== null && P !== document.activeElement)
552
554
  return C.preventDefault(), P.focus(), !0;
553
555
  }
554
556
  return !1;
555
557
  },
556
- [v, c, d]
557
- ), h = L(
558
- (C) => j.current === v || O.current === C.target ? (Q(null), t.update(() => {
558
+ [E, c, d]
559
+ ), h = V(
560
+ (C) => L.current === E || w.current === C.target ? (Q(null), t.update(() => {
559
561
  p(!0);
560
562
  const m = t.getRootElement();
561
563
  m !== null && m.focus();
562
564
  }), !0) : !1,
563
- [v, t, p]
564
- ), D = L(
565
+ [E, t, p]
566
+ ), O = V(
565
567
  (C) => {
566
568
  const m = C;
567
- return i ? !0 : m.target === R.current ? (m.shiftKey ? p(!c) : (y(), p(!0)), !0) : !1;
569
+ return i ? !0 : m.target === v.current ? (m.shiftKey ? p(!c) : (y(), p(!0)), !0) : !1;
568
570
  },
569
571
  [i, c, p, y]
570
- ), g = L(
572
+ ), g = V(
571
573
  (C) => {
572
574
  t.getEditorState().read(() => {
573
- const m = $();
574
- C.target.tagName === "IMG" && Pe(m) && m.getNodes().length === 1 && t.dispatchCommand(
575
+ const m = J();
576
+ C.target.tagName === "IMG" && _e(m) && m.getNodes().length === 1 && t.dispatchCommand(
575
577
  ae,
576
578
  C
577
579
  );
@@ -579,47 +581,47 @@ function Dt({
579
581
  },
580
582
  [t]
581
583
  );
582
- z(() => {
584
+ k(() => {
583
585
  let C = !0;
584
- const m = t.getRootElement(), P = Se(
585
- t.registerUpdateListener(({ editorState: V }) => {
586
- C && b(V.read(() => $()));
586
+ const m = t.getRootElement(), P = Pe(
587
+ t.registerUpdateListener(({ editorState: A }) => {
588
+ C && b(A.read(() => J()));
587
589
  }),
588
590
  t.registerCommand(
589
- _e,
590
- (V, Ne) => (j.current = Ne, !1),
591
- A
591
+ ye,
592
+ (A, Ne) => (L.current = Ne, !1),
593
+ T
592
594
  ),
593
595
  t.registerCommand(
594
- ye,
595
- D,
596
- A
596
+ Ae,
597
+ O,
598
+ T
597
599
  ),
598
600
  t.registerCommand(
599
601
  ae,
600
- D,
601
- A
602
+ O,
603
+ T
602
604
  ),
603
605
  t.registerCommand(
604
- Ve,
605
- (V) => V.target === R.current ? (alert("s"), V.preventDefault(), !0) : !1,
606
- A
606
+ Te,
607
+ (A) => A.target === v.current ? (alert("s"), A.preventDefault(), !0) : !1,
608
+ T
607
609
  ),
608
610
  t.registerCommand(
609
- Ae,
611
+ ze,
610
612
  n,
611
- A
613
+ T
612
614
  ),
613
615
  t.registerCommand(
614
- Te,
616
+ ke,
615
617
  n,
616
- A
618
+ T
617
619
  ),
618
- t.registerCommand(ze, M, A),
620
+ t.registerCommand(Le, S, T),
619
621
  t.registerCommand(
620
- je,
622
+ Xe,
621
623
  h,
622
- A
624
+ T
623
625
  )
624
626
  );
625
627
  return m == null || m.addEventListener("contextmenu", g), () => {
@@ -632,42 +634,42 @@ function Dt({
632
634
  c,
633
635
  o,
634
636
  n,
635
- M,
637
+ S,
636
638
  h,
637
- D,
639
+ O,
638
640
  g,
639
641
  p
640
642
  ]);
641
643
  const f = () => {
642
644
  t.update(() => {
643
645
  const C = ee(o);
644
- H(C) && C.setShowCaption(!0);
646
+ j(C) && C.setShowCaption(!0);
645
647
  });
646
- }, U = (C, m) => {
648
+ }, $ = (C, m) => {
647
649
  setTimeout(() => {
648
- E(!1);
650
+ R(!1);
649
651
  }, 200), t.update(() => {
650
652
  const P = ee(o);
651
- H(P) && P.setWidthAndHeight(C, m);
653
+ j(P) && P.setWidthAndHeight(C, m);
652
654
  });
653
655
  }, ge = () => {
654
- E(!0);
655
- }, fe = c && X(w) && !i, q = (c || i) && u;
656
- return /* @__PURE__ */ a.jsxDEV(Me, { fallback: null, children: /* @__PURE__ */ a.jsxDEV(a.Fragment, { children: [
657
- /* @__PURE__ */ a.jsxDEV("div", { draggable: fe, children: k ? /* @__PURE__ */ a.jsxDEV(mt, {}, void 0, !1, {
656
+ R(!0);
657
+ }, fe = c && U(M) && !i, q = (c || i) && u;
658
+ return /* @__PURE__ */ l(De, { fallback: null, children: /* @__PURE__ */ l(Ce, { children: [
659
+ /* @__PURE__ */ l("div", { draggable: fe, children: X ? /* @__PURE__ */ l(dt, {}, void 0, !1, {
658
660
  fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
659
661
  lineNumber: 406,
660
662
  columnNumber: 13
661
- }, this) : /* @__PURE__ */ a.jsxDEV(
662
- ut,
663
+ }, this) : /* @__PURE__ */ l(
664
+ mt,
663
665
  {
664
- className: q ? `focused ${X(w) ? "draggable" : ""}` : null,
666
+ className: q ? `focused ${U(M) ? "draggable" : ""}` : null,
665
667
  src: e,
666
668
  altText: r,
667
- imageRef: R,
669
+ imageRef: v,
668
670
  width: N,
669
- height: S,
670
- maxWidth: I,
671
+ height: D,
672
+ maxWidth: x,
671
673
  onError: () => s(!0)
672
674
  },
673
675
  void 0,
@@ -683,32 +685,32 @@ function Dt({
683
685
  lineNumber: 404,
684
686
  columnNumber: 9
685
687
  }, this),
686
- d && /* @__PURE__ */ a.jsxDEV("div", { className: "image-caption-container", children: /* @__PURE__ */ a.jsxDEV(
687
- at,
688
+ d && /* @__PURE__ */ l("div", { className: "image-caption-container", children: /* @__PURE__ */ l(
689
+ lt,
688
690
  {
689
- initialEditor: v,
691
+ initialEditor: E,
690
692
  initialNodes: [
691
- ke,
692
- Le,
693
- Xe,
693
+ Ve,
694
694
  Ue,
695
- we,
696
- Oe
695
+ $e,
696
+ Je,
697
+ he,
698
+ be
697
699
  ],
698
700
  children: [
699
- /* @__PURE__ */ a.jsxDEV(Be, {}, void 0, !1, {
701
+ /* @__PURE__ */ l(Ye, {}, void 0, !1, {
700
702
  fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
701
703
  lineNumber: 438,
702
704
  columnNumber: 15
703
705
  }, this),
704
- /* @__PURE__ */ a.jsxDEV(
705
- he,
706
+ /* @__PURE__ */ l(
707
+ xe,
706
708
  {
707
- contentEditable: /* @__PURE__ */ a.jsxDEV(
708
- xe,
709
+ contentEditable: /* @__PURE__ */ l(
710
+ ve,
709
711
  {
710
712
  "aria-placeholder": "Enter a caption...",
711
- placeholder: () => /* @__PURE__ */ a.jsxDEV("span", { children: "Enter a caption..." }, void 0, !1, {
713
+ placeholder: () => /* @__PURE__ */ l("span", { children: "Enter a caption..." }, void 0, !1, {
712
714
  fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
713
715
  lineNumber: 444,
714
716
  columnNumber: 40
@@ -724,7 +726,7 @@ function Dt({
724
726
  },
725
727
  this
726
728
  ),
727
- ErrorBoundary: Ee
729
+ ErrorBoundary: Oe
728
730
  },
729
731
  void 0,
730
732
  !1,
@@ -735,17 +737,17 @@ function Dt({
735
737
  },
736
738
  this
737
739
  ),
738
- /* @__PURE__ */ a.jsxDEV(Ie, { onChange: (C) => console.log("e") }, void 0, !1, {
740
+ /* @__PURE__ */ l(Ee, { onChange: (C) => console.log("e") }, void 0, !1, {
739
741
  fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
740
742
  lineNumber: 451,
741
743
  columnNumber: 15
742
744
  }, this),
743
- /* @__PURE__ */ a.jsxDEV(Re, {}, void 0, !1, {
745
+ /* @__PURE__ */ l(we, {}, void 0, !1, {
744
746
  fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
745
747
  lineNumber: 452,
746
748
  columnNumber: 15
747
749
  }, this),
748
- /* @__PURE__ */ a.jsxDEV(De, { namespace: ve.namespace }, void 0, !1, {
750
+ /* @__PURE__ */ l(Me, { namespace: Se.namespace }, void 0, !1, {
749
751
  fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
750
752
  lineNumber: 453,
751
753
  columnNumber: 15
@@ -765,18 +767,18 @@ function Dt({
765
767
  lineNumber: 426,
766
768
  columnNumber: 11
767
769
  }, this),
768
- x && X(w) && q && /* @__PURE__ */ a.jsxDEV(
769
- lt,
770
+ I && U(M) && q && /* @__PURE__ */ l(
771
+ ct,
770
772
  {
771
773
  showCaption: d,
772
774
  setShowCaption: f,
773
775
  editor: t,
774
- buttonRef: O,
775
- imageRef: R,
776
- maxWidth: I,
776
+ buttonRef: w,
777
+ imageRef: v,
778
+ maxWidth: x,
777
779
  onResizeStart: ge,
778
- onResizeEnd: U,
779
- captionsEnabled: !k && _
780
+ onResizeEnd: $,
781
+ captionsEnabled: !X && _
780
782
  },
781
783
  void 0,
782
784
  !1,
@@ -799,6 +801,6 @@ function Dt({
799
801
  }
800
802
  export {
801
803
  ae as RIGHT_CLICK_IMAGE_COMMAND,
802
- Dt as default
804
+ Mt as default
803
805
  };
804
- //# sourceMappingURL=index-645b5b2f.js.map
806
+ //# sourceMappingURL=index-0e027fdf.js.map