ct-rich-text-editor 1.3.22 → 1.3.24
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/dist/assets/style.css +4 -0
- package/dist/{html2pdf.bundle-3699b235.js → html2pdf.bundle-33b132a6.js} +2 -2
- package/dist/{html2pdf.bundle-3699b235.js.map → html2pdf.bundle-33b132a6.js.map} +1 -1
- package/dist/{html2pdf.bundle.min-83517dc2.js → html2pdf.bundle.min-f3fd0aa5.js} +2 -2
- package/dist/{html2pdf.bundle.min-83517dc2.js.map → html2pdf.bundle.min-f3fd0aa5.js.map} +1 -1
- package/dist/{index-bf836d7a.js → index-b535466a.js} +2 -2
- package/dist/{index-bf836d7a.js.map → index-b535466a.js.map} +1 -1
- package/dist/{index-9a8a49b6.js → index-daaf2abc.js} +150 -83
- package/dist/index-daaf2abc.js.map +1 -0
- package/dist/{index-84187412.js → index-fbad5b49.js} +246 -204
- package/dist/index-fbad5b49.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/index-84187412.js.map +0 -1
- package/dist/index-9a8a49b6.js.map +0 -1
|
@@ -15,7 +15,7 @@ import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection"
|
|
|
15
15
|
import { calculateZoomLevel, mergeRegister } from "@lexical/utils";
|
|
16
16
|
import { RootNode, TextNode, LineBreakNode, ParagraphNode, $getSelection, $isNodeSelection, $setSelection, $isRangeSelection, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, CLICK_COMMAND, DRAGSTART_COMMAND, KEY_DELETE_COMMAND, KEY_BACKSPACE_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, createCommand, $getNodeByKey } from "lexical";
|
|
17
17
|
import { useRef, useState, useCallback, useEffect, Suspense } from "react";
|
|
18
|
-
import {
|
|
18
|
+
import { b as Dialog, d as DialogContent, e as DialogHeader, f as DialogTitle, h as DialogDescription, i as DialogFooter, B as Button, L as LocalStoragePlugin, j as initialConfig, k as $isImageNode, S as Sparkles, E as ExternalLink, T as Trash2, t as toast, A as AiJsonResponse } from "./index-daaf2abc.js";
|
|
19
19
|
import "axios";
|
|
20
20
|
import "@emotion/styled";
|
|
21
21
|
import "@lexical/html";
|
|
@@ -42,6 +42,65 @@ import "@mui/icons-material";
|
|
|
42
42
|
import "@lexical/react/LexicalLinkPlugin";
|
|
43
43
|
import "@lexical/react/LexicalTypeaheadMenuPlugin";
|
|
44
44
|
const imageCaptionStyles = "";
|
|
45
|
+
const ImageComparisonDialog = ({
|
|
46
|
+
open,
|
|
47
|
+
onOpenChange,
|
|
48
|
+
oldImageUrl,
|
|
49
|
+
newImageUrl,
|
|
50
|
+
onReplace,
|
|
51
|
+
onCancel
|
|
52
|
+
}) => {
|
|
53
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
|
|
54
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
55
|
+
/* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2 text-xl", children: [
|
|
56
|
+
/* @__PURE__ */ jsx("span", { className: "text-2xl", children: "🔄" }),
|
|
57
|
+
"Compare Images"
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "text-sm pt-1", children: "Choose whether to replace the original image with the refined version." })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-4 py-4", children: [
|
|
62
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
63
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
64
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-gray-700 dark:text-gray-300", children: "Refined Image" }),
|
|
65
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs px-2 py-1 rounded-full bg-blue-100 dark:bg-blue-950/30 text-blue-600 dark:text-blue-400", children: "New" })
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ jsx("div", { className: "relative aspect-square rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800 border-2 border-blue-500 dark:border-blue-600", children: /* @__PURE__ */ jsx(
|
|
68
|
+
"img",
|
|
69
|
+
{
|
|
70
|
+
src: newImageUrl,
|
|
71
|
+
alt: "Refined",
|
|
72
|
+
className: "w-full h-full object-contain"
|
|
73
|
+
}
|
|
74
|
+
) })
|
|
75
|
+
] }) }),
|
|
76
|
+
/* @__PURE__ */ jsx("div", { className: "p-3 rounded-lg bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-blue-800 dark:text-blue-200", children: [
|
|
77
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Note:" }),
|
|
78
|
+
' Clicking "Replace" will update the image in your document. This action cannot be undone.'
|
|
79
|
+
] }) })
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ jsxs(DialogFooter, { className: "gap-2", children: [
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
Button,
|
|
84
|
+
{
|
|
85
|
+
variant: "outline",
|
|
86
|
+
onClick: onCancel,
|
|
87
|
+
children: "Keep Original"
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsxs(
|
|
91
|
+
Button,
|
|
92
|
+
{
|
|
93
|
+
onClick: onReplace,
|
|
94
|
+
className: "bg-blue-500 hover:bg-blue-600 text-white",
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ jsx("span", { className: "mr-2", children: "✓" }),
|
|
97
|
+
"Replace Image"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] })
|
|
102
|
+
] }) });
|
|
103
|
+
};
|
|
45
104
|
const signatureCaption = "";
|
|
46
105
|
function SignatureCaption({
|
|
47
106
|
caption
|
|
@@ -355,65 +414,6 @@ function ImageResizer({
|
|
|
355
414
|
)
|
|
356
415
|
] });
|
|
357
416
|
}
|
|
358
|
-
const ImageComparisonDialog = ({
|
|
359
|
-
open,
|
|
360
|
-
onOpenChange,
|
|
361
|
-
oldImageUrl,
|
|
362
|
-
newImageUrl,
|
|
363
|
-
onReplace,
|
|
364
|
-
onCancel
|
|
365
|
-
}) => {
|
|
366
|
-
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
|
|
367
|
-
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
368
|
-
/* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2 text-xl", children: [
|
|
369
|
-
/* @__PURE__ */ jsx("span", { className: "text-2xl", children: "🔄" }),
|
|
370
|
-
"Compare Images"
|
|
371
|
-
] }),
|
|
372
|
-
/* @__PURE__ */ jsx(DialogDescription, { className: "text-sm pt-1", children: "Choose whether to replace the original image with the refined version." })
|
|
373
|
-
] }),
|
|
374
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-4 py-4", children: [
|
|
375
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
376
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
377
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-gray-700 dark:text-gray-300", children: "Refined Image" }),
|
|
378
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs px-2 py-1 rounded-full bg-blue-100 dark:bg-blue-950/30 text-blue-600 dark:text-blue-400", children: "New" })
|
|
379
|
-
] }),
|
|
380
|
-
/* @__PURE__ */ jsx("div", { className: "relative aspect-square rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800 border-2 border-blue-500 dark:border-blue-600", children: /* @__PURE__ */ jsx(
|
|
381
|
-
"img",
|
|
382
|
-
{
|
|
383
|
-
src: newImageUrl,
|
|
384
|
-
alt: "Refined",
|
|
385
|
-
className: "w-full h-full object-contain"
|
|
386
|
-
}
|
|
387
|
-
) })
|
|
388
|
-
] }) }),
|
|
389
|
-
/* @__PURE__ */ jsx("div", { className: "p-3 rounded-lg bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-blue-800 dark:text-blue-200", children: [
|
|
390
|
-
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Note:" }),
|
|
391
|
-
' Clicking "Replace" will update the image in your document. This action cannot be undone.'
|
|
392
|
-
] }) })
|
|
393
|
-
] }),
|
|
394
|
-
/* @__PURE__ */ jsxs(DialogFooter, { className: "gap-2", children: [
|
|
395
|
-
/* @__PURE__ */ jsx(
|
|
396
|
-
Button,
|
|
397
|
-
{
|
|
398
|
-
variant: "outline",
|
|
399
|
-
onClick: onCancel,
|
|
400
|
-
children: "Keep Original"
|
|
401
|
-
}
|
|
402
|
-
),
|
|
403
|
-
/* @__PURE__ */ jsxs(
|
|
404
|
-
Button,
|
|
405
|
-
{
|
|
406
|
-
onClick: onReplace,
|
|
407
|
-
className: "bg-blue-500 hover:bg-blue-600 text-white",
|
|
408
|
-
children: [
|
|
409
|
-
/* @__PURE__ */ jsx("span", { className: "mr-2", children: "✓" }),
|
|
410
|
-
"Replace Image"
|
|
411
|
-
]
|
|
412
|
-
}
|
|
413
|
-
)
|
|
414
|
-
] })
|
|
415
|
-
] }) });
|
|
416
|
-
};
|
|
417
417
|
const imageCache = /* @__PURE__ */ new Set();
|
|
418
418
|
const RIGHT_CLICK_IMAGE_COMMAND = createCommand("RIGHT_CLICK_IMAGE_COMMAND");
|
|
419
419
|
function useSuspenseImage(src) {
|
|
@@ -568,11 +568,14 @@ function ImageComponent({
|
|
|
568
568
|
);
|
|
569
569
|
const onClick = useCallback(
|
|
570
570
|
(payload) => {
|
|
571
|
+
var _a, _b;
|
|
571
572
|
const event = payload;
|
|
572
573
|
if (isResizing) {
|
|
573
574
|
return true;
|
|
574
575
|
}
|
|
575
|
-
|
|
576
|
+
const target = event.target;
|
|
577
|
+
const isClickOnImage = target === imageRef.current || ((_a = imageRef.current) == null ? void 0 : _a.contains(target)) || ((_b = target.closest(".editor-image")) == null ? void 0 : _b.contains(imageRef.current));
|
|
578
|
+
if (isClickOnImage) {
|
|
576
579
|
if (event.shiftKey) {
|
|
577
580
|
setSelected(!isSelected);
|
|
578
581
|
} else {
|
|
@@ -769,7 +772,9 @@ function ImageComponent({
|
|
|
769
772
|
combinedPrompt = `${altText} with ${cleanedRefinement}`;
|
|
770
773
|
}
|
|
771
774
|
}
|
|
772
|
-
const response = await AiJsonResponse({
|
|
775
|
+
const response = await AiJsonResponse({
|
|
776
|
+
content: `Generate Image: ${combinedPrompt}`
|
|
777
|
+
});
|
|
773
778
|
const htmlString = response == null ? void 0 : response.data;
|
|
774
779
|
if (!htmlString) {
|
|
775
780
|
throw new Error("Failed to generate image - empty response");
|
|
@@ -846,134 +851,180 @@ function ImageComponent({
|
|
|
846
851
|
display: "inline-block"
|
|
847
852
|
};
|
|
848
853
|
};
|
|
854
|
+
const handleDirectClick = useCallback(
|
|
855
|
+
(e) => {
|
|
856
|
+
if (isResizing) {
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
if (e.target.closest("button")) {
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
if (e.shiftKey) {
|
|
863
|
+
setSelected(!isSelected);
|
|
864
|
+
} else {
|
|
865
|
+
clearSelection();
|
|
866
|
+
setSelected(true);
|
|
867
|
+
}
|
|
868
|
+
},
|
|
869
|
+
[isResizing, isSelected, setSelected, clearSelection]
|
|
870
|
+
);
|
|
849
871
|
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
850
|
-
/* @__PURE__ */ jsxs(
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
title: "Open in new tab",
|
|
888
|
-
children: /* @__PURE__ */ jsx(ExternalLink, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
889
|
-
}
|
|
890
|
-
),
|
|
891
|
-
/* @__PURE__ */ jsx(
|
|
892
|
-
"button",
|
|
893
|
-
{
|
|
894
|
-
onClick: (e) => {
|
|
895
|
-
e.stopPropagation();
|
|
896
|
-
handleDeleteImage(e);
|
|
897
|
-
},
|
|
898
|
-
className: "cteditor-p-2 cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
899
|
-
"aria-label": "Delete image",
|
|
900
|
-
title: "Delete image",
|
|
901
|
-
children: /* @__PURE__ */ jsx(Trash2, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
902
|
-
}
|
|
903
|
-
)
|
|
904
|
-
] }),
|
|
905
|
-
showRefineInput && isSelected && !isLoadError && /* @__PURE__ */ jsx(
|
|
906
|
-
"div",
|
|
907
|
-
{
|
|
908
|
-
className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background cteditor-rounded-lg cteditor-shadow-xl cteditor-border cteditor-border-border cteditor-p-3",
|
|
909
|
-
style: { zIndex: 10 },
|
|
910
|
-
onClick: (e) => e.stopPropagation(),
|
|
911
|
-
onKeyDown: (e) => e.stopPropagation(),
|
|
912
|
-
onKeyUp: (e) => e.stopPropagation(),
|
|
913
|
-
children: /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-2", children: [
|
|
914
|
-
/* @__PURE__ */ jsx("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "What else do you want in this scene?" }),
|
|
915
|
-
/* @__PURE__ */ jsx(
|
|
916
|
-
"input",
|
|
917
|
-
{
|
|
918
|
-
type: "text",
|
|
919
|
-
value: refinementPrompt,
|
|
920
|
-
onChange: (e) => setRefinementPrompt(e.target.value),
|
|
921
|
-
onKeyDown: (e) => {
|
|
922
|
-
e.stopPropagation();
|
|
923
|
-
if (e.key === "Enter" && refinementPrompt.trim() && !isRefining) {
|
|
924
|
-
handleRefineImage();
|
|
872
|
+
/* @__PURE__ */ jsxs(
|
|
873
|
+
"div",
|
|
874
|
+
{
|
|
875
|
+
draggable,
|
|
876
|
+
style: getPositionStyles(),
|
|
877
|
+
onClick: handleDirectClick,
|
|
878
|
+
children: [
|
|
879
|
+
isLoadError ? /* @__PURE__ */ jsx(BrokenImage, {}) : /* @__PURE__ */ jsx(
|
|
880
|
+
LazyImage,
|
|
881
|
+
{
|
|
882
|
+
className: isFocused ? `focused ${$isNodeSelection(selection) ? "draggable" : ""}` : null,
|
|
883
|
+
src,
|
|
884
|
+
altText,
|
|
885
|
+
imageRef,
|
|
886
|
+
width,
|
|
887
|
+
height,
|
|
888
|
+
maxWidth,
|
|
889
|
+
onError: () => setIsLoadError(true)
|
|
890
|
+
}
|
|
891
|
+
),
|
|
892
|
+
isSelected && $isNodeSelection(selection) && !isLoadError && /* @__PURE__ */ jsxs(
|
|
893
|
+
"div",
|
|
894
|
+
{
|
|
895
|
+
className: "cteditor-absolute cteditor-top-2 cteditor-right-2 cteditor-flex cteditor-gap-2",
|
|
896
|
+
style: { zIndex: 10 },
|
|
897
|
+
children: [
|
|
898
|
+
originalPrompt && /* @__PURE__ */ jsx(
|
|
899
|
+
"button",
|
|
900
|
+
{
|
|
901
|
+
onClick: (e) => {
|
|
902
|
+
e.stopPropagation();
|
|
903
|
+
handleRefineClick(e);
|
|
904
|
+
},
|
|
905
|
+
className: "cteditor-p-2 cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-accent cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
906
|
+
"aria-label": "Refine image",
|
|
907
|
+
title: "Refine image",
|
|
908
|
+
children: /* @__PURE__ */ jsx(Sparkles, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
925
909
|
}
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
910
|
+
),
|
|
911
|
+
/* @__PURE__ */ jsx(
|
|
912
|
+
"button",
|
|
913
|
+
{
|
|
914
|
+
onClick: (e) => {
|
|
915
|
+
e.stopPropagation();
|
|
916
|
+
handleOpenInNewTab(e);
|
|
917
|
+
},
|
|
918
|
+
className: "cteditor-p-2 cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-accent cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
919
|
+
"aria-label": "Open image in new tab",
|
|
920
|
+
title: "Open in new tab",
|
|
921
|
+
children: /* @__PURE__ */ jsx(ExternalLink, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
929
922
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
e
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
923
|
+
),
|
|
924
|
+
/* @__PURE__ */ jsx(
|
|
925
|
+
"button",
|
|
926
|
+
{
|
|
927
|
+
onClick: (e) => {
|
|
928
|
+
e.stopPropagation();
|
|
929
|
+
handleDeleteImage(e);
|
|
930
|
+
},
|
|
931
|
+
className: "cteditor-p-2 cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
932
|
+
"aria-label": "Delete image",
|
|
933
|
+
title: "Delete image",
|
|
934
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
935
|
+
}
|
|
936
|
+
)
|
|
937
|
+
]
|
|
938
|
+
}
|
|
939
|
+
),
|
|
940
|
+
showRefineInput && isSelected && !isLoadError && originalPrompt && /* @__PURE__ */ jsx(
|
|
941
|
+
"div",
|
|
942
|
+
{
|
|
943
|
+
className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background cteditor-rounded-lg cteditor-shadow-xl cteditor-border cteditor-border-border cteditor-p-3",
|
|
944
|
+
style: { zIndex: 10 },
|
|
945
|
+
onClick: (e) => e.stopPropagation(),
|
|
946
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
947
|
+
onKeyUp: (e) => e.stopPropagation(),
|
|
948
|
+
children: /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-2", children: [
|
|
949
|
+
/* @__PURE__ */ jsx("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "What else do you want in this scene?" }),
|
|
950
|
+
/* @__PURE__ */ jsx(
|
|
951
|
+
"input",
|
|
952
|
+
{
|
|
953
|
+
type: "text",
|
|
954
|
+
value: refinementPrompt,
|
|
955
|
+
onChange: (e) => setRefinementPrompt(e.target.value),
|
|
956
|
+
onKeyDown: (e) => {
|
|
957
|
+
e.stopPropagation();
|
|
958
|
+
if (e.key === "Enter" && refinementPrompt.trim() && !isRefining) {
|
|
959
|
+
handleRefineImage();
|
|
960
|
+
}
|
|
961
|
+
if (e.key === "Escape") {
|
|
962
|
+
setShowRefineInput(false);
|
|
963
|
+
setRefinementPrompt("");
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
onKeyUp: (e) => {
|
|
967
|
+
e.stopPropagation();
|
|
968
|
+
},
|
|
969
|
+
onClick: (e) => {
|
|
970
|
+
e.stopPropagation();
|
|
971
|
+
},
|
|
972
|
+
placeholder: "e.g., flying birds, golden sunset, stormy clouds...",
|
|
973
|
+
className: "cteditor-w-full cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-border cteditor-border-border cteditor-rounded-md cteditor-bg-background cteditor-text-foreground focus:cteditor-outline-none focus:cteditor-ring-2 focus:cteditor-ring-blue-500",
|
|
974
|
+
disabled: isRefining,
|
|
975
|
+
autoFocus: true
|
|
976
|
+
}
|
|
977
|
+
),
|
|
978
|
+
/* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-gap-2", children: [
|
|
979
|
+
/* @__PURE__ */ jsx(
|
|
980
|
+
"button",
|
|
981
|
+
{
|
|
982
|
+
onClick: (e) => {
|
|
983
|
+
e.stopPropagation();
|
|
984
|
+
handleRefineImage();
|
|
985
|
+
},
|
|
986
|
+
disabled: isRefining || !refinementPrompt.trim(),
|
|
987
|
+
className: "cteditor-flex-1 cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-blue-500 cteditor-text-white hover:cteditor-bg-blue-600 disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors",
|
|
988
|
+
children: isRefining ? /* @__PURE__ */ jsxs("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
|
|
989
|
+
/* @__PURE__ */ jsx("span", { className: "cteditor-inline-block cteditor-w-4 cteditor-h-4 cteditor-border-2 cteditor-border-white cteditor-border-t-transparent cteditor-rounded-full cteditor-animate-spin" }),
|
|
990
|
+
"Refining..."
|
|
991
|
+
] }) : "Refine Image"
|
|
992
|
+
}
|
|
993
|
+
),
|
|
994
|
+
/* @__PURE__ */ jsx(
|
|
995
|
+
"button",
|
|
996
|
+
{
|
|
997
|
+
onClick: (e) => {
|
|
998
|
+
e.stopPropagation();
|
|
999
|
+
setShowRefineInput(false);
|
|
1000
|
+
setRefinementPrompt("");
|
|
1001
|
+
},
|
|
1002
|
+
disabled: isRefining,
|
|
1003
|
+
className: "cteditor-px-3 cteditor-py-2 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",
|
|
1004
|
+
children: "Cancel"
|
|
1005
|
+
}
|
|
1006
|
+
)
|
|
1007
|
+
] })
|
|
1008
|
+
] })
|
|
1009
|
+
}
|
|
1010
|
+
),
|
|
1011
|
+
resizable && $isNodeSelection(selection) && isFocused && /* @__PURE__ */ jsx(
|
|
1012
|
+
ImageResizer,
|
|
1013
|
+
{
|
|
1014
|
+
showCaption,
|
|
1015
|
+
setShowCaption,
|
|
1016
|
+
editor,
|
|
1017
|
+
buttonRef,
|
|
1018
|
+
imageRef,
|
|
1019
|
+
maxWidth,
|
|
1020
|
+
onResizeStart,
|
|
1021
|
+
onResizeEnd,
|
|
1022
|
+
captionsEnabled: !isLoadError && captionsEnabled
|
|
1023
|
+
}
|
|
1024
|
+
)
|
|
1025
|
+
]
|
|
1026
|
+
}
|
|
1027
|
+
),
|
|
977
1028
|
showCaption && (altText.startsWith("Signature by") ? /* @__PURE__ */ jsx(SignatureCaption, { caption }) : /* @__PURE__ */ jsx("div", { className: "image-caption-container", children: /* @__PURE__ */ jsxs(
|
|
978
1029
|
LexicalNestedComposer,
|
|
979
1030
|
{
|
|
@@ -1002,27 +1053,18 @@ function ImageComponent({
|
|
|
1002
1053
|
ErrorBoundary: LexicalErrorBoundary
|
|
1003
1054
|
}
|
|
1004
1055
|
),
|
|
1005
|
-
/* @__PURE__ */ jsx(
|
|
1006
|
-
|
|
1056
|
+
/* @__PURE__ */ jsx(
|
|
1057
|
+
OnChangePlugin,
|
|
1058
|
+
{
|
|
1059
|
+
onChange: () => {
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
),
|
|
1007
1063
|
/* @__PURE__ */ jsx(HistoryPlugin, {}),
|
|
1008
1064
|
/* @__PURE__ */ jsx(LocalStoragePlugin, { namespace: initialConfig.namespace })
|
|
1009
1065
|
]
|
|
1010
1066
|
}
|
|
1011
1067
|
) })),
|
|
1012
|
-
resizable && $isNodeSelection(selection) && isFocused && /* @__PURE__ */ jsx(
|
|
1013
|
-
ImageResizer,
|
|
1014
|
-
{
|
|
1015
|
-
showCaption,
|
|
1016
|
-
setShowCaption,
|
|
1017
|
-
editor,
|
|
1018
|
-
buttonRef,
|
|
1019
|
-
imageRef,
|
|
1020
|
-
maxWidth,
|
|
1021
|
-
onResizeStart,
|
|
1022
|
-
onResizeEnd,
|
|
1023
|
-
captionsEnabled: !isLoadError && captionsEnabled
|
|
1024
|
-
}
|
|
1025
|
-
),
|
|
1026
1068
|
/* @__PURE__ */ jsx(
|
|
1027
1069
|
ImageComparisonDialog,
|
|
1028
1070
|
{
|
|
@@ -1040,4 +1082,4 @@ export {
|
|
|
1040
1082
|
RIGHT_CLICK_IMAGE_COMMAND,
|
|
1041
1083
|
ImageComponent as default
|
|
1042
1084
|
};
|
|
1043
|
-
//# sourceMappingURL=index-
|
|
1085
|
+
//# sourceMappingURL=index-fbad5b49.js.map
|