eddyter 1.4.19 → 1.4.20-beta.0
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.
- package/README.md +6 -3
- package/dist/{AIChatPlugin-BUWq8ixX.js → AIChatPlugin-XDBXQanb.js} +3 -3
- package/dist/{CombinedAutocompletGrammarPlugin-Dq25w8tq.js → CombinedAutocompletGrammarPlugin-BRBmG7Uo.js} +186 -167
- package/dist/{CommentBubblePlugin-B77d3Qq6.js → CommentBubblePlugin-BALioirG.js} +1 -1
- package/dist/{CommentPlugin-BJQyKmrN.js → CommentPlugin-CHmC9IZh.js} +2 -2
- package/dist/{NotePanelPlugin-BqOdcg07.js → NotePanelPlugin-CPGzqjuk.js} +1 -1
- package/dist/{TextEnhancePlugin-BnmdRgUu.js → TextEnhancePlugin-DgC4kmVA.js} +2 -2
- package/dist/assets/style.css +1 -1
- package/dist/components/FormatTextMenu/FormatTextMenu.d.ts +5 -0
- package/dist/components/InsertVideoDialog.d.ts +7 -0
- package/dist/components/ListMenu/ListMenu.d.ts +10 -0
- package/dist/components/ListMenu/index.d.ts +1 -0
- package/dist/components/NewBadge/NewBadge.d.ts +5 -0
- package/dist/components/NewBadge/NewDot.d.ts +9 -0
- package/dist/components/Toolbar/styles.d.ts +2 -2
- package/dist/{generateDocxThumbnail-DBMxjZ83.js → generateDocxThumbnail-BTxOqVy6.js} +1 -1
- package/dist/{generatePdfThumbnail-Cv2-ZCzh.js → generatePdfThumbnail-bcpGGSUp.js} +1 -1
- package/dist/{generateXlsxThumbnail-UHmNc7Fa.js → generateXlsxThumbnail-BWM1cmSl.js} +1 -1
- package/dist/hooks/useNewFeatures.d.ts +5 -0
- package/dist/{index-Bex3G_eE.js → index-0VTRLfjb.js} +15648 -14919
- package/dist/{index-ChSepytp.js → index-BNICgdB-.js} +21 -21
- package/dist/{index-q_TW8dU1.js → index-BxOZNLwu.js} +4 -4
- package/dist/{index-C_mjLQUF.js → index-DDSVx-B8.js} +2 -2
- package/dist/{index-Cl_A9eof.js → index-DRLZF4xQ.js} +193 -198
- package/dist/{index-BaWQzoL2.js → index-DZESLGLB.js} +1 -1
- package/dist/{index-DcHU8PlQ.js → index-FZ7Aopvl.js} +73 -73
- package/dist/index.d.ts +0 -1
- package/dist/index.js +12 -13
- package/dist/nodes/ButtonNode.d.ts +15 -2
- package/dist/nodes/documentPalette.d.ts +24 -0
- package/dist/plugins/WordCountPlugin.d.ts +2 -0
- package/dist/{sparkles-C-XoMho5.js → sparkles-DIeZhywG.js} +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/ui/Icons.d.ts +7 -1
- package/dist/{useVoiceToText-BzaLSbRi.js → useVoiceToText-sR--QAUC.js} +1 -1
- package/dist/utils/neutralTextColor.d.ts +22 -0
- package/dist/utils/newFeatures.d.ts +13 -0
- package/dist/utils/notePanelPaste.d.ts +3 -0
- package/package.json +2 -2
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as Me } from "react/jsx-runtime";
|
|
2
|
-
import { I as
|
|
3
|
-
import { CodeNode as
|
|
2
|
+
import { I as Wt } from "./ImageResizer-BVwxL4Eh.js";
|
|
3
|
+
import { CodeNode as Tt } from "@lexical/code";
|
|
4
4
|
import { LinkNode as zt } from "@lexical/link";
|
|
5
5
|
import { AutoFocusPlugin as Ot } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
6
6
|
import { useCollaborationContext as _t } from "@lexical/react/LexicalCollaborationContext";
|
|
7
7
|
import { useLexicalComposerContext as Ft } from "@lexical/react/LexicalComposerContext";
|
|
8
|
-
import { ContentEditable as
|
|
9
|
-
import { LexicalErrorBoundary as
|
|
10
|
-
import { HistoryPlugin as
|
|
11
|
-
import { LexicalNestedComposer as
|
|
8
|
+
import { ContentEditable as Yt } from "@lexical/react/LexicalContentEditable";
|
|
9
|
+
import { LexicalErrorBoundary as Ht } from "@lexical/react/LexicalErrorBoundary";
|
|
10
|
+
import { HistoryPlugin as Bt } from "@lexical/react/LexicalHistoryPlugin";
|
|
11
|
+
import { LexicalNestedComposer as jt } from "@lexical/react/LexicalNestedComposer";
|
|
12
12
|
import { OnChangePlugin as Xt } from "@lexical/react/LexicalOnChangePlugin";
|
|
13
13
|
import { RichTextPlugin as Kt } from "@lexical/react/LexicalRichTextPlugin";
|
|
14
14
|
import { useLexicalEditable as Ut } from "@lexical/react/useLexicalEditable";
|
|
15
15
|
import { useLexicalNodeSelection as Gt } from "@lexical/react/useLexicalNodeSelection";
|
|
16
16
|
import { mergeRegister as qt } from "@lexical/utils";
|
|
17
17
|
import { $getRoot as Xe, $createParagraphNode as Vt, $createTextNode as Jt, $isNodeSelection as ge, $getSelection as ce, $isParagraphNode as Ke, $setSelection as we, $isRangeSelection as Qt, SELECTION_CHANGE_COMMAND as Zt, COMMAND_PRIORITY_LOW as de, CLICK_COMMAND as er, DRAGSTART_COMMAND as tr, KEY_DELETE_COMMAND as rr, KEY_BACKSPACE_COMMAND as ir, KEY_ENTER_COMMAND as or, KEY_ESCAPE_COMMAND as nr, $getNodeByKey as se, RootNode as ar, TextNode as cr, LineBreakNode as dr, ParagraphNode as sr, createCommand as lr } from "lexical";
|
|
18
|
-
import { useState as v, useRef as X, useEffect as G, useMemo as
|
|
19
|
-
import { c as
|
|
20
|
-
import { S as
|
|
21
|
-
const
|
|
18
|
+
import { useState as v, useRef as X, useEffect as G, useMemo as rt, useCallback as k, useLayoutEffect as it, Suspense as ur } from "react";
|
|
19
|
+
import { c as at, D as ct, a as dt, b as st, d as lt, e as ut, g as mr, B as Ie, aK as De, t as I, x as hr, aL as re, aM as gr, aN as fr, aO as pr, aP as br, O as xr, Q as H, U as B, ap as wr, V as j, aq as yr, ar as Cr, as as Nr, at as vr, aQ as Rr, am as kr, aR as Er, aS as Ir, a0 as Pr, aT as Sr, aU as $r, r as Mr, aV as Dr, aW as Lr } from "./index-0VTRLfjb.js";
|
|
20
|
+
import { S as Ar } from "./sparkles-DIeZhywG.js";
|
|
21
|
+
const Wr = at("Crop", [
|
|
22
22
|
["path", { d: "M6 2v14a2 2 0 0 0 2 2h14", key: "ron5a4" }],
|
|
23
23
|
["path", { d: "M18 22V8a2 2 0 0 0-2-2H2", key: "7s9ehn" }]
|
|
24
24
|
]);
|
|
25
|
-
const
|
|
26
|
-
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
27
|
-
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
28
|
-
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
29
|
-
]);
|
|
30
|
-
const mt = Ue("RotateCcw", [
|
|
25
|
+
const mt = at("RotateCcw", [
|
|
31
26
|
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
32
27
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
33
|
-
]),
|
|
28
|
+
]), Tr = ({
|
|
34
29
|
open: r,
|
|
35
30
|
onOpenChange: c,
|
|
36
31
|
oldImageUrl: u,
|
|
@@ -165,7 +160,7 @@ function _r(r, c) {
|
|
|
165
160
|
const p = `${c.x},${c.y},${c.width},${c.height}`;
|
|
166
161
|
return `${De.replace(/\/$/, "")}${Or}${u}?crop=${p}`;
|
|
167
162
|
}
|
|
168
|
-
function
|
|
163
|
+
function ot(r) {
|
|
169
164
|
if (!fe(r)) return r;
|
|
170
165
|
try {
|
|
171
166
|
const c = new URL(r);
|
|
@@ -175,9 +170,9 @@ function nt(r) {
|
|
|
175
170
|
}
|
|
176
171
|
}
|
|
177
172
|
function Ee(r) {
|
|
178
|
-
if (!fe(r)) return
|
|
173
|
+
if (!fe(r)) return ot(r);
|
|
179
174
|
const c = ht(r);
|
|
180
|
-
return c ? `${De.replace(/\/$/, "")}/${c}` :
|
|
175
|
+
return c ? `${De.replace(/\/$/, "")}/${c}` : ot(r);
|
|
181
176
|
}
|
|
182
177
|
function Fr({
|
|
183
178
|
open: r,
|
|
@@ -188,7 +183,7 @@ function Fr({
|
|
|
188
183
|
height: y,
|
|
189
184
|
onCropApply: q
|
|
190
185
|
}) {
|
|
191
|
-
const [E, P] = v("freeform"), [K,
|
|
186
|
+
const [E, P] = v("freeform"), [K, T] = v(u), [x, w] = v(!1), f = X(null), D = X(null), [o, z] = v({ x: 0, y: 0, width: 0, height: 0 }), [R, A] = v({ x: 0, y: 0, width: 0, height: 0 }), le = X(null), pe = rt(() => typeof N == "number" && typeof y == "number" && y > 0 ? N / y : o.width > 0 && o.height > 0 ? o.width / o.height : null, [o.height, o.width, y, N]), ye = rt(() => {
|
|
192
187
|
switch (E) {
|
|
193
188
|
case "original":
|
|
194
189
|
return pe;
|
|
@@ -205,14 +200,14 @@ function Fr({
|
|
|
205
200
|
default:
|
|
206
201
|
return null;
|
|
207
202
|
}
|
|
208
|
-
}, [pe, E]), l = 24, O =
|
|
203
|
+
}, [pe, E]), l = 24, O = k(
|
|
209
204
|
(n) => {
|
|
210
205
|
let { x: h, y: C, width: s, height: b } = n;
|
|
211
206
|
const L = o.width, S = o.height;
|
|
212
207
|
return h = Math.max(0, Math.min(h, L - l)), C = Math.max(0, Math.min(C, S - l)), s = Math.max(l, Math.min(s, L - h)), b = Math.max(l, Math.min(b, S - C)), { x: h, y: C, width: s, height: b };
|
|
213
208
|
},
|
|
214
209
|
[o.height, o.width]
|
|
215
|
-
), Ce =
|
|
210
|
+
), Ce = k(
|
|
216
211
|
(n) => {
|
|
217
212
|
if (o.width <= 0 || o.height <= 0) return;
|
|
218
213
|
if (n == null) {
|
|
@@ -236,7 +231,7 @@ function Fr({
|
|
|
236
231
|
);
|
|
237
232
|
},
|
|
238
233
|
[o.height, o.width, O]
|
|
239
|
-
), ue =
|
|
234
|
+
), ue = k(() => {
|
|
240
235
|
const n = f.current, h = D.current;
|
|
241
236
|
if (!n || !h) return;
|
|
242
237
|
let C = 0, s = 0, b = h;
|
|
@@ -248,27 +243,27 @@ function Fr({
|
|
|
248
243
|
width: h.offsetWidth,
|
|
249
244
|
height: h.offsetHeight
|
|
250
245
|
});
|
|
251
|
-
}, []), Z =
|
|
246
|
+
}, []), Z = k(
|
|
252
247
|
(n) => {
|
|
253
248
|
o.width <= 0 || o.height <= 0 || (n.preventDefault(), n.stopPropagation(), n.target.setPointerCapture?.(n.pointerId), le.current = {
|
|
254
249
|
mode: "move",
|
|
255
250
|
startX: n.clientX,
|
|
256
251
|
startY: n.clientY,
|
|
257
|
-
initialRect: { ...
|
|
252
|
+
initialRect: { ...R }
|
|
258
253
|
});
|
|
259
254
|
},
|
|
260
|
-
[o.height, o.width,
|
|
261
|
-
), Ne =
|
|
255
|
+
[o.height, o.width, R]
|
|
256
|
+
), Ne = k(
|
|
262
257
|
(n, h) => {
|
|
263
258
|
o.width <= 0 || o.height <= 0 || (n.preventDefault(), n.stopPropagation(), n.target.setPointerCapture?.(n.pointerId), le.current = {
|
|
264
259
|
mode: h,
|
|
265
260
|
startX: n.clientX,
|
|
266
261
|
startY: n.clientY,
|
|
267
|
-
initialRect: { ...
|
|
262
|
+
initialRect: { ...R }
|
|
268
263
|
});
|
|
269
264
|
},
|
|
270
|
-
[o.height, o.width,
|
|
271
|
-
), Le =
|
|
265
|
+
[o.height, o.width, R]
|
|
266
|
+
), Le = k(async () => {
|
|
272
267
|
if (o.width <= 0 || o.height <= 0) {
|
|
273
268
|
c(!1);
|
|
274
269
|
return;
|
|
@@ -279,17 +274,17 @@ function Fr({
|
|
|
279
274
|
return;
|
|
280
275
|
}
|
|
281
276
|
const h = n.naturalWidth / o.width, C = n.naturalHeight / o.height, s = {
|
|
282
|
-
x: Math.max(0, Math.round(
|
|
283
|
-
y: Math.max(0, Math.round(
|
|
284
|
-
width: Math.max(1, Math.round(
|
|
285
|
-
height: Math.max(1, Math.round(
|
|
277
|
+
x: Math.max(0, Math.round(R.x * h)),
|
|
278
|
+
y: Math.max(0, Math.round(R.y * C)),
|
|
279
|
+
width: Math.max(1, Math.round(R.width * h)),
|
|
280
|
+
height: Math.max(1, Math.round(R.height * C)),
|
|
286
281
|
naturalWidth: n.naturalWidth,
|
|
287
282
|
naturalHeight: n.naturalHeight
|
|
288
283
|
};
|
|
289
284
|
s.width = Math.min(s.width, n.naturalWidth - s.x), s.height = Math.min(s.height, n.naturalHeight - s.y), c(!1), Promise.resolve(q(s));
|
|
290
|
-
}, [o,
|
|
285
|
+
}, [o, R, q, c]);
|
|
291
286
|
return G(() => {
|
|
292
|
-
r && (z({ x: 0, y: 0, width: 0, height: 0 }), A({ x: 0, y: 0, width: 0, height: 0 }), w(!1),
|
|
287
|
+
r && (z({ x: 0, y: 0, width: 0, height: 0 }), A({ x: 0, y: 0, width: 0, height: 0 }), w(!1), T(Ee(u)));
|
|
293
288
|
}, [r, u]), G(() => {
|
|
294
289
|
if (!r) return;
|
|
295
290
|
const n = f.current;
|
|
@@ -324,8 +319,8 @@ function Fr({
|
|
|
324
319
|
return;
|
|
325
320
|
}
|
|
326
321
|
const M = s.mode;
|
|
327
|
-
let ne = _, be = oe,
|
|
328
|
-
M.includes("e") && (
|
|
322
|
+
let ne = _, be = oe, Y = ee, J = F;
|
|
323
|
+
M.includes("e") && (Y = ee + b), M.includes("w") && (ne = _ + b, Y = ee - b), M.includes("s") && (J = F + L), M.includes("n") && (be = oe + L, J = F - L), V != null && V > 0 && (M === "e" || M === "w" ? (J = Y / V, M.includes("n") && (be = oe + F - J)) : M === "n" || M === "s" ? (Y = J * V, M.includes("w") && (ne = _ + ee - Y)) : (J = Y / V, M.includes("n") && (be = oe + F - J), M.includes("w") && (ne = _ + ee - Y))), A(O({ x: ne, y: be, width: Y, height: J }));
|
|
329
324
|
}, h = () => {
|
|
330
325
|
le.current = null;
|
|
331
326
|
};
|
|
@@ -374,10 +369,10 @@ function Fr({
|
|
|
374
369
|
{
|
|
375
370
|
className: "cteditor-absolute cteditor-border-2 cteditor-border-[#8a7df4] cteditor-cursor-move cteditor-select-none",
|
|
376
371
|
style: {
|
|
377
|
-
left: o.x +
|
|
378
|
-
top: o.y +
|
|
379
|
-
width:
|
|
380
|
-
height:
|
|
372
|
+
left: o.x + R.x,
|
|
373
|
+
top: o.y + R.y,
|
|
374
|
+
width: R.width,
|
|
375
|
+
height: R.height
|
|
381
376
|
},
|
|
382
377
|
children: [
|
|
383
378
|
/* @__PURE__ */ e(
|
|
@@ -476,11 +471,11 @@ function Fr({
|
|
|
476
471
|
/* @__PURE__ */ a("div", { className: "cteditor-flex cteditor-items-baseline cteditor-justify-between cteditor-gap-3 cteditor-py-2 cteditor-px-3", children: [
|
|
477
472
|
/* @__PURE__ */ e("span", { className: "cteditor-text-[11px] cteditor-text-foreground/50 cteditor-whitespace-nowrap", children: "Crop size" }),
|
|
478
473
|
/* @__PURE__ */ a("span", { className: "cteditor-font-mono cteditor-text-[13px] cteditor-text-[#8a7df4] cteditor-whitespace-nowrap cteditor-text-right", children: [
|
|
479
|
-
Math.round(
|
|
474
|
+
Math.round(R.width),
|
|
480
475
|
" ",
|
|
481
476
|
/* @__PURE__ */ e("span", { className: "cteditor-text-foreground/30", children: "×" }),
|
|
482
477
|
" ",
|
|
483
|
-
Math.round(
|
|
478
|
+
Math.round(R.height),
|
|
484
479
|
" ",
|
|
485
480
|
/* @__PURE__ */ e("span", { className: "cteditor-text-foreground/30", children: "px" })
|
|
486
481
|
] })
|
|
@@ -527,8 +522,8 @@ function Fr({
|
|
|
527
522
|
}
|
|
528
523
|
) });
|
|
529
524
|
}
|
|
530
|
-
const Pe = /* @__PURE__ */ new Set(),
|
|
531
|
-
function
|
|
525
|
+
const Pe = /* @__PURE__ */ new Set(), nt = lr("RIGHT_CLICK_IMAGE_COMMAND");
|
|
526
|
+
function Yr(r) {
|
|
532
527
|
if (!Pe.has(r))
|
|
533
528
|
throw new Promise((c) => {
|
|
534
529
|
const u = new Image();
|
|
@@ -539,7 +534,7 @@ function Hr(r) {
|
|
|
539
534
|
};
|
|
540
535
|
});
|
|
541
536
|
}
|
|
542
|
-
function
|
|
537
|
+
function Hr({
|
|
543
538
|
altText: r,
|
|
544
539
|
className: c,
|
|
545
540
|
imageRef: u,
|
|
@@ -550,8 +545,8 @@ function Yr({
|
|
|
550
545
|
onError: E,
|
|
551
546
|
onLoad: P
|
|
552
547
|
}) {
|
|
553
|
-
|
|
554
|
-
const K = typeof N == "number",
|
|
548
|
+
Yr(p);
|
|
549
|
+
const K = typeof N == "number", T = typeof y == "number", x = K && T, w = K ? N : "auto", f = T ? y : "auto";
|
|
555
550
|
return /* @__PURE__ */ e(
|
|
556
551
|
"img",
|
|
557
552
|
{
|
|
@@ -570,7 +565,7 @@ function Yr({
|
|
|
570
565
|
width: w,
|
|
571
566
|
height: "auto",
|
|
572
567
|
maxWidth: "100%"
|
|
573
|
-
} :
|
|
568
|
+
} : T ? {
|
|
574
569
|
// Only height known: fix height, let browser compute width.
|
|
575
570
|
width: "auto",
|
|
576
571
|
height: f,
|
|
@@ -585,7 +580,7 @@ function Yr({
|
|
|
585
580
|
}
|
|
586
581
|
);
|
|
587
582
|
}
|
|
588
|
-
function
|
|
583
|
+
function Br() {
|
|
589
584
|
return /* @__PURE__ */ e(
|
|
590
585
|
"img",
|
|
591
586
|
{
|
|
@@ -599,7 +594,7 @@ function jr() {
|
|
|
599
594
|
}
|
|
600
595
|
);
|
|
601
596
|
}
|
|
602
|
-
function
|
|
597
|
+
function jr(r, c = 12e3) {
|
|
603
598
|
return new Promise((u, p) => {
|
|
604
599
|
const N = new Image();
|
|
605
600
|
let y = !1;
|
|
@@ -624,39 +619,39 @@ function mi({
|
|
|
624
619
|
showCaption: E,
|
|
625
620
|
caption: P,
|
|
626
621
|
captionsEnabled: K,
|
|
627
|
-
originalPrompt:
|
|
622
|
+
originalPrompt: T,
|
|
628
623
|
position: x = "none",
|
|
629
624
|
linkUrl: w
|
|
630
625
|
}) {
|
|
631
|
-
const f = X(null), D = X(null), [o, z,
|
|
632
|
-
|
|
626
|
+
const f = X(null), D = X(null), [o, z, R] = Gt(u), [A, le] = v(!1), pe = X(!1), { isCollabActive: ye } = _t(), [l] = Ft(), [O, Ce] = v(null), ue = X(null), [Z, Ne] = v(!1), Le = Ut(), [n, h] = v(!1), C = "cteditor-absolute cteditor-flex cteditor-items-center cteditor-gap-1 z-10 cteditor-text-foreground cteditor-bg-accent cteditor-border cteditor-border-foreground/10 cteditor-rounded-lg cteditor-shadow-md cteditor-p-1 cteditor-h-10 cteditor-w-max", s = "cteditor-h-7 cteditor-w-7 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md hover:cteditor-bg-foreground/10 cteditor-transition-all", b = "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5", L = "cteditor-bg-foreground/10 cteditor-text-foreground cteditor-font-medium", S = "cteditor-text-foreground/80 hover:cteditor-text-foreground", [ie, V] = v(""), [_, oe] = v(!1), [ee, F] = v(!1), [M, ne] = v(""), [be, Y] = v(""), [J, ve] = v(!1), ae = X(null), [Ae, gt] = v(0), [ft, We] = v(!1), Ue = X(null), [pt, Re] = v(null), [Te, ke] = v(!1), [Ge, qe] = v(!1), me = X(null), Se = hr()?.apiKey, ze = Ae > 0 && Ae < 350;
|
|
627
|
+
it(() => {
|
|
633
628
|
if (!o || !ge(O) || Z) {
|
|
634
|
-
|
|
629
|
+
Re(null);
|
|
635
630
|
return;
|
|
636
631
|
}
|
|
637
|
-
const t =
|
|
632
|
+
const t = Ue.current, i = l.getRootElement(), d = t?.parentElement;
|
|
638
633
|
if (!t || !i || !d) {
|
|
639
|
-
|
|
634
|
+
Re(null);
|
|
640
635
|
return;
|
|
641
636
|
}
|
|
642
|
-
const m = i.getBoundingClientRect(), g = d.getBoundingClientRect(), $ = t.getBoundingClientRect(),
|
|
637
|
+
const m = i.getBoundingClientRect(), g = d.getBoundingClientRect(), $ = t.getBoundingClientRect(), W = 8, U = $.width;
|
|
643
638
|
if (U <= 0) {
|
|
644
|
-
|
|
639
|
+
Re(null);
|
|
645
640
|
return;
|
|
646
641
|
}
|
|
647
642
|
if (ze) {
|
|
648
|
-
const he = g.left + g.width / 2 - U / 2, Q = Math.max(m.left +
|
|
649
|
-
|
|
643
|
+
const he = g.left + g.width / 2 - U / 2, Q = Math.max(m.left + W, Math.min(he, m.right - W - U));
|
|
644
|
+
Re({
|
|
650
645
|
left: Q - g.left,
|
|
651
646
|
bottom: 0,
|
|
652
647
|
right: "auto",
|
|
653
648
|
transform: "translateY(100%) translateY(4px)"
|
|
654
649
|
});
|
|
655
650
|
} else {
|
|
656
|
-
const he = g.right -
|
|
657
|
-
|
|
651
|
+
const he = g.right - W - U, Q = Math.max(m.left + W, Math.min(he, m.right - W - U));
|
|
652
|
+
Re({
|
|
658
653
|
left: Q - g.left,
|
|
659
|
-
top:
|
|
654
|
+
top: W,
|
|
660
655
|
right: "auto"
|
|
661
656
|
});
|
|
662
657
|
}
|
|
@@ -669,7 +664,7 @@ function mi({
|
|
|
669
664
|
const i = new ResizeObserver(t);
|
|
670
665
|
return i.observe(f.current), () => i.disconnect();
|
|
671
666
|
}
|
|
672
|
-
}, [p, N, o]),
|
|
667
|
+
}, [p, N, o]), it(() => {
|
|
673
668
|
if ((x === "left" || x === "right") && typeof p == "number" && f.current) {
|
|
674
669
|
const t = f.current.closest(".editor-image"), i = t?.parentElement, d = l.getRootElement(), m = d ? d.getBoundingClientRect().width : p + 32, g = `${Math.min(p + 32, m)}px`;
|
|
675
670
|
return t && (t.style.removeProperty("display"), t.style.setProperty("max-width", g, "important")), i && i.style.setProperty("max-width", g, "important"), () => {
|
|
@@ -677,7 +672,7 @@ function mi({
|
|
|
677
672
|
};
|
|
678
673
|
}
|
|
679
674
|
}, [x, p, l]);
|
|
680
|
-
const Oe =
|
|
675
|
+
const Oe = k(
|
|
681
676
|
(t) => {
|
|
682
677
|
const i = ce();
|
|
683
678
|
return o && ge(i) && (t.preventDefault(), l.update(() => {
|
|
@@ -690,7 +685,7 @@ function mi({
|
|
|
690
685
|
})), !1;
|
|
691
686
|
},
|
|
692
687
|
[l, o]
|
|
693
|
-
),
|
|
688
|
+
), Ve = k(
|
|
694
689
|
(t) => {
|
|
695
690
|
const i = ce(), d = D.current;
|
|
696
691
|
if (o && ge(i) && i.getNodes().length === 1) {
|
|
@@ -702,14 +697,14 @@ function mi({
|
|
|
702
697
|
return !1;
|
|
703
698
|
},
|
|
704
699
|
[P, o, E]
|
|
705
|
-
),
|
|
700
|
+
), Je = k(
|
|
706
701
|
(t) => ue.current === P || D.current === t.target ? (we(null), l.update(() => {
|
|
707
702
|
z(!0);
|
|
708
703
|
const i = l.getRootElement();
|
|
709
704
|
i !== null && i.focus();
|
|
710
705
|
}), !0) : !1,
|
|
711
706
|
[P, l, z]
|
|
712
|
-
), _e =
|
|
707
|
+
), _e = k(
|
|
713
708
|
(t) => {
|
|
714
709
|
const i = t;
|
|
715
710
|
if (A)
|
|
@@ -723,15 +718,15 @@ function mi({
|
|
|
723
718
|
const $ = f.current.getBoundingClientRect();
|
|
724
719
|
g = i.clientX >= $.left && i.clientX <= $.right && i.clientY >= $.top && i.clientY <= $.bottom;
|
|
725
720
|
}
|
|
726
|
-
return m || g ? (i.shiftKey ? z(!o) : (
|
|
721
|
+
return m || g ? (i.shiftKey ? z(!o) : (R(), z(!0)), !0) : !1;
|
|
727
722
|
},
|
|
728
|
-
[A, o, z,
|
|
729
|
-
), Fe =
|
|
723
|
+
[A, o, z, R]
|
|
724
|
+
), Fe = k(
|
|
730
725
|
(t) => {
|
|
731
726
|
l.getEditorState().read(() => {
|
|
732
727
|
const i = ce();
|
|
733
728
|
t.target.tagName === "IMG" && Qt(i) && i.getNodes().length === 1 && l.dispatchCommand(
|
|
734
|
-
|
|
729
|
+
nt,
|
|
735
730
|
t
|
|
736
731
|
);
|
|
737
732
|
});
|
|
@@ -755,7 +750,7 @@ function mi({
|
|
|
755
750
|
de
|
|
756
751
|
),
|
|
757
752
|
l.registerCommand(
|
|
758
|
-
|
|
753
|
+
nt,
|
|
759
754
|
_e,
|
|
760
755
|
de
|
|
761
756
|
),
|
|
@@ -774,10 +769,10 @@ function mi({
|
|
|
774
769
|
Oe,
|
|
775
770
|
de
|
|
776
771
|
),
|
|
777
|
-
l.registerCommand(or,
|
|
772
|
+
l.registerCommand(or, Ve, de),
|
|
778
773
|
l.registerCommand(
|
|
779
774
|
nr,
|
|
780
|
-
|
|
775
|
+
Je,
|
|
781
776
|
de
|
|
782
777
|
)
|
|
783
778
|
);
|
|
@@ -785,14 +780,14 @@ function mi({
|
|
|
785
780
|
t = !1, d(), i?.removeEventListener("contextmenu", Fe);
|
|
786
781
|
};
|
|
787
782
|
}, [
|
|
788
|
-
|
|
783
|
+
R,
|
|
789
784
|
l,
|
|
790
785
|
A,
|
|
791
786
|
o,
|
|
792
787
|
u,
|
|
793
788
|
Oe,
|
|
789
|
+
Ve,
|
|
794
790
|
Je,
|
|
795
|
-
Qe,
|
|
796
791
|
_e,
|
|
797
792
|
Fe,
|
|
798
793
|
z
|
|
@@ -861,9 +856,9 @@ function mi({
|
|
|
861
856
|
});
|
|
862
857
|
}, Nt = (t) => {
|
|
863
858
|
t.preventDefault(), t.stopPropagation(), h(!n);
|
|
864
|
-
}, vt =
|
|
865
|
-
t.preventDefault(), t.stopPropagation(),
|
|
866
|
-
}, []),
|
|
859
|
+
}, vt = k((t) => {
|
|
860
|
+
t.preventDefault(), t.stopPropagation(), We(!0);
|
|
861
|
+
}, []), Rt = k(
|
|
867
862
|
(t) => {
|
|
868
863
|
t.preventDefault(), t.stopPropagation();
|
|
869
864
|
const i = Ee(r);
|
|
@@ -874,8 +869,8 @@ function mi({
|
|
|
874
869
|
const $ = se(u);
|
|
875
870
|
if (!re($)) return;
|
|
876
871
|
$.setSrc(i), $.setWidthAndHeight("inherit", "inherit");
|
|
877
|
-
const
|
|
878
|
-
|
|
872
|
+
const W = ce();
|
|
873
|
+
W && we(W.clone());
|
|
879
874
|
},
|
|
880
875
|
{ tag: "image-reset" }
|
|
881
876
|
);
|
|
@@ -885,7 +880,7 @@ function mi({
|
|
|
885
880
|
}), I.success("Image reset to original size and crop");
|
|
886
881
|
},
|
|
887
882
|
[l, u, r, p, N]
|
|
888
|
-
),
|
|
883
|
+
), kt = k(
|
|
889
884
|
async (t) => {
|
|
890
885
|
let i = r;
|
|
891
886
|
if (fe(r))
|
|
@@ -912,9 +907,9 @@ function mi({
|
|
|
912
907
|
I.error("Cropping is only supported for images hosted on the CDN.");
|
|
913
908
|
return;
|
|
914
909
|
}
|
|
915
|
-
|
|
910
|
+
ke(!0), me.current = d;
|
|
916
911
|
try {
|
|
917
|
-
await
|
|
912
|
+
await jr(d), Pe.add(d), l.update(() => {
|
|
918
913
|
const m = se(u);
|
|
919
914
|
if (!re(m)) return;
|
|
920
915
|
m.setSrc(d), m.setWidthAndHeight(t.width, t.height);
|
|
@@ -922,27 +917,27 @@ function mi({
|
|
|
922
917
|
g && we(g.clone());
|
|
923
918
|
}), I.success("Image cropped");
|
|
924
919
|
} catch {
|
|
925
|
-
me.current = null,
|
|
920
|
+
me.current = null, ke(!1), I.error("Crop failed to load. Showing original image.");
|
|
926
921
|
}
|
|
927
922
|
},
|
|
928
923
|
[l, u, r, Se]
|
|
929
|
-
), Et =
|
|
924
|
+
), Et = k(() => {
|
|
930
925
|
w && !o && (ae.current = setTimeout(() => {
|
|
931
926
|
ve(!0);
|
|
932
927
|
}, 300));
|
|
933
|
-
}, [w, o]), It =
|
|
928
|
+
}, [w, o]), It = k(() => {
|
|
934
929
|
ae.current && (clearTimeout(ae.current), ae.current = null), ve(!1);
|
|
935
|
-
}, []),
|
|
930
|
+
}, []), Qe = k((t) => {
|
|
936
931
|
t.preventDefault(), t.stopPropagation(), w && window.open(w, "_blank", "noopener,noreferrer");
|
|
937
932
|
}, [w]);
|
|
938
933
|
G(() => () => {
|
|
939
934
|
ae.current && clearTimeout(ae.current);
|
|
940
935
|
}, []), G(() => {
|
|
941
|
-
o ||
|
|
936
|
+
o || We(!1);
|
|
942
937
|
}, [o]), G(() => {
|
|
943
|
-
Ne(!1),
|
|
938
|
+
Ne(!1), qe(!1);
|
|
944
939
|
}, [r]);
|
|
945
|
-
const
|
|
940
|
+
const Ze = async () => {
|
|
946
941
|
if (!ie.trim() || _) return;
|
|
947
942
|
oe(!0);
|
|
948
943
|
const t = I.loading("Refining image...", {
|
|
@@ -951,7 +946,7 @@ function mi({
|
|
|
951
946
|
try {
|
|
952
947
|
let i = ie.trim();
|
|
953
948
|
const m = ie.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim(), g = (Q) => {
|
|
954
|
-
const
|
|
949
|
+
const Be = Q.toLowerCase();
|
|
955
950
|
return [
|
|
956
951
|
"article",
|
|
957
952
|
"write",
|
|
@@ -968,15 +963,15 @@ function mi({
|
|
|
968
963
|
"add some images",
|
|
969
964
|
"include images",
|
|
970
965
|
"include pictures"
|
|
971
|
-
].some(($e) =>
|
|
966
|
+
].some(($e) => Be.includes($e));
|
|
972
967
|
};
|
|
973
968
|
let $ = "";
|
|
974
|
-
if (
|
|
975
|
-
const Q =
|
|
969
|
+
if (T && T.trim()) {
|
|
970
|
+
const Q = T.trim();
|
|
976
971
|
g(Q) && c && c !== "Generated image" && c.trim() ? $ = c.trim() : $ = Q;
|
|
977
972
|
} else c && c !== "Generated image" && c.trim() && ($ = c.trim());
|
|
978
973
|
$ ? i = `${$} with ${m}` : i = m;
|
|
979
|
-
const
|
|
974
|
+
const W = await fetch(`${Mr}/agent/stream`, {
|
|
980
975
|
method: "POST",
|
|
981
976
|
headers: { "Content-Type": "application/json" },
|
|
982
977
|
body: JSON.stringify({
|
|
@@ -986,22 +981,22 @@ function mi({
|
|
|
986
981
|
api_key: Se || ""
|
|
987
982
|
})
|
|
988
983
|
});
|
|
989
|
-
if (!
|
|
990
|
-
throw new Error(`Image service error: ${
|
|
991
|
-
const U =
|
|
984
|
+
if (!W.ok)
|
|
985
|
+
throw new Error(`Image service error: ${W.status}`);
|
|
986
|
+
const U = W.body?.getReader(), He = new TextDecoder();
|
|
992
987
|
if (!U) throw new Error("Stream reader not available");
|
|
993
988
|
let he = null;
|
|
994
989
|
e: for (; ; ) {
|
|
995
|
-
const { done: Q, value:
|
|
990
|
+
const { done: Q, value: Be } = await U.read();
|
|
996
991
|
if (Q) break;
|
|
997
|
-
const
|
|
992
|
+
const tt = He.decode(Be, { stream: !0 }).split(`
|
|
998
993
|
`);
|
|
999
|
-
for (const $e of
|
|
994
|
+
for (const $e of tt) {
|
|
1000
995
|
if (!$e.startsWith("data: ")) continue;
|
|
1001
|
-
const
|
|
1002
|
-
if (!(!
|
|
996
|
+
const je = $e.slice(6).trim();
|
|
997
|
+
if (!(!je || je === "[DONE]"))
|
|
1003
998
|
try {
|
|
1004
|
-
const te = JSON.parse(
|
|
999
|
+
const te = JSON.parse(je);
|
|
1005
1000
|
if (te.type === "image_ready") {
|
|
1006
1001
|
he = te.url, U.cancel();
|
|
1007
1002
|
break e;
|
|
@@ -1021,15 +1016,15 @@ function mi({
|
|
|
1021
1016
|
throw new Error("Failed to generate image - no image received");
|
|
1022
1017
|
I.dismiss(t), I.success("Image refined successfully!", {
|
|
1023
1018
|
description: "Compare the images and choose which to keep."
|
|
1024
|
-
}), ne(he),
|
|
1019
|
+
}), ne(he), Y(i), F(!0), V(""), h(!1);
|
|
1025
1020
|
} catch (i) {
|
|
1026
|
-
if (I.dismiss(t), i instanceof
|
|
1021
|
+
if (I.dismiss(t), i instanceof Dr) {
|
|
1027
1022
|
const d = i.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
1028
1023
|
I.error(d, {
|
|
1029
1024
|
description: i.message,
|
|
1030
1025
|
duration: 8e3
|
|
1031
1026
|
});
|
|
1032
|
-
} else i instanceof
|
|
1027
|
+
} else i instanceof Lr ? I.error("Credits Issue", {
|
|
1033
1028
|
description: i.message,
|
|
1034
1029
|
duration: 8e3
|
|
1035
1030
|
}) : I.error("Failed to refine image", {
|
|
@@ -1046,26 +1041,26 @@ function mi({
|
|
|
1046
1041
|
const i = ce();
|
|
1047
1042
|
i && we(i.clone());
|
|
1048
1043
|
}
|
|
1049
|
-
}), F(!1), ne(""),
|
|
1044
|
+
}), F(!1), ne(""), Y(""), I.success("Image replaced successfully!", {
|
|
1050
1045
|
description: "The image has been updated with the refined version."
|
|
1051
1046
|
});
|
|
1052
1047
|
}, St = () => {
|
|
1053
|
-
F(!1), ne(""),
|
|
1054
|
-
}, $t = o && ge(O) && !A,
|
|
1055
|
-
me.current && r === me.current && (Pe.add(r), me.current = null,
|
|
1056
|
-
}, [r]), Dt =
|
|
1057
|
-
if (!
|
|
1058
|
-
|
|
1048
|
+
F(!1), ne(""), Y("");
|
|
1049
|
+
}, $t = o && ge(O) && !A, et = (o || A) && Le, Ye = Ee(r), Mt = k(() => {
|
|
1050
|
+
me.current && r === me.current && (Pe.add(r), me.current = null, ke(!1));
|
|
1051
|
+
}, [r]), Dt = k(() => {
|
|
1052
|
+
if (!Ge && fe(r) && r !== Ye) {
|
|
1053
|
+
qe(!0), Ne(!1), ke(!1), me.current = null, l.update(() => {
|
|
1059
1054
|
const i = se(u);
|
|
1060
1055
|
if (!re(i)) return;
|
|
1061
|
-
i.setSrc(
|
|
1056
|
+
i.setSrc(Ye);
|
|
1062
1057
|
const d = ce();
|
|
1063
1058
|
d && we(d.clone());
|
|
1064
1059
|
}), I.error("Cropped image failed. Showing original image instead.");
|
|
1065
1060
|
return;
|
|
1066
1061
|
}
|
|
1067
|
-
|
|
1068
|
-
}, [
|
|
1062
|
+
ke(!1), me.current = null, Ne(!0);
|
|
1063
|
+
}, [Ge, r, Ye, l, u]), Lt = () => x === "left" || x === "right" ? {
|
|
1069
1064
|
position: "relative",
|
|
1070
1065
|
display: "block",
|
|
1071
1066
|
width: "100%"
|
|
@@ -1093,7 +1088,7 @@ function mi({
|
|
|
1093
1088
|
} : {
|
|
1094
1089
|
position: "relative",
|
|
1095
1090
|
display: "inline-block"
|
|
1096
|
-
}, At =
|
|
1091
|
+
}, At = k(
|
|
1097
1092
|
(t) => {
|
|
1098
1093
|
if (A || t.target.closest("button"))
|
|
1099
1094
|
return;
|
|
@@ -1103,9 +1098,9 @@ function mi({
|
|
|
1103
1098
|
const g = f.current.getBoundingClientRect();
|
|
1104
1099
|
m = t.clientX >= g.left && t.clientX <= g.right && t.clientY >= g.top && t.clientY <= g.bottom;
|
|
1105
1100
|
}
|
|
1106
|
-
!d && !m || (t.stopPropagation(), t.shiftKey ? z(!o) : (
|
|
1101
|
+
!d && !m || (t.stopPropagation(), t.shiftKey ? z(!o) : (R(), z(!0)));
|
|
1107
1102
|
},
|
|
1108
|
-
[A, o, z,
|
|
1103
|
+
[A, o, z, R]
|
|
1109
1104
|
);
|
|
1110
1105
|
return /* @__PURE__ */ e(ur, { fallback: null, children: /* @__PURE__ */ a(Me, { children: [
|
|
1111
1106
|
/* @__PURE__ */ a(
|
|
@@ -1117,10 +1112,10 @@ function mi({
|
|
|
1117
1112
|
onMouseEnter: Et,
|
|
1118
1113
|
onMouseLeave: It,
|
|
1119
1114
|
children: [
|
|
1120
|
-
Z ? /* @__PURE__ */ e(
|
|
1121
|
-
|
|
1115
|
+
Z ? /* @__PURE__ */ e(Br, {}) : /* @__PURE__ */ e(
|
|
1116
|
+
Hr,
|
|
1122
1117
|
{
|
|
1123
|
-
className:
|
|
1118
|
+
className: et ? `focused ${ge(O) ? "draggable" : ""}` : w ? "cteditor-cursor-pointer" : null,
|
|
1124
1119
|
src: r,
|
|
1125
1120
|
altText: c,
|
|
1126
1121
|
imageRef: f,
|
|
@@ -1131,7 +1126,7 @@ function mi({
|
|
|
1131
1126
|
onError: Dt
|
|
1132
1127
|
}
|
|
1133
1128
|
),
|
|
1134
|
-
|
|
1129
|
+
Te && !Z && /* @__PURE__ */ a("div", { className: "cteditor-absolute cteditor-inset-0 cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-rounded-lg cteditor-bg-background/50 cteditor-backdrop-blur-[1px] cteditor-pointer-events-none", children: [
|
|
1135
1130
|
/* @__PURE__ */ e(pr, { className: "cteditor-w-10 cteditor-h-10 cteditor-text-foreground cteditor-animate-spin cteditor-mb-2", "aria-hidden": !0 }),
|
|
1136
1131
|
/* @__PURE__ */ e("span", { className: "cteditor-text-sm cteditor-font-medium cteditor-text-foreground", children: "Applying crop..." })
|
|
1137
1132
|
] }),
|
|
@@ -1141,13 +1136,13 @@ function mi({
|
|
|
1141
1136
|
className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background cteditor-rounded-lg cteditor-shadow-lg cteditor-border cteditor-border-border cteditor-p-2 cteditor-flex cteditor-items-center cteditor-gap-2",
|
|
1142
1137
|
style: { zIndex: 10 },
|
|
1143
1138
|
children: [
|
|
1144
|
-
/* @__PURE__ */ e(
|
|
1139
|
+
/* @__PURE__ */ e(br, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
|
|
1145
1140
|
/* @__PURE__ */ e("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: w }),
|
|
1146
1141
|
/* @__PURE__ */ e(
|
|
1147
1142
|
"button",
|
|
1148
1143
|
{
|
|
1149
1144
|
type: "button",
|
|
1150
|
-
onClick:
|
|
1145
|
+
onClick: Qe,
|
|
1151
1146
|
className: "cteditor-px-2 cteditor-py-1.5 cteditor-text-xs cteditor-rounded cteditor-bg-primary cteditor-text-primary-foreground hover:cteditor-bg-primary/90 cteditor-transition-colors cteditor-flex-shrink-0",
|
|
1152
1147
|
children: "Open"
|
|
1153
1148
|
}
|
|
@@ -1155,145 +1150,145 @@ function mi({
|
|
|
1155
1150
|
]
|
|
1156
1151
|
}
|
|
1157
1152
|
),
|
|
1158
|
-
o && ge(O) && !Z && !
|
|
1153
|
+
o && ge(O) && !Z && !Te && /* @__PURE__ */ e(xr, { delayDuration: 300, children: /* @__PURE__ */ a(
|
|
1159
1154
|
"div",
|
|
1160
1155
|
{
|
|
1161
|
-
ref:
|
|
1156
|
+
ref: Ue,
|
|
1162
1157
|
className: C,
|
|
1163
1158
|
style: pt ?? (ze ? { left: "50%", transform: "translateX(-50%) translateY(100%) translateY(4px)", bottom: 0 } : { top: 8, right: 8 }),
|
|
1164
1159
|
children: [
|
|
1165
|
-
/* @__PURE__ */ a(
|
|
1166
|
-
/* @__PURE__ */ e(
|
|
1160
|
+
/* @__PURE__ */ a(H, { children: [
|
|
1161
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1167
1162
|
"button",
|
|
1168
1163
|
{
|
|
1169
1164
|
type: "button",
|
|
1170
1165
|
onClick: (t) => xe(t, "left"),
|
|
1171
1166
|
className: `${s} ${x === "left" ? L : S}`,
|
|
1172
1167
|
"aria-label": "Wrap text left",
|
|
1173
|
-
children: /* @__PURE__ */ e(
|
|
1168
|
+
children: /* @__PURE__ */ e(wr, {})
|
|
1174
1169
|
}
|
|
1175
1170
|
) }),
|
|
1176
|
-
/* @__PURE__ */ e(
|
|
1171
|
+
/* @__PURE__ */ e(j, { children: "Wrap text left" })
|
|
1177
1172
|
] }),
|
|
1178
|
-
/* @__PURE__ */ a(
|
|
1179
|
-
/* @__PURE__ */ e(
|
|
1173
|
+
/* @__PURE__ */ a(H, { children: [
|
|
1174
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1180
1175
|
"button",
|
|
1181
1176
|
{
|
|
1182
1177
|
type: "button",
|
|
1183
1178
|
onClick: (t) => xe(t, "right"),
|
|
1184
1179
|
className: `${s} ${x === "right" ? L : S}`,
|
|
1185
1180
|
"aria-label": "Wrap text right",
|
|
1186
|
-
children: /* @__PURE__ */ e(
|
|
1181
|
+
children: /* @__PURE__ */ e(yr, {})
|
|
1187
1182
|
}
|
|
1188
1183
|
) }),
|
|
1189
|
-
/* @__PURE__ */ e(
|
|
1184
|
+
/* @__PURE__ */ e(j, { children: "Wrap text right" })
|
|
1190
1185
|
] }),
|
|
1191
1186
|
/* @__PURE__ */ e("div", { className: b }),
|
|
1192
|
-
/* @__PURE__ */ a(
|
|
1193
|
-
/* @__PURE__ */ e(
|
|
1187
|
+
/* @__PURE__ */ a(H, { children: [
|
|
1188
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1194
1189
|
"button",
|
|
1195
1190
|
{
|
|
1196
1191
|
type: "button",
|
|
1197
1192
|
onClick: (t) => xe(t, "inline-left"),
|
|
1198
1193
|
className: `${s} ${x === "inline-left" ? L : S}`,
|
|
1199
1194
|
"aria-label": "Align left",
|
|
1200
|
-
children: /* @__PURE__ */ e(
|
|
1195
|
+
children: /* @__PURE__ */ e(Cr, {})
|
|
1201
1196
|
}
|
|
1202
1197
|
) }),
|
|
1203
|
-
/* @__PURE__ */ e(
|
|
1198
|
+
/* @__PURE__ */ e(j, { children: "Align left (no text wrap)" })
|
|
1204
1199
|
] }),
|
|
1205
|
-
/* @__PURE__ */ a(
|
|
1206
|
-
/* @__PURE__ */ e(
|
|
1200
|
+
/* @__PURE__ */ a(H, { children: [
|
|
1201
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1207
1202
|
"button",
|
|
1208
1203
|
{
|
|
1209
1204
|
type: "button",
|
|
1210
1205
|
onClick: (t) => xe(t, "inline-center"),
|
|
1211
1206
|
className: `${s} ${x === "inline-center" || x === "full" ? L : S}`,
|
|
1212
1207
|
"aria-label": "Align center",
|
|
1213
|
-
children: /* @__PURE__ */ e(
|
|
1208
|
+
children: /* @__PURE__ */ e(Nr, {})
|
|
1214
1209
|
}
|
|
1215
1210
|
) }),
|
|
1216
|
-
/* @__PURE__ */ e(
|
|
1211
|
+
/* @__PURE__ */ e(j, { children: "Align center (no text wrap)" })
|
|
1217
1212
|
] }),
|
|
1218
|
-
/* @__PURE__ */ a(
|
|
1219
|
-
/* @__PURE__ */ e(
|
|
1213
|
+
/* @__PURE__ */ a(H, { children: [
|
|
1214
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1220
1215
|
"button",
|
|
1221
1216
|
{
|
|
1222
1217
|
type: "button",
|
|
1223
1218
|
onClick: (t) => xe(t, "inline-right"),
|
|
1224
1219
|
className: `${s} ${x === "inline-right" ? L : S}`,
|
|
1225
1220
|
"aria-label": "Align right",
|
|
1226
|
-
children: /* @__PURE__ */ e(
|
|
1221
|
+
children: /* @__PURE__ */ e(vr, {})
|
|
1227
1222
|
}
|
|
1228
1223
|
) }),
|
|
1229
|
-
/* @__PURE__ */ e(
|
|
1224
|
+
/* @__PURE__ */ e(j, { children: "Align right (no text wrap)" })
|
|
1230
1225
|
] }),
|
|
1231
1226
|
/* @__PURE__ */ e("div", { className: b }),
|
|
1232
|
-
/* @__PURE__ */ a(
|
|
1233
|
-
/* @__PURE__ */ e(
|
|
1227
|
+
/* @__PURE__ */ a(H, { children: [
|
|
1228
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1234
1229
|
"button",
|
|
1235
1230
|
{
|
|
1236
1231
|
type: "button",
|
|
1237
1232
|
onClick: (t) => xe(t, "none"),
|
|
1238
1233
|
className: `${s} ${x === "none" ? L : S}`,
|
|
1239
1234
|
"aria-label": "Inline",
|
|
1240
|
-
children: /* @__PURE__ */ e(
|
|
1235
|
+
children: /* @__PURE__ */ e(Rr, { className: "cteditor-w-4 cteditor-h-4" })
|
|
1241
1236
|
}
|
|
1242
1237
|
) }),
|
|
1243
|
-
/* @__PURE__ */ e(
|
|
1238
|
+
/* @__PURE__ */ e(j, { children: "Inline with text" })
|
|
1244
1239
|
] }),
|
|
1245
1240
|
!r.startsWith("data:") && !r.toLowerCase().endsWith(".svg") && /* @__PURE__ */ a(Me, { children: [
|
|
1246
1241
|
/* @__PURE__ */ e("div", { className: b }),
|
|
1247
|
-
/* @__PURE__ */ a(
|
|
1248
|
-
/* @__PURE__ */ e(
|
|
1242
|
+
/* @__PURE__ */ a(H, { children: [
|
|
1243
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1249
1244
|
"button",
|
|
1250
1245
|
{
|
|
1251
1246
|
type: "button",
|
|
1252
1247
|
onClick: vt,
|
|
1253
1248
|
className: `${s} ${S}`,
|
|
1254
1249
|
"aria-label": "Crop image",
|
|
1255
|
-
children: /* @__PURE__ */ e(
|
|
1250
|
+
children: /* @__PURE__ */ e(Wr, { className: "cteditor-w-4 cteditor-h-4" })
|
|
1256
1251
|
}
|
|
1257
1252
|
) }),
|
|
1258
|
-
/* @__PURE__ */ e(
|
|
1253
|
+
/* @__PURE__ */ e(j, { children: "Crop image" })
|
|
1259
1254
|
] }),
|
|
1260
|
-
(Ee(r) !== r || typeof p == "number" || typeof N == "number") && /* @__PURE__ */ a(
|
|
1261
|
-
/* @__PURE__ */ e(
|
|
1255
|
+
(Ee(r) !== r || typeof p == "number" || typeof N == "number") && /* @__PURE__ */ a(H, { children: [
|
|
1256
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1262
1257
|
"button",
|
|
1263
1258
|
{
|
|
1264
1259
|
type: "button",
|
|
1265
|
-
onClick:
|
|
1260
|
+
onClick: Rt,
|
|
1266
1261
|
className: `${s} ${S}`,
|
|
1267
1262
|
"aria-label": "Reset image to original size and crop",
|
|
1268
1263
|
children: /* @__PURE__ */ e(mt, { className: "cteditor-w-4 cteditor-h-4" })
|
|
1269
1264
|
}
|
|
1270
1265
|
) }),
|
|
1271
|
-
/* @__PURE__ */ e(
|
|
1266
|
+
/* @__PURE__ */ e(j, { children: "Reset to original size and crop" })
|
|
1272
1267
|
] })
|
|
1273
1268
|
] }),
|
|
1274
1269
|
w && /* @__PURE__ */ a(Me, { children: [
|
|
1275
1270
|
/* @__PURE__ */ e("div", { className: b }),
|
|
1276
|
-
/* @__PURE__ */ a(
|
|
1277
|
-
/* @__PURE__ */ e(
|
|
1271
|
+
/* @__PURE__ */ a(H, { children: [
|
|
1272
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1278
1273
|
"button",
|
|
1279
1274
|
{
|
|
1280
1275
|
type: "button",
|
|
1281
|
-
onClick:
|
|
1276
|
+
onClick: Qe,
|
|
1282
1277
|
className: `${s} ${S}`,
|
|
1283
1278
|
"aria-label": "Visit link",
|
|
1284
1279
|
children: /* @__PURE__ */ e(kr, {})
|
|
1285
1280
|
}
|
|
1286
1281
|
) }),
|
|
1287
|
-
/* @__PURE__ */ a(
|
|
1282
|
+
/* @__PURE__ */ a(j, { children: [
|
|
1288
1283
|
"Visit: ",
|
|
1289
1284
|
w
|
|
1290
1285
|
] })
|
|
1291
1286
|
] })
|
|
1292
1287
|
] }),
|
|
1293
|
-
|
|
1288
|
+
T && /* @__PURE__ */ a(Me, { children: [
|
|
1294
1289
|
/* @__PURE__ */ e("div", { className: b }),
|
|
1295
|
-
/* @__PURE__ */ a(
|
|
1296
|
-
/* @__PURE__ */ e(
|
|
1290
|
+
/* @__PURE__ */ a(H, { children: [
|
|
1291
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ a(
|
|
1297
1292
|
"button",
|
|
1298
1293
|
{
|
|
1299
1294
|
type: "button",
|
|
@@ -1303,17 +1298,17 @@ function mi({
|
|
|
1303
1298
|
className: `cteditor-h-8 cteditor-px-2.5 cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-rounded-md hover:cteditor-bg-foreground/10 cteditor-transition-colors ${S}`,
|
|
1304
1299
|
"aria-label": "Refine image",
|
|
1305
1300
|
children: [
|
|
1306
|
-
/* @__PURE__ */ e(
|
|
1301
|
+
/* @__PURE__ */ e(Ar, { className: "cteditor-size-3.5" }),
|
|
1307
1302
|
/* @__PURE__ */ e("span", { className: "cteditor-text-[11px] cteditor-font-medium", children: "AI" })
|
|
1308
1303
|
]
|
|
1309
1304
|
}
|
|
1310
1305
|
) }),
|
|
1311
|
-
/* @__PURE__ */ e(
|
|
1306
|
+
/* @__PURE__ */ e(j, { children: "Refine image" })
|
|
1312
1307
|
] })
|
|
1313
1308
|
] }),
|
|
1314
1309
|
/* @__PURE__ */ e("div", { className: b }),
|
|
1315
|
-
/* @__PURE__ */ a(
|
|
1316
|
-
/* @__PURE__ */ e(
|
|
1310
|
+
/* @__PURE__ */ a(H, { children: [
|
|
1311
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1317
1312
|
"button",
|
|
1318
1313
|
{
|
|
1319
1314
|
type: "button",
|
|
@@ -1322,13 +1317,13 @@ function mi({
|
|
|
1322
1317
|
},
|
|
1323
1318
|
className: `${s} ${S}`,
|
|
1324
1319
|
"aria-label": "Open image in new tab",
|
|
1325
|
-
children: /* @__PURE__ */ e(
|
|
1320
|
+
children: /* @__PURE__ */ e(Er, {})
|
|
1326
1321
|
}
|
|
1327
1322
|
) }),
|
|
1328
|
-
/* @__PURE__ */ e(
|
|
1323
|
+
/* @__PURE__ */ e(j, { children: "Open in new tab" })
|
|
1329
1324
|
] }),
|
|
1330
|
-
/* @__PURE__ */ a(
|
|
1331
|
-
/* @__PURE__ */ e(
|
|
1325
|
+
/* @__PURE__ */ a(H, { children: [
|
|
1326
|
+
/* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1332
1327
|
"button",
|
|
1333
1328
|
{
|
|
1334
1329
|
type: "button",
|
|
@@ -1337,15 +1332,15 @@ function mi({
|
|
|
1337
1332
|
},
|
|
1338
1333
|
className: `${s} hover:cteditor-bg-red-500/10 hover:cteditor-text-red-500 cteditor-text-foreground/80`,
|
|
1339
1334
|
"aria-label": "Delete image",
|
|
1340
|
-
children: /* @__PURE__ */ e(
|
|
1335
|
+
children: /* @__PURE__ */ e(Ir, {})
|
|
1341
1336
|
}
|
|
1342
1337
|
) }),
|
|
1343
|
-
/* @__PURE__ */ e(
|
|
1338
|
+
/* @__PURE__ */ e(j, { children: "Delete image" })
|
|
1344
1339
|
] })
|
|
1345
1340
|
]
|
|
1346
1341
|
}
|
|
1347
1342
|
) }),
|
|
1348
|
-
n && o && !Z &&
|
|
1343
|
+
n && o && !Z && T && /* @__PURE__ */ e(
|
|
1349
1344
|
"div",
|
|
1350
1345
|
{
|
|
1351
1346
|
className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background/85 cteditor-rounded-lg cteditor-shadow-xl cteditor-border cteditor-border-foreground/20 cteditor-p-3 cteditor-backdrop-blur-lg md:cteditor-min-w-80",
|
|
@@ -1362,7 +1357,7 @@ function mi({
|
|
|
1362
1357
|
value: ie,
|
|
1363
1358
|
onChange: (t) => V(t.target.value),
|
|
1364
1359
|
onKeyDown: (t) => {
|
|
1365
|
-
t.stopPropagation(), t.key === "Enter" && ie.trim() && !_ &&
|
|
1360
|
+
t.stopPropagation(), t.key === "Enter" && ie.trim() && !_ && Ze(), t.key === "Escape" && (h(!1), V(""));
|
|
1366
1361
|
},
|
|
1367
1362
|
onKeyUp: (t) => {
|
|
1368
1363
|
t.stopPropagation();
|
|
@@ -1382,7 +1377,7 @@ function mi({
|
|
|
1382
1377
|
{
|
|
1383
1378
|
type: "button",
|
|
1384
1379
|
onClick: (t) => {
|
|
1385
|
-
t.stopPropagation(),
|
|
1380
|
+
t.stopPropagation(), Ze();
|
|
1386
1381
|
},
|
|
1387
1382
|
disabled: _ || !ie.trim(),
|
|
1388
1383
|
className: " cteditor-px-5 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-foreground cteditor-text-background hover:cteditor-bg-foreground/95 disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors focus:cteditor-outline-none focus:cteditor-ring-2 focus:cteditor-ring-background",
|
|
@@ -1401,15 +1396,15 @@ function mi({
|
|
|
1401
1396
|
},
|
|
1402
1397
|
disabled: _,
|
|
1403
1398
|
className: "cteditor-size-9 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-text-sm cteditor-rounded-md cteditor-bg-background cteditor-border cteditor-border-border cteditor-text-foreground hover:cteditor-bg-accent disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors",
|
|
1404
|
-
children: /* @__PURE__ */ e(
|
|
1399
|
+
children: /* @__PURE__ */ e(Pr, { size: 16 })
|
|
1405
1400
|
}
|
|
1406
1401
|
)
|
|
1407
1402
|
] })
|
|
1408
1403
|
] })
|
|
1409
1404
|
}
|
|
1410
1405
|
),
|
|
1411
|
-
q && ge(O) &&
|
|
1412
|
-
|
|
1406
|
+
q && ge(O) && et && !Te && /* @__PURE__ */ e(
|
|
1407
|
+
Wt,
|
|
1413
1408
|
{
|
|
1414
1409
|
showCaption: E,
|
|
1415
1410
|
setShowCaption: bt,
|
|
@@ -1436,7 +1431,7 @@ function mi({
|
|
|
1436
1431
|
...x === "inline-center" || x === "full" ? { margin: "0 auto" } : x === "inline-right" ? { marginLeft: "auto" } : x === "left" ? { float: "left", clear: "left" } : x === "right" ? { float: "right", clear: "right" } : {}
|
|
1437
1432
|
},
|
|
1438
1433
|
children: /* @__PURE__ */ a(
|
|
1439
|
-
|
|
1434
|
+
jt,
|
|
1440
1435
|
{
|
|
1441
1436
|
initialEditor: P,
|
|
1442
1437
|
initialNodes: [
|
|
@@ -1445,7 +1440,7 @@ function mi({
|
|
|
1445
1440
|
dr,
|
|
1446
1441
|
sr,
|
|
1447
1442
|
zt,
|
|
1448
|
-
|
|
1443
|
+
Tt
|
|
1449
1444
|
],
|
|
1450
1445
|
children: [
|
|
1451
1446
|
/* @__PURE__ */ e(Ot, {}),
|
|
@@ -1453,14 +1448,14 @@ function mi({
|
|
|
1453
1448
|
Kt,
|
|
1454
1449
|
{
|
|
1455
1450
|
contentEditable: /* @__PURE__ */ e(
|
|
1456
|
-
|
|
1451
|
+
Yt,
|
|
1457
1452
|
{
|
|
1458
1453
|
"aria-placeholder": "Enter a caption...",
|
|
1459
1454
|
placeholder: () => /* @__PURE__ */ e("span", { className: "cteditor-text-xs cteditor-absolute cteditor-left-2 cteditor-top-[7px]", children: "Enter a caption..." }),
|
|
1460
1455
|
className: " cteditor-outline-none !cteditor-shadow-none cteditor-bg-foreground/10 cteditor-border !cteditor-border-foreground/15 cteditor-py-1 cteditor-px-2 cteditor-rounded-sm cteditor-text-xs cteditor-relative"
|
|
1461
1456
|
}
|
|
1462
1457
|
),
|
|
1463
|
-
ErrorBoundary:
|
|
1458
|
+
ErrorBoundary: Ht
|
|
1464
1459
|
}
|
|
1465
1460
|
),
|
|
1466
1461
|
/* @__PURE__ */ e(
|
|
@@ -1470,8 +1465,8 @@ function mi({
|
|
|
1470
1465
|
}
|
|
1471
1466
|
}
|
|
1472
1467
|
),
|
|
1473
|
-
/* @__PURE__ */ e(
|
|
1474
|
-
/* @__PURE__ */ e(
|
|
1468
|
+
/* @__PURE__ */ e(Bt, {}),
|
|
1469
|
+
/* @__PURE__ */ e(Sr, { namespace: $r.namespace })
|
|
1475
1470
|
]
|
|
1476
1471
|
}
|
|
1477
1472
|
)
|
|
@@ -1481,16 +1476,16 @@ function mi({
|
|
|
1481
1476
|
Fr,
|
|
1482
1477
|
{
|
|
1483
1478
|
open: ft,
|
|
1484
|
-
onOpenChange:
|
|
1479
|
+
onOpenChange: We,
|
|
1485
1480
|
src: r,
|
|
1486
1481
|
altText: c,
|
|
1487
1482
|
width: p,
|
|
1488
1483
|
height: N,
|
|
1489
|
-
onCropApply:
|
|
1484
|
+
onCropApply: kt
|
|
1490
1485
|
}
|
|
1491
1486
|
),
|
|
1492
1487
|
/* @__PURE__ */ e(
|
|
1493
|
-
|
|
1488
|
+
Tr,
|
|
1494
1489
|
{
|
|
1495
1490
|
open: ee,
|
|
1496
1491
|
onOpenChange: F,
|
|
@@ -1503,6 +1498,6 @@ function mi({
|
|
|
1503
1498
|
] }) });
|
|
1504
1499
|
}
|
|
1505
1500
|
export {
|
|
1506
|
-
|
|
1501
|
+
nt as RIGHT_CLICK_IMAGE_COMMAND,
|
|
1507
1502
|
mi as default
|
|
1508
1503
|
};
|