ct-rich-text-editor 1.3.23 → 1.3.25
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 +233 -233
- package/dist/App.d.ts +2 -3
- package/dist/Provider/EditorProvider.d.ts +26 -27
- package/dist/Provider/LexicalProvider.d.ts +5 -6
- package/dist/api/ai/index.d.ts +31 -31
- package/dist/api/auth.d.ts +108 -108
- package/dist/api/config/axios.d.ts +1 -2
- package/dist/api/config/endpoints.d.ts +18 -18
- package/dist/api/featureSuggestion.d.ts +23 -23
- package/dist/api/transcript/index.d.ts +1 -1
- package/dist/assets/style.css +5205 -5192
- package/dist/{babel-d155920e.js → babel-d3085146.js} +3565 -3292
- package/dist/babel-d3085146.js.map +1 -0
- package/dist/components/AiPlugin/index.d.ts +6 -6
- package/dist/components/AlignMenu/AlignMenu.d.ts +8 -9
- package/dist/components/AlignMenu/AlignMenuDrop.d.ts +2 -3
- package/dist/components/AlignMenu/index.d.ts +1 -1
- package/dist/components/AutoExpandingDemo.d.ts +5 -6
- package/dist/components/BlockFormatMenu/BlockFormatMenu.d.ts +2 -3
- package/dist/components/BlockFormatMenu/constants.d.ts +14 -14
- package/dist/components/BlockFormatMenu/index.d.ts +1 -1
- package/dist/components/ChartEditDialog.d.ts +8 -9
- package/dist/components/ChartInsertDialog.d.ts +7 -8
- package/dist/components/CodeActionMenuPlugin/components/CopyButton/index.d.ts +6 -7
- package/dist/components/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +8 -9
- package/dist/components/CodeActionMenuPlugin/index.d.ts +4 -5
- package/dist/components/CodeActionMenuPlugin/utils.d.ts +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +2 -3
- package/dist/components/ColorPicker/index.d.ts +1 -1
- package/dist/components/CommentSidebar/CommentSidebar.d.ts +7 -8
- package/dist/components/CommentSidebar/index.d.ts +1 -1
- package/dist/components/CommentToggle/CommentToggle.d.ts +7 -8
- package/dist/components/CommentToggle/index.d.ts +1 -1
- package/dist/components/CommentView/CommentView.d.ts +8 -9
- package/dist/components/CommentView/index.d.ts +1 -1
- package/dist/components/ConfigurableEditorWithAuth.d.ts +12 -13
- package/dist/components/DatePicker/DatePickerWidget.d.ts +6 -7
- package/dist/components/EmojiPickerWidget/EmojiPickerWidget.d.ts +2 -3
- package/dist/components/EmojiPickerWidget/index.d.ts +1 -1
- package/dist/components/FeatureSuggestionDialog/index.d.ts +6 -6
- package/dist/components/FileUpload/InsertFileDialog.d.ts +7 -7
- package/dist/components/FileUpload/InsertFileUploadedDialogBody.d.ts +4 -5
- package/dist/components/FileView/index.d.ts +8 -9
- package/dist/components/FontFamilySelect/FontFamilyMenu.d.ts +6 -7
- package/dist/components/FontSizePicker/FontSizeControl.d.ts +2 -3
- package/dist/components/FormatTextMenu/FormatTextMenu.d.ts +2 -3
- package/dist/components/FormatTextMenu/FormatTextMenuDrop.d.ts +2 -3
- package/dist/components/FormatTextMenu/index.d.ts +1 -1
- package/dist/components/HighlightColorPicker/HighlightColorPicker.d.ts +6 -7
- package/dist/components/HtmlViewDisplay.d.ts +2 -3
- package/dist/components/ImageComparisonDialog/index.d.ts +10 -11
- package/dist/components/ImageGenerationDialog/ImageGenerationManager.d.ts +10 -11
- package/dist/components/ImageGenerationDialog/index.d.ts +10 -11
- package/dist/components/ImageInsertTest.d.ts +2 -3
- package/dist/components/ImageView/ImageDialog/ImageUploadDialogBody.d.ts +8 -9
- package/dist/components/ImageView/ImageDialog/index.d.ts +5 -6
- package/dist/components/ImageView/ImageResizer.d.ts +15 -16
- package/dist/components/ImageView/index.d.ts +15 -16
- package/dist/components/InsertMenu/InsertMenu.d.ts +8 -9
- package/dist/components/InsertMenu/InsertMenuDrop.d.ts +8 -9
- package/dist/components/InsertMenu/index.d.ts +1 -1
- package/dist/components/LanguageSelectorDialog/index.d.ts +7 -8
- package/dist/components/NotePanelMenu/NotePanelMenu.d.ts +5 -6
- package/dist/components/NotePanelMenu/index.d.ts +1 -1
- package/dist/components/NotePanelView/NotePanelView.d.ts +8 -9
- package/dist/components/NotePanelView/index.d.ts +1 -1
- package/dist/components/Placeholder/Placeholder.d.ts +2 -3
- package/dist/components/Placeholder/index.d.ts +1 -1
- package/dist/components/Placeholder/styles.d.ts +1 -1
- package/dist/components/ScopedEditor.d.ts +8 -8
- package/dist/components/SignatureCaption/index.d.ts +5 -6
- package/dist/components/TableColorPicker/index.d.ts +7 -8
- package/dist/components/TableModal/TableModal.d.ts +9 -10
- package/dist/components/TextEnhanceDialog/index.d.ts +9 -10
- package/dist/components/ToneAdjustDialog/index.d.ts +7 -8
- package/dist/components/Toolbar/Toolbar.d.ts +2 -3
- package/dist/components/Toolbar/index.d.ts +1 -1
- package/dist/components/Toolbar/styles.d.ts +6 -6
- package/dist/components/ui/avatar.d.ts +6 -6
- package/dist/components/ui/badge.d.ts +8 -9
- package/dist/components/ui/button.d.ts +10 -11
- package/dist/components/ui/calendar.d.ts +7 -8
- package/dist/components/ui/card.d.ts +8 -8
- package/dist/components/ui/checkbox.d.ts +4 -4
- package/dist/components/ui/dialog.d.ts +19 -19
- package/dist/components/ui/dropdown-menu.d.ts +27 -27
- package/dist/components/ui/input.d.ts +3 -3
- package/dist/components/ui/label.d.ts +4 -4
- package/dist/components/ui/popover.d.ts +7 -7
- package/dist/components/ui/select.d.ts +13 -13
- package/dist/components/ui/separator.d.ts +4 -4
- package/dist/components/ui/sheet.d.ts +24 -24
- package/dist/components/ui/skeleton.d.ts +3 -3
- package/dist/components/ui/tabs.d.ts +7 -7
- package/dist/components/ui/textarea.d.ts +3 -3
- package/dist/components/ui/tooltip.d.ts +7 -7
- package/dist/constants.d.ts +21 -22
- package/dist/context/CommentContext.d.ts +42 -43
- package/dist/context/HtmlViewContext.d.ts +16 -17
- package/dist/context/ToolbarContext.d.ts +55 -56
- package/dist/editorConfig.d.ts +48 -48
- package/dist/{estree-b1fff53b.js → estree-164983f6.js} +1763 -1778
- package/dist/estree-164983f6.js.map +1 -0
- package/dist/hooks/useAutoExpandingHeight.d.ts +15 -15
- package/dist/hooks/useBlockFormat.d.ts +16 -17
- package/dist/hooks/useColorPicker.d.ts +6 -6
- package/dist/hooks/useCustomCommands.d.ts +2 -3
- package/dist/hooks/useDebounce.d.ts +1 -1
- package/dist/hooks/useEditorToolbar.d.ts +9 -10
- package/dist/hooks/useInsertMenu.d.ts +9 -9
- package/dist/hooks/useModal.d.ts +5 -5
- package/dist/hooks/useS3Uploader.d.ts +11 -11
- package/dist/hooks/useVoiceToText.d.ts +15 -15
- package/dist/{html-f95ee5dc.js → html-5586dbf6.js} +701 -656
- package/dist/html-5586dbf6.js.map +1 -0
- package/dist/{html2pdf.bundle-026397bd.js → html2pdf.bundle-915945f4.js} +2 -2
- package/dist/html2pdf.bundle-915945f4.js.map +1 -0
- package/dist/{html2pdf.bundle.min-49ff1939.js → html2pdf.bundle.min-53a200a1.js} +2 -2
- package/dist/html2pdf.bundle.min-53a200a1.js.map +1 -0
- package/dist/{index-cea164e5.js → index-8daaa42a.js} +246 -204
- package/dist/index-8daaa42a.js.map +1 -0
- package/dist/{index-b9ad2974.js → index-d46a32ad.js} +940 -518
- package/dist/index-d46a32ad.js.map +1 -0
- package/dist/{index-b8db2529.js → index-f8c2acae.js} +2 -2
- package/dist/index-f8c2acae.js.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +1 -1
- package/dist/lib/utils.d.ts +1 -2
- package/dist/main.d.ts +0 -1
- package/dist/{markdown-1d9e6c3f.js → markdown-d513479b.js} +1836 -1789
- package/dist/markdown-d513479b.js.map +1 -0
- package/dist/nodes/ChartNode.d.ts +40 -41
- package/dist/nodes/CommentNode.d.ts +33 -34
- package/dist/nodes/CommentedTextNode.d.ts +28 -29
- package/dist/nodes/EmbedNode.d.ts +25 -26
- package/dist/nodes/FileNode.d.ts +31 -32
- package/dist/nodes/ImageNode.d.ts +58 -59
- package/dist/nodes/MentionNode.d.ts +74 -75
- package/dist/nodes/NotePanelNode.d.ts +30 -31
- package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +24 -25
- package/dist/pages/ConfigurableEditor/index.d.ts +2 -2
- package/dist/pages/NotFound.d.ts +2 -2
- package/dist/pages/RichTextEditor.d.ts +6 -6
- package/dist/pages/TextareaEditor.d.ts +6 -6
- package/dist/pages/styles.d.ts +5 -5
- package/dist/plugins/AIChatPlugin.d.ts +10 -11
- package/dist/plugins/AndroidKeyboardFixPlugin.d.ts +16 -16
- package/dist/plugins/AutocompletePlugin.d.ts +22 -22
- package/dist/plugins/CodeBlockNormalizerPlugin.d.ts +8 -8
- package/dist/plugins/CodeBlockSelectAllPlugin.d.ts +8 -8
- package/dist/plugins/CodeHighlightPlugin.d.ts +2 -3
- package/dist/plugins/CombinedAutocompletGrammarPlugin.d.ts +20 -21
- package/dist/plugins/CommentBubblePlugin.d.ts +2 -3
- package/dist/plugins/CommentPlugin.d.ts +6 -7
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRuleNode.d.ts +28 -29
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRulePlugin.d.ts +3 -3
- package/dist/plugins/CustomHorizontalRulePlugin/HorizontalRuleCustomizationDialog.d.ts +6 -7
- package/dist/plugins/CustomHorizontalRulePlugin/index.d.ts +3 -3
- package/dist/plugins/DragDropPastePlugin/index.d.ts +8 -8
- package/dist/plugins/EmbedPreviewPlugin/FloatingEmbedMenuPlugin.d.ts +3 -4
- package/dist/plugins/EmbedPreviewPlugin/index.d.ts +5 -6
- package/dist/plugins/FilePlugin.d.ts +7 -8
- package/dist/plugins/FloatingEnhanceButton/index.d.ts +3 -4
- package/dist/plugins/FloatingLinkEditorPlugin/index.d.ts +5 -6
- package/dist/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +25 -26
- package/dist/plugins/GrammarCheckPlugin.d.ts +1 -2
- package/dist/plugins/HtmlCodeViewPlugin/index.d.ts +2 -2
- package/dist/plugins/HtmlImportPlugin.d.ts +5 -5
- package/dist/plugins/HtmlSyncPlugin.d.ts +3 -3
- package/dist/plugins/ImagePlugin.d.ts +6 -7
- package/dist/plugins/LinkPlugin/index.d.ts +5 -6
- package/dist/plugins/LinkPreviewPlugin/index.d.ts +2 -2
- package/dist/plugins/LocalStoragePlugin.d.ts +6 -7
- package/dist/plugins/MentionsPlugin/index.d.ts +6 -7
- package/dist/plugins/NotePanelPlugin.d.ts +6 -7
- package/dist/plugins/RichTextPastePlugin/index.d.ts +15 -15
- package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasDialog.d.ts +5 -6
- package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasPlugin.d.ts +9 -9
- package/dist/plugins/SignatureCanvasPlugin/index.d.ts +2 -2
- package/dist/plugins/SlashCommandPlugin/index.d.ts +2 -2
- package/dist/plugins/TableActionMenuPlugin/index.d.ts +5 -6
- package/dist/plugins/TableCellResizer/index.d.ts +1 -2
- package/dist/plugins/TableHoverActionsPlugin/index.d.ts +4 -4
- package/dist/plugins/TablePlugin.d.ts +2 -3
- package/dist/plugins/Tableimageautoresizeplugin.d.ts +1 -1
- package/dist/plugins/TextEnhancePlugin.d.ts +6 -6
- package/dist/plugins/TreeViewPlugin.d.ts +2 -3
- package/dist/plugins/UsageTrackingPlugin.d.ts +15 -15
- package/dist/plugins/VoiceTranscriptPlugin.d.ts +21 -21
- package/dist/plugins/WordCountPlugin.d.ts +2 -3
- package/dist/{postcss-c2592f3f.js → postcss-f084f74d.js} +1378 -1357
- package/dist/postcss-f084f74d.js.map +1 -0
- package/dist/standalone-5a8c6b7e.js +2518 -0
- package/dist/standalone-5a8c6b7e.js.map +1 -0
- package/dist/styles/PlaygroundEditorTheme.d.ts +2 -3
- package/dist/types.d.ts +147 -148
- package/dist/typescript-b1005db4.js +13705 -0
- package/dist/typescript-b1005db4.js.map +1 -0
- package/dist/ui/ColorPicker.d.ts +13 -14
- package/dist/ui/Icons.d.ts +47 -47
- package/dist/ui/TextInput.d.ts +10 -11
- package/dist/utils/dateFormats.d.ts +33 -33
- package/dist/utils/debounce.d.ts +5 -6
- package/dist/utils/editorStyleConverter.d.ts +16 -17
- package/dist/utils/export.d.ts +1 -2
- package/dist/utils/getDOMRangeRect.d.ts +13 -13
- package/dist/utils/getSelectedNode.d.ts +2 -3
- package/dist/utils/helper.d.ts +3 -3
- package/dist/utils/index.d.ts +3 -4
- package/dist/utils/invarient.d.ts +1 -1
- package/dist/utils/setFloatingElemPosition.d.ts +8 -8
- package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -1
- package/dist/utils/url.d.ts +9 -9
- package/package.json +127 -127
- package/dist/babel-d155920e.js.map +0 -1
- package/dist/estree-b1fff53b.js.map +0 -1
- package/dist/html-f95ee5dc.js.map +0 -1
- package/dist/html2pdf.bundle-026397bd.js.map +0 -1
- package/dist/html2pdf.bundle.min-49ff1939.js.map +0 -1
- package/dist/index-b8db2529.js.map +0 -1
- package/dist/index-b9ad2974.js.map +0 -1
- package/dist/index-cea164e5.js.map +0 -1
- package/dist/markdown-1d9e6c3f.js.map +0 -1
- package/dist/postcss-c2592f3f.js.map +0 -1
- package/dist/standalone-bcc7f37a.js +0 -2649
- package/dist/standalone-bcc7f37a.js.map +0 -1
- package/dist/typescript-48c10f50.js +0 -13601
- package/dist/typescript-48c10f50.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-d46a32ad.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 && originalPrompt && /* @__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-8daaa42a.js.map
|