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