ct-rich-text-editor 1.1.7 → 1.1.8

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.
@@ -0,0 +1,804 @@
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-9cbd199b.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";
7
+ import "axios";
8
+ import "@emotion/styled";
9
+ import "react-dom";
10
+ import "@lexical/table";
11
+ import "@emotion/react";
12
+ import "emoji-picker-react";
13
+ function Je({
14
+ defaultSelection: e
15
+ }) {
16
+ const [r] = Y();
17
+ return z(() => {
18
+ r.focus(() => {
19
+ const o = document.activeElement, N = r.getRootElement();
20
+ N !== null && (o === null || !N.contains(o)) && N.focus({
21
+ preventScroll: !0
22
+ });
23
+ }, {
24
+ defaultSelection: e
25
+ });
26
+ }, [e, r]), null;
27
+ }
28
+ const We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
29
+ __proto__: null,
30
+ AutoFocusPlugin: Je
31
+ }, Symbol.toStringTag, { value: "Module" }));
32
+ function He({ defaultSelection: e }) {
33
+ const [r] = Y();
34
+ return z(() => {
35
+ r.focus(() => {
36
+ const o = document.activeElement, N = r.getRootElement();
37
+ N === null || o !== null && N.contains(o) || N.focus({ preventScroll: !0 });
38
+ }, { defaultSelection: e });
39
+ }, [e, r]), null;
40
+ }
41
+ const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
42
+ __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
+ clientID: 0,
46
+ color: oe[1],
47
+ isCollabActive: !1,
48
+ name: oe[0],
49
+ yjsDocMap: /* @__PURE__ */ new Map()
50
+ });
51
+ function Ye(e, r) {
52
+ const o = W(de);
53
+ return e != null && (o.name = e), r != null && (o.color = r), o;
54
+ }
55
+ const Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
56
+ __proto__: null,
57
+ 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);
62
+ return e != null && (o.name = e), r != null && (o.color = r), o;
63
+ }
64
+ const Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
65
+ __proto__: null,
66
+ CollaborationContext: pe,
67
+ useCollaborationContext: qe
68
+ }, Symbol.toStringTag, { value: "Module" })), Qe = process.env.NODE_ENV !== "production" ? Ge : Ze, G = Qe.useCollaborationContext;
69
+ function ne(e) {
70
+ const r = e.transform();
71
+ return r !== null ? /* @__PURE__ */ new Set([r]) : /* @__PURE__ */ new Set();
72
+ }
73
+ function et({
74
+ initialEditor: e,
75
+ children: r,
76
+ initialNodes: o,
77
+ initialTheme: N,
78
+ skipCollabChecks: S
79
+ }) {
80
+ const I = T(!1), x = W(J);
81
+ if (x == null)
82
+ throw Error("Unexpected parent context null on a nested composer");
83
+ const [d, {
84
+ getTheme: v
85
+ }] = x, _ = me(
86
+ () => {
87
+ const p = N || v() || void 0, y = le(x, p);
88
+ if (p !== void 0 && (e._config.theme = p), e._parentEditor = d, o)
89
+ for (let i of o) {
90
+ let E = null, t = null;
91
+ if (typeof i != "function") {
92
+ const b = i;
93
+ i = b.replace, E = b.with, t = b.withKlass || null;
94
+ }
95
+ const w = e._nodes.get(i.getType());
96
+ e._nodes.set(i.getType(), {
97
+ exportDOM: w ? w.exportDOM : void 0,
98
+ klass: i,
99
+ replace: E,
100
+ replaceWithKlass: t,
101
+ transforms: ne(i)
102
+ });
103
+ }
104
+ else {
105
+ const i = e._nodes = new Map(d._nodes);
106
+ for (const [E, t] of i)
107
+ e._nodes.set(E, {
108
+ exportDOM: t.exportDOM,
109
+ klass: t.klass,
110
+ replace: t.replace,
111
+ replaceWithKlass: t.replaceWithKlass,
112
+ transforms: ne(t.klass)
113
+ });
114
+ }
115
+ return e._config.namespace = d._config.namespace, e._editable = d._editable, [e, y];
116
+ },
117
+ // We only do this for init
118
+ // eslint-disable-next-line react-hooks/exhaustive-deps
119
+ []
120
+ ), {
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) => {
127
+ e.setEditable(p);
128
+ }), [e, d]), /* @__PURE__ */ ce.jsx(J.Provider, {
129
+ value: _,
130
+ children: !R || c ? r : null
131
+ });
132
+ }
133
+ const tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
134
+ __proto__: null,
135
+ LexicalNestedComposer: et
136
+ }, Symbol.toStringTag, { value: "Module" }));
137
+ function ot(e) {
138
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
139
+ }
140
+ var rt = ot(function(e) {
141
+ const r = new URLSearchParams();
142
+ r.append("code", e);
143
+ for (let o = 1; o < arguments.length; o++)
144
+ r.append("v", arguments[o]);
145
+ throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${r} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
146
+ });
147
+ function ie(e) {
148
+ const r = e.transform();
149
+ return r !== null ? /* @__PURE__ */ new Set([r]) : /* @__PURE__ */ new Set();
150
+ }
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);
156
+ if (p !== void 0 && (e._config.theme = p), e._parentEditor = d, o)
157
+ for (let i of o) {
158
+ let E = null, t = null;
159
+ if (typeof i != "function") {
160
+ const b = i;
161
+ i = b.replace, E = b.with, t = b.withKlass || null;
162
+ }
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
+ }
166
+ else {
167
+ 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
+ }
171
+ 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) => {
176
+ e.setEditable(p);
177
+ }), [e, d]), ce.jsx(J.Provider, { value: _, children: !R || c ? r : null });
178
+ }
179
+ const nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
180
+ __proto__: null,
181
+ LexicalNestedComposer: st
182
+ }, Symbol.toStringTag, { value: "Module" })), it = process.env.NODE_ENV !== "production" ? tt : nt, at = it.LexicalNestedComposer;
183
+ function F(e, r, o) {
184
+ return Math.min(Math.max(e, r), o);
185
+ }
186
+ const l = {
187
+ east: 1,
188
+ north: 8,
189
+ south: 2,
190
+ west: 4
191
+ };
192
+ function lt({
193
+ onResizeStart: e,
194
+ onResizeEnd: r,
195
+ buttonRef: o,
196
+ imageRef: N,
197
+ maxWidth: S,
198
+ editor: I,
199
+ showCaption: x,
200
+ setShowCaption: d,
201
+ captionsEnabled: v
202
+ }) {
203
+ const _ = T(null), R = T({
204
+ priority: "",
205
+ value: "default"
206
+ }), O = T({
207
+ currentHeight: 0,
208
+ currentWidth: 0,
209
+ direction: 0,
210
+ isResizing: !1,
211
+ ratio: 0,
212
+ startHeight: 0,
213
+ startWidth: 0,
214
+ startX: 0,
215
+ 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 !== null && c.style.setProperty(
219
+ "cursor",
220
+ `${h}-resize`,
221
+ "important"
222
+ ), document.body !== null && (document.body.style.setProperty(
223
+ "cursor",
224
+ `${h}-resize`,
225
+ "important"
226
+ ), R.current.value = document.body.style.getPropertyValue(
227
+ "-webkit-user-select"
228
+ ), R.current.priority = document.body.style.getPropertyPriority(
229
+ "-webkit-user-select"
230
+ ), document.body.style.setProperty(
231
+ "-webkit-user-select",
232
+ "none",
233
+ "important"
234
+ ));
235
+ }, w = () => {
236
+ c !== null && c.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
237
+ "-webkit-user-select",
238
+ R.current.value,
239
+ R.current.priority
240
+ ));
241
+ }, b = (s, u) => {
242
+ if (!I.isEditable())
243
+ return;
244
+ const n = N.current, M = _.current;
245
+ if (n !== null && M !== null) {
246
+ 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
+ }
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
+ 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;
257
+ const f = F(
258
+ n.startWidth + g,
259
+ i,
260
+ p
261
+ ), U = f / n.ratio;
262
+ u.style.width = `${f}px`, u.style.height = `${U}px`, n.currentHeight = U, n.currentWidth = f;
263
+ } else if (h) {
264
+ let g = Math.floor(n.startY - s.clientY / D);
265
+ g = n.direction & l.south ? -g : g;
266
+ const f = F(
267
+ n.startHeight + g,
268
+ E,
269
+ y
270
+ );
271
+ u.style.height = `${f}px`, n.currentHeight = f;
272
+ } else {
273
+ let g = Math.floor(n.startX - s.clientX / D);
274
+ g = n.direction & l.east ? -g : g;
275
+ const f = F(
276
+ n.startWidth + g,
277
+ i,
278
+ p
279
+ );
280
+ u.style.width = `${f}px`, n.currentWidth = f;
281
+ }
282
+ }
283
+ }, k = () => {
284
+ const s = N.current, u = O.current, n = _.current;
285
+ 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
+ }
289
+ };
290
+ return /* @__PURE__ */ a.jsxDEV("div", { ref: _, children: [
291
+ !x && v && /* @__PURE__ */ a.jsxDEV(
292
+ "button",
293
+ {
294
+ className: "image-caption-button",
295
+ ref: o,
296
+ onClick: () => {
297
+ d(!x);
298
+ },
299
+ children: "Add Caption"
300
+ },
301
+ void 0,
302
+ !1,
303
+ {
304
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/ImageResizer.tsx",
305
+ lineNumber: 328,
306
+ columnNumber: 9
307
+ },
308
+ this
309
+ ),
310
+ /* @__PURE__ */ a.jsxDEV(
311
+ "div",
312
+ {
313
+ className: "image-resizer image-resizer-n",
314
+ onPointerDown: (s) => {
315
+ b(s, l.north);
316
+ }
317
+ },
318
+ void 0,
319
+ !1,
320
+ {
321
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/ImageResizer.tsx",
322
+ lineNumber: 338,
323
+ columnNumber: 7
324
+ },
325
+ this
326
+ ),
327
+ /* @__PURE__ */ a.jsxDEV(
328
+ "div",
329
+ {
330
+ className: "image-resizer image-resizer-ne",
331
+ onPointerDown: (s) => {
332
+ b(s, l.north | l.east);
333
+ }
334
+ },
335
+ void 0,
336
+ !1,
337
+ {
338
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/ImageResizer.tsx",
339
+ lineNumber: 344,
340
+ columnNumber: 7
341
+ },
342
+ this
343
+ ),
344
+ /* @__PURE__ */ a.jsxDEV(
345
+ "div",
346
+ {
347
+ className: "image-resizer image-resizer-e",
348
+ onPointerDown: (s) => {
349
+ b(s, l.east);
350
+ }
351
+ },
352
+ void 0,
353
+ !1,
354
+ {
355
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/ImageResizer.tsx",
356
+ lineNumber: 350,
357
+ columnNumber: 7
358
+ },
359
+ this
360
+ ),
361
+ /* @__PURE__ */ a.jsxDEV(
362
+ "div",
363
+ {
364
+ className: "image-resizer image-resizer-se",
365
+ onPointerDown: (s) => {
366
+ b(s, l.south | l.east);
367
+ }
368
+ },
369
+ void 0,
370
+ !1,
371
+ {
372
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/ImageResizer.tsx",
373
+ lineNumber: 356,
374
+ columnNumber: 7
375
+ },
376
+ this
377
+ ),
378
+ /* @__PURE__ */ a.jsxDEV(
379
+ "div",
380
+ {
381
+ className: "image-resizer image-resizer-s",
382
+ onPointerDown: (s) => {
383
+ b(s, l.south);
384
+ }
385
+ },
386
+ void 0,
387
+ !1,
388
+ {
389
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/ImageResizer.tsx",
390
+ lineNumber: 362,
391
+ columnNumber: 7
392
+ },
393
+ this
394
+ ),
395
+ /* @__PURE__ */ a.jsxDEV(
396
+ "div",
397
+ {
398
+ className: "image-resizer image-resizer-sw",
399
+ onPointerDown: (s) => {
400
+ b(s, l.south | l.west);
401
+ }
402
+ },
403
+ void 0,
404
+ !1,
405
+ {
406
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/ImageResizer.tsx",
407
+ lineNumber: 368,
408
+ columnNumber: 7
409
+ },
410
+ this
411
+ ),
412
+ /* @__PURE__ */ a.jsxDEV(
413
+ "div",
414
+ {
415
+ className: "image-resizer image-resizer-w",
416
+ onPointerDown: (s) => {
417
+ b(s, l.west);
418
+ }
419
+ },
420
+ void 0,
421
+ !1,
422
+ {
423
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/ImageResizer.tsx",
424
+ lineNumber: 374,
425
+ columnNumber: 7
426
+ },
427
+ this
428
+ ),
429
+ /* @__PURE__ */ a.jsxDEV(
430
+ "div",
431
+ {
432
+ className: "image-resizer image-resizer-nw",
433
+ onPointerDown: (s) => {
434
+ b(s, l.north | l.west);
435
+ }
436
+ },
437
+ void 0,
438
+ !1,
439
+ {
440
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/ImageResizer.tsx",
441
+ lineNumber: 380,
442
+ columnNumber: 7
443
+ },
444
+ this
445
+ )
446
+ ] }, void 0, !0, {
447
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/ImageResizer.tsx",
448
+ lineNumber: 326,
449
+ columnNumber: 5
450
+ }, this);
451
+ }
452
+ const B = /* @__PURE__ */ new Set(), ae = $e("RIGHT_CLICK_IMAGE_COMMAND");
453
+ function ct(e) {
454
+ if (!B.has(e))
455
+ throw new Promise((r) => {
456
+ const o = new Image();
457
+ o.src = e, o.onload = () => {
458
+ B.add(e), r(null);
459
+ }, o.onerror = () => {
460
+ B.add(e);
461
+ };
462
+ });
463
+ }
464
+ function ut({
465
+ altText: e,
466
+ className: r,
467
+ imageRef: o,
468
+ src: N,
469
+ width: S,
470
+ height: I,
471
+ maxWidth: x,
472
+ onError: d
473
+ }) {
474
+ return ct(N), /* @__PURE__ */ a.jsxDEV(
475
+ "img",
476
+ {
477
+ className: r || void 0,
478
+ src: N,
479
+ alt: e,
480
+ ref: o,
481
+ style: {
482
+ height: I,
483
+ maxWidth: x,
484
+ width: S
485
+ },
486
+ onError: d,
487
+ draggable: "false"
488
+ },
489
+ void 0,
490
+ !1,
491
+ {
492
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
493
+ lineNumber: 103,
494
+ columnNumber: 5
495
+ },
496
+ this
497
+ );
498
+ }
499
+ function mt() {
500
+ return /* @__PURE__ */ a.jsxDEV(
501
+ "img",
502
+ {
503
+ src: "",
504
+ style: {
505
+ height: 200,
506
+ opacity: 0.2,
507
+ width: 200
508
+ },
509
+ draggable: "false"
510
+ },
511
+ void 0,
512
+ !1,
513
+ {
514
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
515
+ lineNumber: 122,
516
+ columnNumber: 5
517
+ },
518
+ this
519
+ );
520
+ }
521
+ function Dt({
522
+ src: e,
523
+ altText: r,
524
+ nodeKey: o,
525
+ width: N,
526
+ height: S,
527
+ maxWidth: I,
528
+ resizable: x,
529
+ showCaption: d,
530
+ caption: v,
531
+ captionsEnabled: _
532
+ }) {
533
+ const R = T(null), O = T(null), [c, p, y] = Ce(o), [i, E] = K(!1);
534
+ G();
535
+ const [t] = Y(), [w, b] = K(null), j = T(null), [k, s] = K(!1), u = be(), n = L(
536
+ (C) => {
537
+ const m = $();
538
+ return c && X(m) && (C.preventDefault(), t.update(() => {
539
+ m.getNodes().forEach((V) => {
540
+ H(V) && V.remove();
541
+ });
542
+ })), !1;
543
+ },
544
+ [t, c]
545
+ ), M = L(
546
+ (C) => {
547
+ const m = $(), P = O.current;
548
+ if (c && X(m) && m.getNodes().length === 1) {
549
+ if (d)
550
+ return Q(null), C.preventDefault(), v.focus(), !0;
551
+ if (P !== null && P !== document.activeElement)
552
+ return C.preventDefault(), P.focus(), !0;
553
+ }
554
+ return !1;
555
+ },
556
+ [v, c, d]
557
+ ), h = L(
558
+ (C) => j.current === v || O.current === C.target ? (Q(null), t.update(() => {
559
+ p(!0);
560
+ const m = t.getRootElement();
561
+ m !== null && m.focus();
562
+ }), !0) : !1,
563
+ [v, t, p]
564
+ ), D = L(
565
+ (C) => {
566
+ const m = C;
567
+ return i ? !0 : m.target === R.current ? (m.shiftKey ? p(!c) : (y(), p(!0)), !0) : !1;
568
+ },
569
+ [i, c, p, y]
570
+ ), g = L(
571
+ (C) => {
572
+ t.getEditorState().read(() => {
573
+ const m = $();
574
+ C.target.tagName === "IMG" && Pe(m) && m.getNodes().length === 1 && t.dispatchCommand(
575
+ ae,
576
+ C
577
+ );
578
+ });
579
+ },
580
+ [t]
581
+ );
582
+ z(() => {
583
+ let C = !0;
584
+ const m = t.getRootElement(), P = Se(
585
+ t.registerUpdateListener(({ editorState: V }) => {
586
+ C && b(V.read(() => $()));
587
+ }),
588
+ t.registerCommand(
589
+ _e,
590
+ (V, Ne) => (j.current = Ne, !1),
591
+ A
592
+ ),
593
+ t.registerCommand(
594
+ ye,
595
+ D,
596
+ A
597
+ ),
598
+ t.registerCommand(
599
+ ae,
600
+ D,
601
+ A
602
+ ),
603
+ t.registerCommand(
604
+ Ve,
605
+ (V) => V.target === R.current ? (alert("s"), V.preventDefault(), !0) : !1,
606
+ A
607
+ ),
608
+ t.registerCommand(
609
+ Ae,
610
+ n,
611
+ A
612
+ ),
613
+ t.registerCommand(
614
+ Te,
615
+ n,
616
+ A
617
+ ),
618
+ t.registerCommand(ze, M, A),
619
+ t.registerCommand(
620
+ je,
621
+ h,
622
+ A
623
+ )
624
+ );
625
+ return m == null || m.addEventListener("contextmenu", g), () => {
626
+ C = !1, P(), m == null || m.removeEventListener("contextmenu", g);
627
+ };
628
+ }, [
629
+ y,
630
+ t,
631
+ i,
632
+ c,
633
+ o,
634
+ n,
635
+ M,
636
+ h,
637
+ D,
638
+ g,
639
+ p
640
+ ]);
641
+ const f = () => {
642
+ t.update(() => {
643
+ const C = ee(o);
644
+ H(C) && C.setShowCaption(!0);
645
+ });
646
+ }, U = (C, m) => {
647
+ setTimeout(() => {
648
+ E(!1);
649
+ }, 200), t.update(() => {
650
+ const P = ee(o);
651
+ H(P) && P.setWidthAndHeight(C, m);
652
+ });
653
+ }, 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, {
658
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
659
+ lineNumber: 406,
660
+ columnNumber: 13
661
+ }, this) : /* @__PURE__ */ a.jsxDEV(
662
+ ut,
663
+ {
664
+ className: q ? `focused ${X(w) ? "draggable" : ""}` : null,
665
+ src: e,
666
+ altText: r,
667
+ imageRef: R,
668
+ width: N,
669
+ height: S,
670
+ maxWidth: I,
671
+ onError: () => s(!0)
672
+ },
673
+ void 0,
674
+ !1,
675
+ {
676
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
677
+ lineNumber: 408,
678
+ columnNumber: 13
679
+ },
680
+ this
681
+ ) }, void 0, !1, {
682
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
683
+ lineNumber: 404,
684
+ columnNumber: 9
685
+ }, this),
686
+ d && /* @__PURE__ */ a.jsxDEV("div", { className: "image-caption-container", children: /* @__PURE__ */ a.jsxDEV(
687
+ at,
688
+ {
689
+ initialEditor: v,
690
+ initialNodes: [
691
+ ke,
692
+ Le,
693
+ Xe,
694
+ Ue,
695
+ we,
696
+ Oe
697
+ ],
698
+ children: [
699
+ /* @__PURE__ */ a.jsxDEV(Be, {}, void 0, !1, {
700
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
701
+ lineNumber: 438,
702
+ columnNumber: 15
703
+ }, this),
704
+ /* @__PURE__ */ a.jsxDEV(
705
+ he,
706
+ {
707
+ contentEditable: /* @__PURE__ */ a.jsxDEV(
708
+ xe,
709
+ {
710
+ "aria-placeholder": "Enter a caption...",
711
+ placeholder: () => /* @__PURE__ */ a.jsxDEV("span", { children: "Enter a caption..." }, void 0, !1, {
712
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
713
+ lineNumber: 444,
714
+ columnNumber: 40
715
+ }, this),
716
+ className: "ImageNode__contentEditable"
717
+ },
718
+ void 0,
719
+ !1,
720
+ {
721
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
722
+ lineNumber: 442,
723
+ columnNumber: 19
724
+ },
725
+ this
726
+ ),
727
+ ErrorBoundary: Ee
728
+ },
729
+ void 0,
730
+ !1,
731
+ {
732
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
733
+ lineNumber: 440,
734
+ columnNumber: 15
735
+ },
736
+ this
737
+ ),
738
+ /* @__PURE__ */ a.jsxDEV(Ie, { onChange: (C) => console.log("e") }, void 0, !1, {
739
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
740
+ lineNumber: 451,
741
+ columnNumber: 15
742
+ }, this),
743
+ /* @__PURE__ */ a.jsxDEV(Re, {}, void 0, !1, {
744
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
745
+ lineNumber: 452,
746
+ columnNumber: 15
747
+ }, this),
748
+ /* @__PURE__ */ a.jsxDEV(De, { namespace: ve.namespace }, void 0, !1, {
749
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
750
+ lineNumber: 453,
751
+ columnNumber: 15
752
+ }, this)
753
+ ]
754
+ },
755
+ void 0,
756
+ !0,
757
+ {
758
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
759
+ lineNumber: 427,
760
+ columnNumber: 13
761
+ },
762
+ this
763
+ ) }, void 0, !1, {
764
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
765
+ lineNumber: 426,
766
+ columnNumber: 11
767
+ }, this),
768
+ x && X(w) && q && /* @__PURE__ */ a.jsxDEV(
769
+ lt,
770
+ {
771
+ showCaption: d,
772
+ setShowCaption: f,
773
+ editor: t,
774
+ buttonRef: O,
775
+ imageRef: R,
776
+ maxWidth: I,
777
+ onResizeStart: ge,
778
+ onResizeEnd: U,
779
+ captionsEnabled: !k && _
780
+ },
781
+ void 0,
782
+ !1,
783
+ {
784
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
785
+ lineNumber: 458,
786
+ columnNumber: 11
787
+ },
788
+ this
789
+ )
790
+ ] }, void 0, !0, {
791
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
792
+ lineNumber: 403,
793
+ columnNumber: 7
794
+ }, this) }, void 0, !1, {
795
+ fileName: "C:/Users/M S I/Desktop/CRAXINNO PROJECT/editor/apps/editor/src/components/ImageView/index.tsx",
796
+ lineNumber: 402,
797
+ columnNumber: 5
798
+ }, this);
799
+ }
800
+ export {
801
+ ae as RIGHT_CLICK_IMAGE_COMMAND,
802
+ Dt as default
803
+ };
804
+ //# sourceMappingURL=index-b5d35c27.js.map