ct-rich-text-editor 1.3.9 → 1.3.10
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 +5 -0
- package/dist/{html2pdf.bundle-edf70ece.js → html2pdf.bundle-7796d91e.js} +2 -2
- package/dist/{html2pdf.bundle-edf70ece.js.map → html2pdf.bundle-7796d91e.js.map} +1 -1
- package/dist/{html2pdf.bundle.min-94e617b8.js → html2pdf.bundle.min-655f7464.js} +2 -2
- package/dist/{html2pdf.bundle.min-94e617b8.js.map → html2pdf.bundle.min-655f7464.js.map} +1 -1
- package/dist/{index-0445ed0b.js → index-d292603a.js} +2 -2
- package/dist/{index-0445ed0b.js.map → index-d292603a.js.map} +1 -1
- package/dist/{index-4061f3ce.js → index-d5866754.js} +53 -20
- package/dist/{index-4061f3ce.js.map → index-d5866754.js.map} +1 -1
- package/dist/{index-db990790.js → index-e0dbaf6d.js} +2 -2
- package/dist/{index-db990790.js.map → index-e0dbaf6d.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -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 { L as LocalStoragePlugin, i as initialConfig, b as Dialog, d as DialogContent, e as DialogHeader, f as DialogTitle, h as DialogDescription, j as DialogFooter, B as Button, k as $isImageNode, S as Sparkles, E as ExternalLink, T as Trash2, t as toast, A as AiJsonResponse } from "./index-
|
|
18
|
+
import { L as LocalStoragePlugin, i as initialConfig, b as Dialog, d as DialogContent, e as DialogHeader, f as DialogTitle, h as DialogDescription, j as DialogFooter, B as Button, k as $isImageNode, S as Sparkles, E as ExternalLink, T as Trash2, t as toast, A as AiJsonResponse } from "./index-d5866754.js";
|
|
19
19
|
import "axios";
|
|
20
20
|
import "@emotion/styled";
|
|
21
21
|
import "@lexical/html";
|
|
@@ -1026,4 +1026,4 @@ export {
|
|
|
1026
1026
|
RIGHT_CLICK_IMAGE_COMMAND,
|
|
1027
1027
|
ImageComponent as default
|
|
1028
1028
|
};
|
|
1029
|
-
//# sourceMappingURL=index-
|
|
1029
|
+
//# sourceMappingURL=index-d292603a.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-0445ed0b.js","sources":["../src/components/SignatureCaption/index.tsx","../src/components/ImageView/ImageResizer.tsx","../src/components/ImageComparisonDialog/index.tsx","../src/components/ImageView/index.tsx"],"sourcesContent":["/**\n * SignatureCaption Component\n * A premium styled caption component specifically for signatures\n */\n\nimport \"./signature-caption.css\";\n\nimport { CodeNode } from \"@lexical/code\";\nimport { LinkNode } from \"@lexical/link\";\nimport { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary\";\nimport { HistoryPlugin } from \"@lexical/react/LexicalHistoryPlugin\";\nimport { LexicalNestedComposer } from \"@lexical/react/LexicalNestedComposer\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport type { LexicalEditor } from \"lexical\";\nimport { LineBreakNode, ParagraphNode, RootNode, TextNode } from \"lexical\";\nimport { initialConfig } from \"src/constants\";\nimport LocalStoragePlugin from \"src/plugins/LocalStoragePlugin\";\n\ninterface SignatureCaptionProps {\n caption: LexicalEditor;\n}\n\nexport default function SignatureCaption({\n caption,\n}: SignatureCaptionProps): JSX.Element {\n return (\n <div className=\"signature-caption-container\">\n <LexicalNestedComposer\n initialEditor={caption}\n initialNodes={[\n RootNode,\n TextNode,\n LineBreakNode,\n ParagraphNode,\n LinkNode,\n CodeNode,\n ]}\n >\n <RichTextPlugin\n contentEditable={\n <ContentEditable\n aria-placeholder=\"Enter signature name...\"\n placeholder={\n <div style={{\n position: 'absolute',\n top: '4px',\n left: '8px',\n right: '8px',\n textAlign: 'center',\n pointerEvents: 'none',\n color: 'hsla(var(--cteditorf47ac10b-foreground) / 0.4)',\n fontStyle: 'italic'\n }}>\n Enter signature name...\n </div>\n }\n className=\"signature-caption-editable\"\n />\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n\n <OnChangePlugin onChange={() => {\n // Placeholder for future change handling\n }} />\n <HistoryPlugin />\n <LocalStoragePlugin namespace={initialConfig.namespace} />\n </LexicalNestedComposer>\n </div>\n );\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport \"./image-caption-styles.css\";\n\nimport { calculateZoomLevel } from \"@lexical/utils\";\nimport type { LexicalEditor } from \"lexical\";\nimport * as React from \"react\";\nimport { useRef } from \"react\";\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.min(Math.max(value, min), max);\n}\n\nconst Direction = {\n east: 1 << 0,\n north: 1 << 3,\n south: 1 << 1,\n west: 1 << 2,\n};\n\nexport default function ImageResizer({\n onResizeStart,\n onResizeEnd,\n buttonRef,\n imageRef,\n maxWidth,\n editor,\n showCaption,\n setShowCaption,\n captionsEnabled,\n}: {\n editor: LexicalEditor;\n buttonRef: { current: null | HTMLButtonElement };\n imageRef: { current: null | HTMLElement };\n maxWidth?: number;\n onResizeEnd: (width: \"inherit\" | number, height: \"inherit\" | number) => void;\n onResizeStart: () => void;\n setShowCaption: (show: boolean) => void;\n showCaption: boolean;\n captionsEnabled: boolean;\n}): JSX.Element {\n const controlWrapperRef = useRef<HTMLDivElement>(null);\n const userSelect = useRef({\n priority: \"\",\n value: \"default\",\n });\n const positioningRef = useRef<{\n currentHeight: \"inherit\" | number;\n currentWidth: \"inherit\" | number;\n direction: number;\n isResizing: boolean;\n ratio: number;\n startHeight: number;\n startWidth: number;\n startX: number;\n startY: number;\n }>({\n currentHeight: 0,\n currentWidth: 0,\n direction: 0,\n isResizing: false,\n ratio: 0,\n startHeight: 0,\n startWidth: 0,\n startX: 0,\n startY: 0,\n });\n const editorRootElement = editor.getRootElement();\n\n // Allow enlarging up to the editor container width (ignore any fixed maxWidth cap)\n const maxWidthContainer =\n editorRootElement !== null\n ? editorRootElement.getBoundingClientRect().width - 20\n : 100;\n const maxHeightContainer =\n editorRootElement !== null\n ? editorRootElement.getBoundingClientRect().height - 20\n : 100;\n\n const minWidth = 100;\n const minHeight = 100;\n\n /**\n * Sets the cursor style to indicate the resizing direction.\n * This function updates the cursor for the editor and document body\n * based on the resizing direction.\n */\n const setStartCursor = (direction: number) => {\n // Determine if the resizing is happening horizontally (east or west)\n const ew = direction === Direction.east || direction === Direction.west;\n // Determine if the resizing is happening vertically (north or south)\n const ns = direction === Direction.north || direction === Direction.south;\n // Determine if the resizing is diagonal (north-west, south-east, etc.)\n const nwse =\n (direction & Direction.north && direction & Direction.west) ||\n (direction & Direction.south && direction & Direction.east);\n\n // Set the appropriate cursor style based on the detected direction\n const cursorDir = ew ? \"ew\" : ns ? \"ns\" : nwse ? \"nwse\" : \"nesw\";\n\n // Apply the cursor style to the editor root element if it exists\n if (editorRootElement !== null) {\n editorRootElement.style.setProperty(\n \"cursor\",\n `${cursorDir}-resize`,\n \"important\"\n );\n }\n\n // Apply the cursor style to the document body\n if (document.body !== null) {\n document.body.style.setProperty(\n \"cursor\",\n `${cursorDir}-resize`,\n \"important\"\n );\n\n // Store the current user selection settings before modifying them\n userSelect.current.value = document.body.style.getPropertyValue(\n \"-webkit-user-select\"\n );\n userSelect.current.priority = document.body.style.getPropertyPriority(\n \"-webkit-user-select\"\n );\n\n // Disable text selection during resizing to prevent unwanted text selection\n document.body.style.setProperty(\n \"-webkit-user-select\",\n `none`,\n \"important\"\n );\n }\n };\n\n /**\n * Resets the cursor style when resizing ends.\n */\n\n const setEndCursor = () => {\n if (editorRootElement !== null) {\n editorRootElement.style.setProperty(\"cursor\", \"text\");\n }\n if (document.body !== null) {\n document.body.style.setProperty(\"cursor\", \"default\");\n document.body.style.setProperty(\n \"-webkit-user-select\",\n userSelect.current.value,\n userSelect.current.priority\n );\n }\n };\n\n /**\n * Handles pointer down event when resizing starts.\n */\n const handlePointerDown = (\n event: React.PointerEvent<HTMLDivElement>,\n direction: number\n ) => {\n if (!editor.isEditable()) {\n return;\n }\n const image = imageRef.current;\n const controlWrapper = controlWrapperRef.current;\n\n // Ensure both the image and control wrapper exist before proceeding\n if (image !== null && controlWrapper !== null) {\n event.preventDefault();\n\n // Get the image's current width and height from its bounding rectangle\n const { width, height } = image.getBoundingClientRect();\n // Calculate the zoom level to adjust calculations accordingly\n const zoom = calculateZoomLevel(image);\n // Retrieve the positioning reference object to store resize state\n const positioning = positioningRef.current;\n\n // Store the initial dimensions of the image\n positioning.startWidth = width;\n positioning.startHeight = height;\n // Store the aspect ratio to maintain proportions when resizing\n positioning.ratio = width / height;\n // Set the current width and height values for tracking changes\n positioning.currentWidth = width;\n positioning.currentHeight = height;\n // Store the initial pointer position, adjusted for zoom level\n positioning.startX = event.clientX / zoom;\n positioning.startY = event.clientY / zoom;\n // Mark the resizing state as active\n positioning.isResizing = true;\n // Store the resize direction (north, south, east, west, or combinations)\n positioning.direction = direction;\n\n // Set the cursor style to indicate resizing in the correct direction\n setStartCursor(direction);\n onResizeStart();\n\n controlWrapper.classList.add(\"image-control-wrapper--resizing\");\n image.style.height = `${height}px`;\n image.style.width = `${width}px`;\n document.addEventListener(\"pointermove\", handlePointerMove);\n document.addEventListener(\"pointerup\", handlePointerUp);\n }\n };\n\n /**\n * Handles pointer move event when resizing the image dynamically.\n */\n const handlePointerMove = (event: PointerEvent) => {\n const image = imageRef.current;\n const positioning = positioningRef.current;\n\n // Check if the resize direction includes horizontal movement (east or west)\n const isHorizontal =\n positioning.direction & (Direction.east | Direction.west);\n // Check if the resize direction includes vertical movement (north or south)\n const isVertical =\n positioning.direction & (Direction.south | Direction.north);\n\n if (image !== null && positioning.isResizing) {\n // Get the zoom level of the image to ensure accurate calculations\n const zoom = calculateZoomLevel(image);\n\n if (isHorizontal && isVertical) {\n // Calculate the difference in X position relative to the starting point\n let diff = Math.floor(positioning.startX - event.clientX / zoom);\n // Reverse the difference if resizing from the east to ensure correct calculations\n diff = positioning.direction & Direction.east ? -diff : diff;\n\n // Calculate the new width, ensuring it stays within allowed min and max limits\n const width = clamp(\n positioning.startWidth + diff,\n minWidth,\n maxWidthContainer\n );\n // Maintain the aspect ratio by adjusting height proportionally\n const height = width / positioning.ratio;\n // Apply the new width and height to the image\n image.style.width = `${width}px`;\n image.style.height = `${height}px`;\n // Update stored dimensions for ongoing tracking\n positioning.currentHeight = height;\n positioning.currentWidth = width;\n } else if (isVertical) {\n // Calculate the difference in Y position relative to the starting point\n let diff = Math.floor(positioning.startY - event.clientY / zoom);\n // Reverse the difference if resizing from the south to maintain correct direction\n diff = positioning.direction & Direction.south ? -diff : diff;\n\n // Calculate the new height, ensuring it stays within allowed min and max limits\n const height = clamp(\n positioning.startHeight + diff,\n minHeight,\n maxHeightContainer\n );\n\n // Apply the new height to the image\n image.style.height = `${height}px`;\n // Update stored height for ongoing tracking\n positioning.currentHeight = height;\n } else {\n // Calculate the difference in X position relative to the starting point\n let diff = Math.floor(positioning.startX - event.clientX / zoom);\n // Reverse the difference if resizing from the east to maintain correct direction\n diff = positioning.direction & Direction.east ? -diff : diff;\n\n // Calculate the new width, ensuring it stays within allowed min and max limits\n const width = clamp(\n positioning.startWidth + diff,\n minWidth,\n maxWidthContainer\n );\n\n // Apply the new width to the image\n image.style.width = `${width}px`;\n // Update stored width for ongoing tracking\n positioning.currentWidth = width;\n }\n }\n };\n\n /**\n * Handles the pointer up event when resizing ends.\n */\n const handlePointerUp = () => {\n const image = imageRef.current;\n const positioning = positioningRef.current;\n const controlWrapper = controlWrapperRef.current;\n\n // Ensure the image, control wrapper exist, and resizing is active before proceeding\n if (image !== null && controlWrapper !== null && positioning.isResizing) {\n // Capture the final width and height of the resized image\n const width = positioning.currentWidth;\n const height = positioning.currentHeight;\n\n // Reset positioning values after resizing is complete\n positioning.startWidth = 0;\n positioning.startHeight = 0;\n positioning.ratio = 0;\n positioning.startX = 0;\n positioning.startY = 0;\n positioning.currentWidth = 0;\n positioning.currentHeight = 0;\n positioning.isResizing = false; // Mark resizing as finished\n\n // Remove the resizing class from the control wrapper\n controlWrapper.classList.remove(\"image-control-wrapper--resizing\");\n\n // Restore default cursor appearance\n setEndCursor();\n // Trigger the resize end callback with the final dimensions\n onResizeEnd(width, height);\n\n // Remove event listeners for pointer movement and release to stop tracking\n document.removeEventListener(\"pointermove\", handlePointerMove);\n document.removeEventListener(\"pointerup\", handlePointerUp);\n }\n };\n\n return (\n <div ref={controlWrapperRef}>\n {!showCaption && captionsEnabled && (\n <button\n className=\"image-caption-button\"\n ref={buttonRef}\n onClick={() => {\n setShowCaption(!showCaption);\n }}\n >\n Add Caption\n </button>\n )}\n <div\n className=\"image-resizer image-resizer-n\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.north);\n }}\n />\n <div\n className=\"image-resizer image-resizer-ne\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.north | Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-e\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-se\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.south | Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-s\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.south);\n }}\n />\n <div\n className=\"image-resizer image-resizer-sw\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.south | Direction.west);\n }}\n />\n <div\n className=\"image-resizer image-resizer-w\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.west);\n }}\n />\n <div\n className=\"image-resizer image-resizer-nw\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.north | Direction.west);\n }}\n />\n </div>\n );\n}\n","import React from \"react\";\nimport { Button } from \"../ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from \"../ui/dialog\";\n\ninterface ImageComparisonDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n oldImageUrl: string;\n newImageUrl: string;\n onReplace: () => void;\n onCancel: () => void;\n}\n\nexport const ImageComparisonDialog: React.FC<ImageComparisonDialogProps> = ({\n open,\n onOpenChange,\n oldImageUrl,\n newImageUrl,\n onReplace,\n onCancel,\n}) => {\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent className=\"sm:max-w-[800px] max-h-[90vh] overflow-y-auto\">\n <DialogHeader>\n <DialogTitle className=\"flex items-center gap-2 text-xl\">\n <span className=\"text-2xl\">🔄</span>\n Compare Images\n </DialogTitle>\n <DialogDescription className=\"text-sm pt-1\">\n Choose whether to replace the original image with the refined version.\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"space-y-4 py-4\">\n <div className=\"grid grid-cols-2 gap-4\">\n\n {/* New Image */}\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-semibold text-gray-700 dark:text-gray-300\">\n Refined Image\n </span>\n <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\">\n New\n </span>\n </div>\n <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\">\n <img\n src={newImageUrl}\n alt=\"Refined\"\n className=\"w-full h-full object-contain\"\n />\n </div>\n </div>\n </div>\n\n {/* Info */}\n <div className=\"p-3 rounded-lg bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800\">\n <p className=\"text-sm text-blue-800 dark:text-blue-200\">\n <span className=\"font-semibold\">Note:</span> Clicking \"Replace\" will update the image in your document.\n This action cannot be undone.\n </p>\n </div>\n </div>\n\n <DialogFooter className=\"gap-2\">\n <Button\n variant=\"outline\"\n onClick={onCancel}\n >\n Keep Original\n </Button>\n <Button\n onClick={onReplace}\n className=\"bg-blue-500 hover:bg-blue-600 text-white\"\n >\n <span className=\"mr-2\">✓</span>\n Replace Image\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n};\n\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport \"./image-caption-styles.css\";\n\nimport { CodeNode } from \"@lexical/code\";\nimport { LinkNode } from \"@lexical/link\";\nimport { AutoFocusPlugin } from \"@lexical/react/LexicalAutoFocusPlugin\";\nimport { useCollaborationContext } from \"@lexical/react/LexicalCollaborationContext\";\nimport { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary\";\nimport { HistoryPlugin } from \"@lexical/react/LexicalHistoryPlugin\";\nimport { LexicalNestedComposer } from \"@lexical/react/LexicalNestedComposer\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\n// import './ImageNode.css';\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport { useLexicalEditable } from \"@lexical/react/useLexicalEditable\";\nimport { useLexicalNodeSelection } from \"@lexical/react/useLexicalNodeSelection\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport type {\n BaseSelection,\n LexicalCommand,\n LexicalEditor,\n NodeKey,\n} from \"lexical\";\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n $isRangeSelection,\n $setSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n createCommand,\n DRAGSTART_COMMAND,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n KEY_ENTER_COMMAND,\n KEY_ESCAPE_COMMAND,\n LineBreakNode,\n ParagraphNode,\n RootNode,\n SELECTION_CHANGE_COMMAND,\n TextNode,\n} from \"lexical\";\nimport { ExternalLink, Trash2, Sparkles } from \"lucide-react\";\nimport * as React from \"react\";\nimport { Suspense, useCallback, useEffect, useRef, useState } from \"react\";\n// import brokenImage from '../images/image-broken.svg';\nimport { toast } from \"sonner\";\nimport { initialConfig } from \"src/constants\";\nimport { $isImageNode } from \"src/nodes/ImageNode\";\nimport LocalStoragePlugin from \"src/plugins/LocalStoragePlugin\";\n\nimport SignatureCaption from \"../SignatureCaption\";\nimport ImageResizer from \"./ImageResizer\";\nimport { AiJsonResponse } from \"../../api/ai\";\nimport { ImageComparisonDialog } from \"../ImageComparisonDialog\";\n\nconst imageCache = new Set();\n\nexport const RIGHT_CLICK_IMAGE_COMMAND: LexicalCommand<MouseEvent> =\n createCommand(\"RIGHT_CLICK_IMAGE_COMMAND\");\n\nfunction useSuspenseImage(src: string) {\n if (!imageCache.has(src)) {\n throw new Promise((resolve) => {\n const img = new Image();\n img.src = src;\n img.onload = () => {\n imageCache.add(src);\n resolve(null);\n };\n img.onerror = () => {\n imageCache.add(src);\n };\n });\n }\n}\n\nfunction LazyImage({\n altText,\n className,\n imageRef,\n src,\n width,\n height,\n maxWidth,\n onError,\n}: {\n altText: string;\n className: string | null;\n height: \"inherit\" | number;\n imageRef: { current: null | HTMLImageElement };\n maxWidth: number;\n src: string;\n width: \"inherit\" | number;\n onError: () => void;\n}): JSX.Element {\n useSuspenseImage(src);\n const hasExplicitSize = typeof width === 'number' && typeof height === 'number';\n const computedWidth = typeof width === 'number' ? width : 'auto';\n const computedHeight = typeof height === 'number' ? height : 'auto';\n\n return (\n <img\n className={className || undefined}\n src={src}\n alt={altText}\n ref={imageRef}\n style={\n hasExplicitSize\n ? {\n // User has set a numeric size or original dimensions are provided\n width: computedWidth,\n height: computedHeight,\n maxWidth: '100%',\n }\n : {\n // No dimensions specified - use original image size\n maxWidth: '100%',\n height: 'auto',\n }\n }\n onError={onError}\n draggable=\"false\"\n />\n );\n}\n\n// if the image is broken ; we are showing this component\nfunction BrokenImage(): JSX.Element {\n return (\n <img\n src={\"\"} //TODO: NEED TO ADD BROKEN IMAGE\n style={{\n height: 200,\n opacity: 0.2,\n width: 200,\n }}\n draggable=\"false\"\n />\n );\n}\n\nexport default function ImageComponent({\n src,\n altText,\n nodeKey,\n width,\n height,\n maxWidth,\n resizable,\n showCaption,\n caption,\n captionsEnabled,\n originalPrompt,\n}: {\n altText: string;\n caption: LexicalEditor;\n height: \"inherit\" | number;\n maxWidth: number;\n nodeKey: NodeKey;\n resizable: boolean;\n showCaption: boolean;\n src: string;\n width: \"inherit\" | number;\n captionsEnabled: boolean;\n originalPrompt?: string;\n}): JSX.Element {\n const imageRef = useRef<null | HTMLImageElement>(null);\n const buttonRef = useRef<HTMLButtonElement | null>(null);\n const [isSelected, setSelected, clearSelection] =\n useLexicalNodeSelection(nodeKey);\n const [isResizing, setIsResizing] = useState<boolean>(false);\n const { isCollabActive } = useCollaborationContext();\n const [editor] = useLexicalComposerContext();\n const [selection, setSelection] = useState<BaseSelection | null>(null);\n const activeEditorRef = useRef<LexicalEditor | null>(null);\n const [isLoadError, setIsLoadError] = useState<boolean>(false);\n const isEditable = useLexicalEditable();\n const [showRefineInput, setShowRefineInput] = useState<boolean>(false);\n const [refinementPrompt, setRefinementPrompt] = useState<string>(\"\");\n const [isRefining, setIsRefining] = useState<boolean>(false);\n const [showComparisonDialog, setShowComparisonDialog] = useState<boolean>(false);\n const [newImageUrl, setNewImageUrl] = useState<string>(\"\");\n const [newCombinedPrompt, setNewCombinedPrompt] = useState<string>(\"\");\n\n /**\n * Deletes the image node when the delete key is pressed.\n */\n const $onDelete = useCallback(\n (payload: KeyboardEvent) => {\n const deleteSelection = $getSelection();\n if (isSelected && $isNodeSelection(deleteSelection)) {\n const event: KeyboardEvent = payload;\n event.preventDefault();\n editor.update(() => {\n deleteSelection.getNodes().forEach((node) => {\n if ($isImageNode(node)) {\n node.remove();\n }\n });\n });\n }\n return false;\n },\n [editor, isSelected]\n );\n\n /**\n * Handles enter key to move focus into the caption editor.\n */\n const $onEnter = useCallback(\n (event: KeyboardEvent) => {\n const latestSelection = $getSelection();\n const buttonElem = buttonRef.current;\n if (\n isSelected &&\n $isNodeSelection(latestSelection) &&\n latestSelection.getNodes().length === 1\n ) {\n if (showCaption) {\n // Move focus into nested editor\n $setSelection(null);\n event.preventDefault();\n caption.focus();\n return true;\n } else if (\n buttonElem !== null &&\n buttonElem !== document.activeElement\n ) {\n event.preventDefault();\n buttonElem.focus();\n return true;\n }\n }\n return false;\n },\n [caption, isSelected, showCaption]\n );\n\n /**\n * Handles escape key to reset selection.\n */\n const $onEscape = useCallback(\n (event: KeyboardEvent) => {\n if (\n activeEditorRef.current === caption ||\n buttonRef.current === event.target\n ) {\n $setSelection(null);\n editor.update(() => {\n setSelected(true);\n const parentRootElement = editor.getRootElement();\n if (parentRootElement !== null) {\n parentRootElement.focus();\n }\n });\n return true;\n }\n return false;\n },\n [caption, editor, setSelected]\n );\n\n const onClick = useCallback(\n (payload: MouseEvent) => {\n const event = payload;\n\n if (isResizing) {\n return true;\n }\n if (event.target === imageRef.current) {\n if (event.shiftKey) {\n setSelected(!isSelected);\n } else {\n clearSelection();\n setSelected(true);\n }\n return true;\n }\n\n return false;\n },\n [isResizing, isSelected, setSelected, clearSelection]\n );\n\n const onRightClick = useCallback(\n (event: MouseEvent): void => {\n editor.getEditorState().read(() => {\n const latestSelection = $getSelection();\n const domElement = event.target as HTMLElement;\n if (\n domElement.tagName === \"IMG\" &&\n $isRangeSelection(latestSelection) &&\n latestSelection.getNodes().length === 1\n ) {\n editor.dispatchCommand(\n RIGHT_CLICK_IMAGE_COMMAND,\n event as MouseEvent\n );\n }\n });\n },\n [editor]\n );\n\n useEffect(() => {\n let isMounted = true;\n const rootElement = editor.getRootElement();\n const unregister = mergeRegister(\n editor.registerUpdateListener(({ editorState }) => {\n if (isMounted) {\n setSelection(editorState.read(() => $getSelection()));\n }\n }),\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n (_, activeEditor) => {\n activeEditorRef.current = activeEditor;\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand<MouseEvent>(\n CLICK_COMMAND,\n onClick,\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand<MouseEvent>(\n RIGHT_CLICK_IMAGE_COMMAND,\n onClick,\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n DRAGSTART_COMMAND,\n (event) => {\n if (event.target === imageRef.current) {\n // Temporary workaround for FF to behave like other browsers.\n // Ideally, this handles drag & drop too (and all browsers).\n event.preventDefault();\n return true;\n }\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n KEY_DELETE_COMMAND,\n $onDelete,\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n KEY_BACKSPACE_COMMAND,\n $onDelete,\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(KEY_ENTER_COMMAND, $onEnter, COMMAND_PRIORITY_LOW),\n editor.registerCommand(\n KEY_ESCAPE_COMMAND,\n $onEscape,\n COMMAND_PRIORITY_LOW\n )\n );\n\n rootElement?.addEventListener(\"contextmenu\", onRightClick);\n\n return () => {\n isMounted = false;\n unregister();\n rootElement?.removeEventListener(\"contextmenu\", onRightClick);\n };\n }, [\n clearSelection,\n editor,\n isResizing,\n isSelected,\n nodeKey,\n $onDelete,\n $onEnter,\n $onEscape,\n onClick,\n onRightClick,\n setSelected,\n ]);\n\n const setShowCaption = () => {\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isImageNode(node)) {\n node.setShowCaption(true);\n }\n });\n };\n\n const onResizeEnd = (\n nextWidth: \"inherit\" | number,\n nextHeight: \"inherit\" | number\n ) => {\n // Delay hiding the resize bars for click case\n setTimeout(() => {\n setIsResizing(false);\n }, 200);\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isImageNode(node)) {\n node.setWidthAndHeight(nextWidth, nextHeight);\n }\n });\n };\n\n const onResizeStart = () => {\n setIsResizing(true);\n };\n\n const handleOpenInNewTab = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // Check if it's a data URL (base64)\n if (src.startsWith('data:')) {\n // For data URLs, we need to open them in a new tab with the image displayed\n const newWindow = window.open('', '_blank');\n if (newWindow) {\n newWindow.document.write(`\n <!DOCTYPE html>\n <html>\n <head>\n <title>${altText || 'Image'}</title>\n <style>\n body {\n margin: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 100vh;\n background-color: #1a1a1a;\n }\n img {\n max-width: 100%;\n max-height: 100vh;\n object-fit: contain;\n }\n </style>\n </head>\n <body>\n <img src=\"${src}\" alt=\"${altText || 'Image'}\" />\n </body>\n </html>\n `);\n newWindow.document.close();\n }\n } else {\n // For regular URLs, just open them directly\n window.open(src, '_blank');\n }\n };\n\n const handleDeleteImage = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isImageNode(node)) {\n node.remove();\n }\n });\n };\n\n const handleRefineClick = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setShowRefineInput(!showRefineInput);\n };\n\n const handleRefineImage = async () => {\n if (!refinementPrompt.trim() || isRefining) return;\n\n setIsRefining(true);\n \n // Show loading toast\n const loadingToast = toast.loading(\"Refining image...\", {\n description: \"This may take 10-30 seconds. Please wait.\",\n });\n \n try {\n // Intelligently combine original prompt with refinement\n let combinedPrompt = refinementPrompt.trim();\n \n // Check if we have an original prompt\n if (originalPrompt && originalPrompt.trim()) {\n const original = originalPrompt.trim();\n const refinement = refinementPrompt.trim();\n \n // Remove common \"add\" prefixes from refinement\n const cleanedRefinement = refinement\n .replace(/^(add|also add|include|with|and)\\s+(some|a|an)\\s+/gi, '')\n .replace(/^(add|also add|include|with|and)\\s+/gi, '')\n .trim();\n \n // Simple and clear combination - just list both elements\n // This is the most reliable format for DALL-E\n combinedPrompt = `${original} with ${cleanedRefinement}`;\n } else {\n // No original prompt (image was created before this feature)\n // Try to use altText or just use the refinement as-is\n if (altText && altText !== \"Generated image\" && altText.trim()) {\n // Use altText as the original description\n const cleanedRefinement = refinementPrompt.trim()\n .replace(/^(add|also add|include|with|and)\\s+(some|a|an)\\s+/gi, '')\n .replace(/^(add|also add|include|with|and)\\s+/gi, '')\n .trim();\n combinedPrompt = `${altText} with ${cleanedRefinement}`;\n }\n // else: Just use the refinement prompt as-is\n }\n\n // Generate refined image with combined prompt\n const response = await AiJsonResponse({ content: `Generate Image: ${combinedPrompt}` });\n const htmlString = response?.data;\n\n if (!htmlString) {\n throw new Error(\"Failed to generate image - empty response\");\n }\n\n // Extract image URL from HTML response\n const parser = new DOMParser();\n const dom = parser.parseFromString(htmlString, \"text/html\");\n const imgElement = dom.querySelector(\"img\");\n\n if (!imgElement || !imgElement.src) {\n throw new Error(`No image found in response`);\n }\n\n const generatedImageUrl = imgElement.src;\n\n // Dismiss loading toast and show success\n toast.dismiss(loadingToast);\n toast.success(\"Image refined successfully!\", {\n description: \"Compare the images and choose which to keep.\",\n });\n\n // Store new image URL, combined prompt, and show comparison dialog\n setNewImageUrl(generatedImageUrl);\n setNewCombinedPrompt(combinedPrompt);\n setShowComparisonDialog(true);\n\n // Clear refinement input and close it\n setRefinementPrompt(\"\");\n setShowRefineInput(false);\n } catch (error) {\n // Dismiss loading toast and show error\n toast.dismiss(loadingToast);\n toast.error(\"Failed to refine image\", {\n description: error instanceof Error ? error.message : 'Unknown error. Please try again.',\n });\n } finally {\n setIsRefining(false);\n }\n };\n\n const handleReplaceImage = () => {\n // Update the image node with new URL and updated prompt\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isImageNode(node)) {\n // Use setter methods which properly call getWritable()\n node.setSrc(newImageUrl);\n node.setOriginalPrompt(newCombinedPrompt);\n \n // Force Lexical to re-render the DecoratorNode by triggering selection change\n const currentSelection = $getSelection();\n if (currentSelection) {\n $setSelection(currentSelection.clone());\n }\n }\n });\n\n // Close dialog and reset\n setShowComparisonDialog(false);\n setNewImageUrl(\"\");\n setNewCombinedPrompt(\"\");\n \n // Show success toast\n toast.success(\"Image replaced successfully!\", {\n description: \"The image has been updated with the refined version.\",\n });\n };\n\n const handleCancelReplace = () => {\n // Just close dialog and reset\n setShowComparisonDialog(false);\n setNewImageUrl(\"\");\n setNewCombinedPrompt(\"\");\n };\n\n const draggable = isSelected && $isNodeSelection(selection) && !isResizing;\n const isFocused = (isSelected || isResizing) && isEditable;\n return (\n <Suspense fallback={null}>\n <>\n <div draggable={draggable} style={{ position: 'relative', display: 'inline-block' }}>\n {isLoadError ? (\n <BrokenImage />\n ) : (\n <LazyImage\n className={\n isFocused\n ? `focused ${$isNodeSelection(selection) ? \"draggable\" : \"\"}`\n : null\n }\n src={src}\n altText={altText}\n imageRef={imageRef}\n width={width}\n height={height}\n maxWidth={maxWidth}\n onError={() => setIsLoadError(true)}\n />\n )}\n {/* Action Buttons - Refine, Open in New Tab and Delete */}\n {isSelected && $isNodeSelection(selection) && !isLoadError && (\n <div className=\"cteditor-absolute cteditor-top-2 cteditor-right-2 cteditor-flex cteditor-gap-2\" style={{ zIndex: 10 }}>\n <button\n onClick={(e) => {\n e.stopPropagation();\n handleRefineClick(e);\n }}\n 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\"\n aria-label=\"Refine image\"\n title=\"Refine image\"\n >\n <Sparkles className=\"cteditor-w-4 cteditor-h-4 cteditor-text-foreground\" />\n </button>\n <button\n onClick={(e) => {\n e.stopPropagation();\n handleOpenInNewTab(e);\n }}\n 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\"\n aria-label=\"Open image in new tab\"\n title=\"Open in new tab\"\n >\n <ExternalLink className=\"cteditor-w-4 cteditor-h-4 cteditor-text-foreground\" />\n </button>\n <button\n onClick={(e) => {\n e.stopPropagation();\n handleDeleteImage(e);\n }}\n 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\"\n aria-label=\"Delete image\"\n title=\"Delete image\"\n >\n <Trash2 className=\"cteditor-w-4 cteditor-h-4 cteditor-text-foreground\" />\n </button>\n </div>\n )}\n {/* Refine Input */}\n {showRefineInput && isSelected && !isLoadError && (\n <div \n 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\" \n style={{ zIndex: 10 }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n onKeyUp={(e) => e.stopPropagation()}\n >\n <div className=\"cteditor-flex cteditor-flex-col cteditor-gap-2\">\n <label className=\"cteditor-text-xs cteditor-font-medium cteditor-text-foreground\">\n What else do you want in this scene?\n </label>\n <input\n type=\"text\"\n value={refinementPrompt}\n onChange={(e) => setRefinementPrompt(e.target.value)}\n onKeyDown={(e) => {\n // Stop propagation to prevent editor commands from firing\n e.stopPropagation();\n \n if (e.key === 'Enter' && refinementPrompt.trim() && !isRefining) {\n handleRefineImage();\n }\n if (e.key === 'Escape') {\n setShowRefineInput(false);\n setRefinementPrompt(\"\");\n }\n }}\n onKeyUp={(e) => {\n // Also stop propagation on keyup\n e.stopPropagation();\n }}\n onClick={(e) => {\n // Prevent click from bubbling to image selection\n e.stopPropagation();\n }}\n placeholder=\"e.g., flying birds, golden sunset, stormy clouds...\"\n 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\"\n disabled={isRefining}\n autoFocus\n />\n <div className=\"cteditor-flex cteditor-gap-2\">\n <button\n onClick={(e) => {\n e.stopPropagation();\n handleRefineImage();\n }}\n disabled={isRefining || !refinementPrompt.trim()}\n 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\"\n >\n {isRefining ? (\n <span className=\"cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2\">\n <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\"></span>\n Refining...\n </span>\n ) : (\n \"Refine Image\"\n )}\n </button>\n <button\n onClick={(e) => {\n e.stopPropagation();\n setShowRefineInput(false);\n setRefinementPrompt(\"\");\n }}\n disabled={isRefining}\n 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\"\n >\n Cancel\n </button>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {showCaption && (\n altText.startsWith(\"Signature by\") ? (\n <SignatureCaption caption={caption} />\n ) : (\n <div className=\"image-caption-container\">\n <LexicalNestedComposer\n initialEditor={caption}\n initialNodes={[\n RootNode,\n TextNode,\n LineBreakNode,\n ParagraphNode,\n LinkNode,\n CodeNode,\n ]}\n >\n <AutoFocusPlugin />\n\n <RichTextPlugin\n contentEditable={\n <ContentEditable\n aria-placeholder=\"Enter a caption...\"\n placeholder={() => <span className=\"cteditor-text-xs\">Enter a caption...</span>}\n className=\"ImageNode__contentEditable\"\n />\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n\n <OnChangePlugin onChange={() => {}} />\n <HistoryPlugin />\n <LocalStoragePlugin namespace={initialConfig.namespace} />\n </LexicalNestedComposer>\n </div>\n )\n )}\n {resizable && $isNodeSelection(selection) && isFocused && (\n <ImageResizer\n showCaption={showCaption}\n setShowCaption={setShowCaption}\n editor={editor}\n buttonRef={buttonRef}\n imageRef={imageRef}\n maxWidth={maxWidth}\n onResizeStart={onResizeStart}\n onResizeEnd={onResizeEnd}\n captionsEnabled={!isLoadError && captionsEnabled}\n />\n )}\n\n {/* Image Comparison Dialog */}\n <ImageComparisonDialog\n open={showComparisonDialog}\n onOpenChange={setShowComparisonDialog}\n oldImageUrl={src}\n newImageUrl={newImageUrl}\n onReplace={handleReplaceImage}\n onCancel={handleCancelReplace}\n />\n </>\n </Suspense>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAwB,iBAAiB;AAAA,EACvC;AACF,GAAuC;AAEnC,SAAA,oBAAC,OAAI,EAAA,WAAU,+BACb,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAe;AAAA,MACf,cAAc;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEA,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,iBACE;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,oBAAiB;AAAA,gBACjB,aACG,oBAAA,OAAA,EAAI,OAAO;AAAA,kBACV,UAAU;AAAA,kBACV,KAAK;AAAA,kBACL,MAAM;AAAA,kBACN,OAAO;AAAA,kBACP,WAAW;AAAA,kBACX,eAAe;AAAA,kBACf,OAA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UAAW,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAE5D,EAAA,CAAA;AAAA,IAGH,aAAa,iBAAiB,SAAS,KAAK,aAC3C;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,iBAAiB,CAAC,eAAe;AAAA,MAAA;AAAA,IACnC;AAAA,IAIF;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN,cAAc;AAAA,QACd,aAAa;AAAA,QACb;AAAA,QACA,WAAW;AAAA,QACX,UAAU;AAAA,MAAA;AAAA,IACZ;AAAA,EAAA,EACF,CAAA,EACF,CAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"index-d292603a.js","sources":["../src/components/SignatureCaption/index.tsx","../src/components/ImageView/ImageResizer.tsx","../src/components/ImageComparisonDialog/index.tsx","../src/components/ImageView/index.tsx"],"sourcesContent":["/**\n * SignatureCaption Component\n * A premium styled caption component specifically for signatures\n */\n\nimport \"./signature-caption.css\";\n\nimport { CodeNode } from \"@lexical/code\";\nimport { LinkNode } from \"@lexical/link\";\nimport { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary\";\nimport { HistoryPlugin } from \"@lexical/react/LexicalHistoryPlugin\";\nimport { LexicalNestedComposer } from \"@lexical/react/LexicalNestedComposer\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport type { LexicalEditor } from \"lexical\";\nimport { LineBreakNode, ParagraphNode, RootNode, TextNode } from \"lexical\";\nimport { initialConfig } from \"src/constants\";\nimport LocalStoragePlugin from \"src/plugins/LocalStoragePlugin\";\n\ninterface SignatureCaptionProps {\n caption: LexicalEditor;\n}\n\nexport default function SignatureCaption({\n caption,\n}: SignatureCaptionProps): JSX.Element {\n return (\n <div className=\"signature-caption-container\">\n <LexicalNestedComposer\n initialEditor={caption}\n initialNodes={[\n RootNode,\n TextNode,\n LineBreakNode,\n ParagraphNode,\n LinkNode,\n CodeNode,\n ]}\n >\n <RichTextPlugin\n contentEditable={\n <ContentEditable\n aria-placeholder=\"Enter signature name...\"\n placeholder={\n <div style={{\n position: 'absolute',\n top: '4px',\n left: '8px',\n right: '8px',\n textAlign: 'center',\n pointerEvents: 'none',\n color: 'hsla(var(--cteditorf47ac10b-foreground) / 0.4)',\n fontStyle: 'italic'\n }}>\n Enter signature name...\n </div>\n }\n className=\"signature-caption-editable\"\n />\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n\n <OnChangePlugin onChange={() => {\n // Placeholder for future change handling\n }} />\n <HistoryPlugin />\n <LocalStoragePlugin namespace={initialConfig.namespace} />\n </LexicalNestedComposer>\n </div>\n );\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport \"./image-caption-styles.css\";\n\nimport { calculateZoomLevel } from \"@lexical/utils\";\nimport type { LexicalEditor } from \"lexical\";\nimport * as React from \"react\";\nimport { useRef } from \"react\";\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.min(Math.max(value, min), max);\n}\n\nconst Direction = {\n east: 1 << 0,\n north: 1 << 3,\n south: 1 << 1,\n west: 1 << 2,\n};\n\nexport default function ImageResizer({\n onResizeStart,\n onResizeEnd,\n buttonRef,\n imageRef,\n maxWidth,\n editor,\n showCaption,\n setShowCaption,\n captionsEnabled,\n}: {\n editor: LexicalEditor;\n buttonRef: { current: null | HTMLButtonElement };\n imageRef: { current: null | HTMLElement };\n maxWidth?: number;\n onResizeEnd: (width: \"inherit\" | number, height: \"inherit\" | number) => void;\n onResizeStart: () => void;\n setShowCaption: (show: boolean) => void;\n showCaption: boolean;\n captionsEnabled: boolean;\n}): JSX.Element {\n const controlWrapperRef = useRef<HTMLDivElement>(null);\n const userSelect = useRef({\n priority: \"\",\n value: \"default\",\n });\n const positioningRef = useRef<{\n currentHeight: \"inherit\" | number;\n currentWidth: \"inherit\" | number;\n direction: number;\n isResizing: boolean;\n ratio: number;\n startHeight: number;\n startWidth: number;\n startX: number;\n startY: number;\n }>({\n currentHeight: 0,\n currentWidth: 0,\n direction: 0,\n isResizing: false,\n ratio: 0,\n startHeight: 0,\n startWidth: 0,\n startX: 0,\n startY: 0,\n });\n const editorRootElement = editor.getRootElement();\n\n // Allow enlarging up to the editor container width (ignore any fixed maxWidth cap)\n const maxWidthContainer =\n editorRootElement !== null\n ? editorRootElement.getBoundingClientRect().width - 20\n : 100;\n const maxHeightContainer =\n editorRootElement !== null\n ? editorRootElement.getBoundingClientRect().height - 20\n : 100;\n\n const minWidth = 100;\n const minHeight = 100;\n\n /**\n * Sets the cursor style to indicate the resizing direction.\n * This function updates the cursor for the editor and document body\n * based on the resizing direction.\n */\n const setStartCursor = (direction: number) => {\n // Determine if the resizing is happening horizontally (east or west)\n const ew = direction === Direction.east || direction === Direction.west;\n // Determine if the resizing is happening vertically (north or south)\n const ns = direction === Direction.north || direction === Direction.south;\n // Determine if the resizing is diagonal (north-west, south-east, etc.)\n const nwse =\n (direction & Direction.north && direction & Direction.west) ||\n (direction & Direction.south && direction & Direction.east);\n\n // Set the appropriate cursor style based on the detected direction\n const cursorDir = ew ? \"ew\" : ns ? \"ns\" : nwse ? \"nwse\" : \"nesw\";\n\n // Apply the cursor style to the editor root element if it exists\n if (editorRootElement !== null) {\n editorRootElement.style.setProperty(\n \"cursor\",\n `${cursorDir}-resize`,\n \"important\"\n );\n }\n\n // Apply the cursor style to the document body\n if (document.body !== null) {\n document.body.style.setProperty(\n \"cursor\",\n `${cursorDir}-resize`,\n \"important\"\n );\n\n // Store the current user selection settings before modifying them\n userSelect.current.value = document.body.style.getPropertyValue(\n \"-webkit-user-select\"\n );\n userSelect.current.priority = document.body.style.getPropertyPriority(\n \"-webkit-user-select\"\n );\n\n // Disable text selection during resizing to prevent unwanted text selection\n document.body.style.setProperty(\n \"-webkit-user-select\",\n `none`,\n \"important\"\n );\n }\n };\n\n /**\n * Resets the cursor style when resizing ends.\n */\n\n const setEndCursor = () => {\n if (editorRootElement !== null) {\n editorRootElement.style.setProperty(\"cursor\", \"text\");\n }\n if (document.body !== null) {\n document.body.style.setProperty(\"cursor\", \"default\");\n document.body.style.setProperty(\n \"-webkit-user-select\",\n userSelect.current.value,\n userSelect.current.priority\n );\n }\n };\n\n /**\n * Handles pointer down event when resizing starts.\n */\n const handlePointerDown = (\n event: React.PointerEvent<HTMLDivElement>,\n direction: number\n ) => {\n if (!editor.isEditable()) {\n return;\n }\n const image = imageRef.current;\n const controlWrapper = controlWrapperRef.current;\n\n // Ensure both the image and control wrapper exist before proceeding\n if (image !== null && controlWrapper !== null) {\n event.preventDefault();\n\n // Get the image's current width and height from its bounding rectangle\n const { width, height } = image.getBoundingClientRect();\n // Calculate the zoom level to adjust calculations accordingly\n const zoom = calculateZoomLevel(image);\n // Retrieve the positioning reference object to store resize state\n const positioning = positioningRef.current;\n\n // Store the initial dimensions of the image\n positioning.startWidth = width;\n positioning.startHeight = height;\n // Store the aspect ratio to maintain proportions when resizing\n positioning.ratio = width / height;\n // Set the current width and height values for tracking changes\n positioning.currentWidth = width;\n positioning.currentHeight = height;\n // Store the initial pointer position, adjusted for zoom level\n positioning.startX = event.clientX / zoom;\n positioning.startY = event.clientY / zoom;\n // Mark the resizing state as active\n positioning.isResizing = true;\n // Store the resize direction (north, south, east, west, or combinations)\n positioning.direction = direction;\n\n // Set the cursor style to indicate resizing in the correct direction\n setStartCursor(direction);\n onResizeStart();\n\n controlWrapper.classList.add(\"image-control-wrapper--resizing\");\n image.style.height = `${height}px`;\n image.style.width = `${width}px`;\n document.addEventListener(\"pointermove\", handlePointerMove);\n document.addEventListener(\"pointerup\", handlePointerUp);\n }\n };\n\n /**\n * Handles pointer move event when resizing the image dynamically.\n */\n const handlePointerMove = (event: PointerEvent) => {\n const image = imageRef.current;\n const positioning = positioningRef.current;\n\n // Check if the resize direction includes horizontal movement (east or west)\n const isHorizontal =\n positioning.direction & (Direction.east | Direction.west);\n // Check if the resize direction includes vertical movement (north or south)\n const isVertical =\n positioning.direction & (Direction.south | Direction.north);\n\n if (image !== null && positioning.isResizing) {\n // Get the zoom level of the image to ensure accurate calculations\n const zoom = calculateZoomLevel(image);\n\n if (isHorizontal && isVertical) {\n // Calculate the difference in X position relative to the starting point\n let diff = Math.floor(positioning.startX - event.clientX / zoom);\n // Reverse the difference if resizing from the east to ensure correct calculations\n diff = positioning.direction & Direction.east ? -diff : diff;\n\n // Calculate the new width, ensuring it stays within allowed min and max limits\n const width = clamp(\n positioning.startWidth + diff,\n minWidth,\n maxWidthContainer\n );\n // Maintain the aspect ratio by adjusting height proportionally\n const height = width / positioning.ratio;\n // Apply the new width and height to the image\n image.style.width = `${width}px`;\n image.style.height = `${height}px`;\n // Update stored dimensions for ongoing tracking\n positioning.currentHeight = height;\n positioning.currentWidth = width;\n } else if (isVertical) {\n // Calculate the difference in Y position relative to the starting point\n let diff = Math.floor(positioning.startY - event.clientY / zoom);\n // Reverse the difference if resizing from the south to maintain correct direction\n diff = positioning.direction & Direction.south ? -diff : diff;\n\n // Calculate the new height, ensuring it stays within allowed min and max limits\n const height = clamp(\n positioning.startHeight + diff,\n minHeight,\n maxHeightContainer\n );\n\n // Apply the new height to the image\n image.style.height = `${height}px`;\n // Update stored height for ongoing tracking\n positioning.currentHeight = height;\n } else {\n // Calculate the difference in X position relative to the starting point\n let diff = Math.floor(positioning.startX - event.clientX / zoom);\n // Reverse the difference if resizing from the east to maintain correct direction\n diff = positioning.direction & Direction.east ? -diff : diff;\n\n // Calculate the new width, ensuring it stays within allowed min and max limits\n const width = clamp(\n positioning.startWidth + diff,\n minWidth,\n maxWidthContainer\n );\n\n // Apply the new width to the image\n image.style.width = `${width}px`;\n // Update stored width for ongoing tracking\n positioning.currentWidth = width;\n }\n }\n };\n\n /**\n * Handles the pointer up event when resizing ends.\n */\n const handlePointerUp = () => {\n const image = imageRef.current;\n const positioning = positioningRef.current;\n const controlWrapper = controlWrapperRef.current;\n\n // Ensure the image, control wrapper exist, and resizing is active before proceeding\n if (image !== null && controlWrapper !== null && positioning.isResizing) {\n // Capture the final width and height of the resized image\n const width = positioning.currentWidth;\n const height = positioning.currentHeight;\n\n // Reset positioning values after resizing is complete\n positioning.startWidth = 0;\n positioning.startHeight = 0;\n positioning.ratio = 0;\n positioning.startX = 0;\n positioning.startY = 0;\n positioning.currentWidth = 0;\n positioning.currentHeight = 0;\n positioning.isResizing = false; // Mark resizing as finished\n\n // Remove the resizing class from the control wrapper\n controlWrapper.classList.remove(\"image-control-wrapper--resizing\");\n\n // Restore default cursor appearance\n setEndCursor();\n // Trigger the resize end callback with the final dimensions\n onResizeEnd(width, height);\n\n // Remove event listeners for pointer movement and release to stop tracking\n document.removeEventListener(\"pointermove\", handlePointerMove);\n document.removeEventListener(\"pointerup\", handlePointerUp);\n }\n };\n\n return (\n <div ref={controlWrapperRef}>\n {!showCaption && captionsEnabled && (\n <button\n className=\"image-caption-button\"\n ref={buttonRef}\n onClick={() => {\n setShowCaption(!showCaption);\n }}\n >\n Add Caption\n </button>\n )}\n <div\n className=\"image-resizer image-resizer-n\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.north);\n }}\n />\n <div\n className=\"image-resizer image-resizer-ne\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.north | Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-e\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-se\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.south | Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-s\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.south);\n }}\n />\n <div\n className=\"image-resizer image-resizer-sw\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.south | Direction.west);\n }}\n />\n <div\n className=\"image-resizer image-resizer-w\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.west);\n }}\n />\n <div\n className=\"image-resizer image-resizer-nw\"\n onPointerDown={(event) => {\n handlePointerDown(event, Direction.north | Direction.west);\n }}\n />\n </div>\n );\n}\n","import React from \"react\";\nimport { Button } from \"../ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from \"../ui/dialog\";\n\ninterface ImageComparisonDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n oldImageUrl: string;\n newImageUrl: string;\n onReplace: () => void;\n onCancel: () => void;\n}\n\nexport const ImageComparisonDialog: React.FC<ImageComparisonDialogProps> = ({\n open,\n onOpenChange,\n oldImageUrl,\n newImageUrl,\n onReplace,\n onCancel,\n}) => {\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent className=\"sm:max-w-[800px] max-h-[90vh] overflow-y-auto\">\n <DialogHeader>\n <DialogTitle className=\"flex items-center gap-2 text-xl\">\n <span className=\"text-2xl\">🔄</span>\n Compare Images\n </DialogTitle>\n <DialogDescription className=\"text-sm pt-1\">\n Choose whether to replace the original image with the refined version.\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"space-y-4 py-4\">\n <div className=\"grid grid-cols-2 gap-4\">\n\n {/* New Image */}\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-sm font-semibold text-gray-700 dark:text-gray-300\">\n Refined Image\n </span>\n <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\">\n New\n </span>\n </div>\n <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\">\n <img\n src={newImageUrl}\n alt=\"Refined\"\n className=\"w-full h-full object-contain\"\n />\n </div>\n </div>\n </div>\n\n {/* Info */}\n <div className=\"p-3 rounded-lg bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800\">\n <p className=\"text-sm text-blue-800 dark:text-blue-200\">\n <span className=\"font-semibold\">Note:</span> Clicking \"Replace\" will update the image in your document.\n This action cannot be undone.\n </p>\n </div>\n </div>\n\n <DialogFooter className=\"gap-2\">\n <Button\n variant=\"outline\"\n onClick={onCancel}\n >\n Keep Original\n </Button>\n <Button\n onClick={onReplace}\n className=\"bg-blue-500 hover:bg-blue-600 text-white\"\n >\n <span className=\"mr-2\">✓</span>\n Replace Image\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n};\n\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport \"./image-caption-styles.css\";\n\nimport { CodeNode } from \"@lexical/code\";\nimport { LinkNode } from \"@lexical/link\";\nimport { AutoFocusPlugin } from \"@lexical/react/LexicalAutoFocusPlugin\";\nimport { useCollaborationContext } from \"@lexical/react/LexicalCollaborationContext\";\nimport { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary\";\nimport { HistoryPlugin } from \"@lexical/react/LexicalHistoryPlugin\";\nimport { LexicalNestedComposer } from \"@lexical/react/LexicalNestedComposer\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\n// import './ImageNode.css';\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport { useLexicalEditable } from \"@lexical/react/useLexicalEditable\";\nimport { useLexicalNodeSelection } from \"@lexical/react/useLexicalNodeSelection\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport type {\n BaseSelection,\n LexicalCommand,\n LexicalEditor,\n NodeKey,\n} from \"lexical\";\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n $isRangeSelection,\n $setSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n createCommand,\n DRAGSTART_COMMAND,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n KEY_ENTER_COMMAND,\n KEY_ESCAPE_COMMAND,\n LineBreakNode,\n ParagraphNode,\n RootNode,\n SELECTION_CHANGE_COMMAND,\n TextNode,\n} from \"lexical\";\nimport { ExternalLink, Trash2, Sparkles } from \"lucide-react\";\nimport * as React from \"react\";\nimport { Suspense, useCallback, useEffect, useRef, useState } from \"react\";\n// import brokenImage from '../images/image-broken.svg';\nimport { toast } from \"sonner\";\nimport { initialConfig } from \"src/constants\";\nimport { $isImageNode } from \"src/nodes/ImageNode\";\nimport LocalStoragePlugin from \"src/plugins/LocalStoragePlugin\";\n\nimport SignatureCaption from \"../SignatureCaption\";\nimport ImageResizer from \"./ImageResizer\";\nimport { AiJsonResponse } from \"../../api/ai\";\nimport { ImageComparisonDialog } from \"../ImageComparisonDialog\";\n\nconst imageCache = new Set();\n\nexport const RIGHT_CLICK_IMAGE_COMMAND: LexicalCommand<MouseEvent> =\n createCommand(\"RIGHT_CLICK_IMAGE_COMMAND\");\n\nfunction useSuspenseImage(src: string) {\n if (!imageCache.has(src)) {\n throw new Promise((resolve) => {\n const img = new Image();\n img.src = src;\n img.onload = () => {\n imageCache.add(src);\n resolve(null);\n };\n img.onerror = () => {\n imageCache.add(src);\n };\n });\n }\n}\n\nfunction LazyImage({\n altText,\n className,\n imageRef,\n src,\n width,\n height,\n maxWidth,\n onError,\n}: {\n altText: string;\n className: string | null;\n height: \"inherit\" | number;\n imageRef: { current: null | HTMLImageElement };\n maxWidth: number;\n src: string;\n width: \"inherit\" | number;\n onError: () => void;\n}): JSX.Element {\n useSuspenseImage(src);\n const hasExplicitSize = typeof width === 'number' && typeof height === 'number';\n const computedWidth = typeof width === 'number' ? width : 'auto';\n const computedHeight = typeof height === 'number' ? height : 'auto';\n\n return (\n <img\n className={className || undefined}\n src={src}\n alt={altText}\n ref={imageRef}\n style={\n hasExplicitSize\n ? {\n // User has set a numeric size or original dimensions are provided\n width: computedWidth,\n height: computedHeight,\n maxWidth: '100%',\n }\n : {\n // No dimensions specified - use original image size\n maxWidth: '100%',\n height: 'auto',\n }\n }\n onError={onError}\n draggable=\"false\"\n />\n );\n}\n\n// if the image is broken ; we are showing this component\nfunction BrokenImage(): JSX.Element {\n return (\n <img\n src={\"\"} //TODO: NEED TO ADD BROKEN IMAGE\n style={{\n height: 200,\n opacity: 0.2,\n width: 200,\n }}\n draggable=\"false\"\n />\n );\n}\n\nexport default function ImageComponent({\n src,\n altText,\n nodeKey,\n width,\n height,\n maxWidth,\n resizable,\n showCaption,\n caption,\n captionsEnabled,\n originalPrompt,\n}: {\n altText: string;\n caption: LexicalEditor;\n height: \"inherit\" | number;\n maxWidth: number;\n nodeKey: NodeKey;\n resizable: boolean;\n showCaption: boolean;\n src: string;\n width: \"inherit\" | number;\n captionsEnabled: boolean;\n originalPrompt?: string;\n}): JSX.Element {\n const imageRef = useRef<null | HTMLImageElement>(null);\n const buttonRef = useRef<HTMLButtonElement | null>(null);\n const [isSelected, setSelected, clearSelection] =\n useLexicalNodeSelection(nodeKey);\n const [isResizing, setIsResizing] = useState<boolean>(false);\n const { isCollabActive } = useCollaborationContext();\n const [editor] = useLexicalComposerContext();\n const [selection, setSelection] = useState<BaseSelection | null>(null);\n const activeEditorRef = useRef<LexicalEditor | null>(null);\n const [isLoadError, setIsLoadError] = useState<boolean>(false);\n const isEditable = useLexicalEditable();\n const [showRefineInput, setShowRefineInput] = useState<boolean>(false);\n const [refinementPrompt, setRefinementPrompt] = useState<string>(\"\");\n const [isRefining, setIsRefining] = useState<boolean>(false);\n const [showComparisonDialog, setShowComparisonDialog] = useState<boolean>(false);\n const [newImageUrl, setNewImageUrl] = useState<string>(\"\");\n const [newCombinedPrompt, setNewCombinedPrompt] = useState<string>(\"\");\n\n /**\n * Deletes the image node when the delete key is pressed.\n */\n const $onDelete = useCallback(\n (payload: KeyboardEvent) => {\n const deleteSelection = $getSelection();\n if (isSelected && $isNodeSelection(deleteSelection)) {\n const event: KeyboardEvent = payload;\n event.preventDefault();\n editor.update(() => {\n deleteSelection.getNodes().forEach((node) => {\n if ($isImageNode(node)) {\n node.remove();\n }\n });\n });\n }\n return false;\n },\n [editor, isSelected]\n );\n\n /**\n * Handles enter key to move focus into the caption editor.\n */\n const $onEnter = useCallback(\n (event: KeyboardEvent) => {\n const latestSelection = $getSelection();\n const buttonElem = buttonRef.current;\n if (\n isSelected &&\n $isNodeSelection(latestSelection) &&\n latestSelection.getNodes().length === 1\n ) {\n if (showCaption) {\n // Move focus into nested editor\n $setSelection(null);\n event.preventDefault();\n caption.focus();\n return true;\n } else if (\n buttonElem !== null &&\n buttonElem !== document.activeElement\n ) {\n event.preventDefault();\n buttonElem.focus();\n return true;\n }\n }\n return false;\n },\n [caption, isSelected, showCaption]\n );\n\n /**\n * Handles escape key to reset selection.\n */\n const $onEscape = useCallback(\n (event: KeyboardEvent) => {\n if (\n activeEditorRef.current === caption ||\n buttonRef.current === event.target\n ) {\n $setSelection(null);\n editor.update(() => {\n setSelected(true);\n const parentRootElement = editor.getRootElement();\n if (parentRootElement !== null) {\n parentRootElement.focus();\n }\n });\n return true;\n }\n return false;\n },\n [caption, editor, setSelected]\n );\n\n const onClick = useCallback(\n (payload: MouseEvent) => {\n const event = payload;\n\n if (isResizing) {\n return true;\n }\n if (event.target === imageRef.current) {\n if (event.shiftKey) {\n setSelected(!isSelected);\n } else {\n clearSelection();\n setSelected(true);\n }\n return true;\n }\n\n return false;\n },\n [isResizing, isSelected, setSelected, clearSelection]\n );\n\n const onRightClick = useCallback(\n (event: MouseEvent): void => {\n editor.getEditorState().read(() => {\n const latestSelection = $getSelection();\n const domElement = event.target as HTMLElement;\n if (\n domElement.tagName === \"IMG\" &&\n $isRangeSelection(latestSelection) &&\n latestSelection.getNodes().length === 1\n ) {\n editor.dispatchCommand(\n RIGHT_CLICK_IMAGE_COMMAND,\n event as MouseEvent\n );\n }\n });\n },\n [editor]\n );\n\n useEffect(() => {\n let isMounted = true;\n const rootElement = editor.getRootElement();\n const unregister = mergeRegister(\n editor.registerUpdateListener(({ editorState }) => {\n if (isMounted) {\n setSelection(editorState.read(() => $getSelection()));\n }\n }),\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n (_, activeEditor) => {\n activeEditorRef.current = activeEditor;\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand<MouseEvent>(\n CLICK_COMMAND,\n onClick,\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand<MouseEvent>(\n RIGHT_CLICK_IMAGE_COMMAND,\n onClick,\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n DRAGSTART_COMMAND,\n (event) => {\n if (event.target === imageRef.current) {\n // Temporary workaround for FF to behave like other browsers.\n // Ideally, this handles drag & drop too (and all browsers).\n event.preventDefault();\n return true;\n }\n return false;\n },\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n KEY_DELETE_COMMAND,\n $onDelete,\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(\n KEY_BACKSPACE_COMMAND,\n $onDelete,\n COMMAND_PRIORITY_LOW\n ),\n editor.registerCommand(KEY_ENTER_COMMAND, $onEnter, COMMAND_PRIORITY_LOW),\n editor.registerCommand(\n KEY_ESCAPE_COMMAND,\n $onEscape,\n COMMAND_PRIORITY_LOW\n )\n );\n\n rootElement?.addEventListener(\"contextmenu\", onRightClick);\n\n return () => {\n isMounted = false;\n unregister();\n rootElement?.removeEventListener(\"contextmenu\", onRightClick);\n };\n }, [\n clearSelection,\n editor,\n isResizing,\n isSelected,\n nodeKey,\n $onDelete,\n $onEnter,\n $onEscape,\n onClick,\n onRightClick,\n setSelected,\n ]);\n\n const setShowCaption = () => {\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isImageNode(node)) {\n node.setShowCaption(true);\n }\n });\n };\n\n const onResizeEnd = (\n nextWidth: \"inherit\" | number,\n nextHeight: \"inherit\" | number\n ) => {\n // Delay hiding the resize bars for click case\n setTimeout(() => {\n setIsResizing(false);\n }, 200);\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isImageNode(node)) {\n node.setWidthAndHeight(nextWidth, nextHeight);\n }\n });\n };\n\n const onResizeStart = () => {\n setIsResizing(true);\n };\n\n const handleOpenInNewTab = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // Check if it's a data URL (base64)\n if (src.startsWith('data:')) {\n // For data URLs, we need to open them in a new tab with the image displayed\n const newWindow = window.open('', '_blank');\n if (newWindow) {\n newWindow.document.write(`\n <!DOCTYPE html>\n <html>\n <head>\n <title>${altText || 'Image'}</title>\n <style>\n body {\n margin: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 100vh;\n background-color: #1a1a1a;\n }\n img {\n max-width: 100%;\n max-height: 100vh;\n object-fit: contain;\n }\n </style>\n </head>\n <body>\n <img src=\"${src}\" alt=\"${altText || 'Image'}\" />\n </body>\n </html>\n `);\n newWindow.document.close();\n }\n } else {\n // For regular URLs, just open them directly\n window.open(src, '_blank');\n }\n };\n\n const handleDeleteImage = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isImageNode(node)) {\n node.remove();\n }\n });\n };\n\n const handleRefineClick = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setShowRefineInput(!showRefineInput);\n };\n\n const handleRefineImage = async () => {\n if (!refinementPrompt.trim() || isRefining) return;\n\n setIsRefining(true);\n \n // Show loading toast\n const loadingToast = toast.loading(\"Refining image...\", {\n description: \"This may take 10-30 seconds. Please wait.\",\n });\n \n try {\n // Intelligently combine original prompt with refinement\n let combinedPrompt = refinementPrompt.trim();\n \n // Check if we have an original prompt\n if (originalPrompt && originalPrompt.trim()) {\n const original = originalPrompt.trim();\n const refinement = refinementPrompt.trim();\n \n // Remove common \"add\" prefixes from refinement\n const cleanedRefinement = refinement\n .replace(/^(add|also add|include|with|and)\\s+(some|a|an)\\s+/gi, '')\n .replace(/^(add|also add|include|with|and)\\s+/gi, '')\n .trim();\n \n // Simple and clear combination - just list both elements\n // This is the most reliable format for DALL-E\n combinedPrompt = `${original} with ${cleanedRefinement}`;\n } else {\n // No original prompt (image was created before this feature)\n // Try to use altText or just use the refinement as-is\n if (altText && altText !== \"Generated image\" && altText.trim()) {\n // Use altText as the original description\n const cleanedRefinement = refinementPrompt.trim()\n .replace(/^(add|also add|include|with|and)\\s+(some|a|an)\\s+/gi, '')\n .replace(/^(add|also add|include|with|and)\\s+/gi, '')\n .trim();\n combinedPrompt = `${altText} with ${cleanedRefinement}`;\n }\n // else: Just use the refinement prompt as-is\n }\n\n // Generate refined image with combined prompt\n const response = await AiJsonResponse({ content: `Generate Image: ${combinedPrompt}` });\n const htmlString = response?.data;\n\n if (!htmlString) {\n throw new Error(\"Failed to generate image - empty response\");\n }\n\n // Extract image URL from HTML response\n const parser = new DOMParser();\n const dom = parser.parseFromString(htmlString, \"text/html\");\n const imgElement = dom.querySelector(\"img\");\n\n if (!imgElement || !imgElement.src) {\n throw new Error(`No image found in response`);\n }\n\n const generatedImageUrl = imgElement.src;\n\n // Dismiss loading toast and show success\n toast.dismiss(loadingToast);\n toast.success(\"Image refined successfully!\", {\n description: \"Compare the images and choose which to keep.\",\n });\n\n // Store new image URL, combined prompt, and show comparison dialog\n setNewImageUrl(generatedImageUrl);\n setNewCombinedPrompt(combinedPrompt);\n setShowComparisonDialog(true);\n\n // Clear refinement input and close it\n setRefinementPrompt(\"\");\n setShowRefineInput(false);\n } catch (error) {\n // Dismiss loading toast and show error\n toast.dismiss(loadingToast);\n toast.error(\"Failed to refine image\", {\n description: error instanceof Error ? error.message : 'Unknown error. Please try again.',\n });\n } finally {\n setIsRefining(false);\n }\n };\n\n const handleReplaceImage = () => {\n // Update the image node with new URL and updated prompt\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isImageNode(node)) {\n // Use setter methods which properly call getWritable()\n node.setSrc(newImageUrl);\n node.setOriginalPrompt(newCombinedPrompt);\n \n // Force Lexical to re-render the DecoratorNode by triggering selection change\n const currentSelection = $getSelection();\n if (currentSelection) {\n $setSelection(currentSelection.clone());\n }\n }\n });\n\n // Close dialog and reset\n setShowComparisonDialog(false);\n setNewImageUrl(\"\");\n setNewCombinedPrompt(\"\");\n \n // Show success toast\n toast.success(\"Image replaced successfully!\", {\n description: \"The image has been updated with the refined version.\",\n });\n };\n\n const handleCancelReplace = () => {\n // Just close dialog and reset\n setShowComparisonDialog(false);\n setNewImageUrl(\"\");\n setNewCombinedPrompt(\"\");\n };\n\n const draggable = isSelected && $isNodeSelection(selection) && !isResizing;\n const isFocused = (isSelected || isResizing) && isEditable;\n return (\n <Suspense fallback={null}>\n <>\n <div draggable={draggable} style={{ position: 'relative', display: 'inline-block' }}>\n {isLoadError ? (\n <BrokenImage />\n ) : (\n <LazyImage\n className={\n isFocused\n ? `focused ${$isNodeSelection(selection) ? \"draggable\" : \"\"}`\n : null\n }\n src={src}\n altText={altText}\n imageRef={imageRef}\n width={width}\n height={height}\n maxWidth={maxWidth}\n onError={() => setIsLoadError(true)}\n />\n )}\n {/* Action Buttons - Refine, Open in New Tab and Delete */}\n {isSelected && $isNodeSelection(selection) && !isLoadError && (\n <div className=\"cteditor-absolute cteditor-top-2 cteditor-right-2 cteditor-flex cteditor-gap-2\" style={{ zIndex: 10 }}>\n <button\n onClick={(e) => {\n e.stopPropagation();\n handleRefineClick(e);\n }}\n 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\"\n aria-label=\"Refine image\"\n title=\"Refine image\"\n >\n <Sparkles className=\"cteditor-w-4 cteditor-h-4 cteditor-text-foreground\" />\n </button>\n <button\n onClick={(e) => {\n e.stopPropagation();\n handleOpenInNewTab(e);\n }}\n 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\"\n aria-label=\"Open image in new tab\"\n title=\"Open in new tab\"\n >\n <ExternalLink className=\"cteditor-w-4 cteditor-h-4 cteditor-text-foreground\" />\n </button>\n <button\n onClick={(e) => {\n e.stopPropagation();\n handleDeleteImage(e);\n }}\n 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\"\n aria-label=\"Delete image\"\n title=\"Delete image\"\n >\n <Trash2 className=\"cteditor-w-4 cteditor-h-4 cteditor-text-foreground\" />\n </button>\n </div>\n )}\n {/* Refine Input */}\n {showRefineInput && isSelected && !isLoadError && (\n <div \n 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\" \n style={{ zIndex: 10 }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n onKeyUp={(e) => e.stopPropagation()}\n >\n <div className=\"cteditor-flex cteditor-flex-col cteditor-gap-2\">\n <label className=\"cteditor-text-xs cteditor-font-medium cteditor-text-foreground\">\n What else do you want in this scene?\n </label>\n <input\n type=\"text\"\n value={refinementPrompt}\n onChange={(e) => setRefinementPrompt(e.target.value)}\n onKeyDown={(e) => {\n // Stop propagation to prevent editor commands from firing\n e.stopPropagation();\n \n if (e.key === 'Enter' && refinementPrompt.trim() && !isRefining) {\n handleRefineImage();\n }\n if (e.key === 'Escape') {\n setShowRefineInput(false);\n setRefinementPrompt(\"\");\n }\n }}\n onKeyUp={(e) => {\n // Also stop propagation on keyup\n e.stopPropagation();\n }}\n onClick={(e) => {\n // Prevent click from bubbling to image selection\n e.stopPropagation();\n }}\n placeholder=\"e.g., flying birds, golden sunset, stormy clouds...\"\n 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\"\n disabled={isRefining}\n autoFocus\n />\n <div className=\"cteditor-flex cteditor-gap-2\">\n <button\n onClick={(e) => {\n e.stopPropagation();\n handleRefineImage();\n }}\n disabled={isRefining || !refinementPrompt.trim()}\n 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\"\n >\n {isRefining ? (\n <span className=\"cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2\">\n <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\"></span>\n Refining...\n </span>\n ) : (\n \"Refine Image\"\n )}\n </button>\n <button\n onClick={(e) => {\n e.stopPropagation();\n setShowRefineInput(false);\n setRefinementPrompt(\"\");\n }}\n disabled={isRefining}\n 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\"\n >\n Cancel\n </button>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {showCaption && (\n altText.startsWith(\"Signature by\") ? (\n <SignatureCaption caption={caption} />\n ) : (\n <div className=\"image-caption-container\">\n <LexicalNestedComposer\n initialEditor={caption}\n initialNodes={[\n RootNode,\n TextNode,\n LineBreakNode,\n ParagraphNode,\n LinkNode,\n CodeNode,\n ]}\n >\n <AutoFocusPlugin />\n\n <RichTextPlugin\n contentEditable={\n <ContentEditable\n aria-placeholder=\"Enter a caption...\"\n placeholder={() => <span className=\"cteditor-text-xs\">Enter a caption...</span>}\n className=\"ImageNode__contentEditable\"\n />\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n\n <OnChangePlugin onChange={() => {}} />\n <HistoryPlugin />\n <LocalStoragePlugin namespace={initialConfig.namespace} />\n </LexicalNestedComposer>\n </div>\n )\n )}\n {resizable && $isNodeSelection(selection) && isFocused && (\n <ImageResizer\n showCaption={showCaption}\n setShowCaption={setShowCaption}\n editor={editor}\n buttonRef={buttonRef}\n imageRef={imageRef}\n maxWidth={maxWidth}\n onResizeStart={onResizeStart}\n onResizeEnd={onResizeEnd}\n captionsEnabled={!isLoadError && captionsEnabled}\n />\n )}\n\n {/* Image Comparison Dialog */}\n <ImageComparisonDialog\n open={showComparisonDialog}\n onOpenChange={setShowComparisonDialog}\n oldImageUrl={src}\n newImageUrl={newImageUrl}\n onReplace={handleReplaceImage}\n onCancel={handleCancelReplace}\n />\n </>\n </Suspense>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAwB,iBAAiB;AAAA,EACvC;AACF,GAAuC;AAEnC,SAAA,oBAAC,OAAI,EAAA,WAAU,+BACb,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAe;AAAA,MACf,cAAc;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEA,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,iBACE;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,oBAAiB;AAAA,gBACjB,aACG,oBAAA,OAAA,EAAI,OAAO;AAAA,kBACV,UAAU;AAAA,kBACV,KAAK;AAAA,kBACL,MAAM;AAAA,kBACN,OAAO;AAAA,kBACP,WAAW;AAAA,kBACX,eAAe;AAAA,kBACf,OAAO;AAAA,kBACP,WAAW;AAAA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AAA,MAAA;AAAA,IAE5D,EAAA,CAAA;AAAA,IAGH,aAAa,iBAAiB,SAAS,KAAK,aAC3C;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,iBAAiB,CAAC,eAAe;AAAA,MAAA;AAAA,IACnC;AAAA,IAIF;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN,cAAc;AAAA,QACd,aAAa;AAAA,QACb;AAAA,QACA,WAAW;AAAA,QACX,UAAU;AAAA,MAAA;AAAA,IACZ;AAAA,EAAA,EACF,CAAA,EACF,CAAA;AAEJ;"}
|
|
@@ -1477,7 +1477,7 @@ const AiTextTransform = async ({ content, apiKey }) => {
|
|
|
1477
1477
|
const AI_ACTION_COMMAND = createCommand(
|
|
1478
1478
|
"AI_ACTION_COMMAND"
|
|
1479
1479
|
);
|
|
1480
|
-
const ImageView = React__default.lazy(() => import("./index-
|
|
1480
|
+
const ImageView = React__default.lazy(() => import("./index-d292603a.js"));
|
|
1481
1481
|
function isGoogleDocCheckboxImg(img) {
|
|
1482
1482
|
return img.parentElement != null && img.parentElement.tagName === "LI" && img.previousSibling === null && img.getAttribute("aria-roledescription") === "checkbox";
|
|
1483
1483
|
}
|
|
@@ -15226,7 +15226,7 @@ const EmbedComponent = ({ url, displayType, alignment, nodeKey }) => {
|
|
|
15226
15226
|
}
|
|
15227
15227
|
);
|
|
15228
15228
|
};
|
|
15229
|
-
const FileComponent = React$1.lazy(() => import("./index-
|
|
15229
|
+
const FileComponent = React$1.lazy(() => import("./index-e0dbaf6d.js"));
|
|
15230
15230
|
function convertFileElement(domNode) {
|
|
15231
15231
|
if (domNode instanceof HTMLDivElement) {
|
|
15232
15232
|
const dataUrl = domNode.getAttribute("data-lexical-file-src");
|
|
@@ -20113,10 +20113,10 @@ const PDF_CONFIG = {
|
|
|
20113
20113
|
};
|
|
20114
20114
|
const loadHtml2Pdf = async () => {
|
|
20115
20115
|
try {
|
|
20116
|
-
const mod = await import("./html2pdf.bundle.min-
|
|
20116
|
+
const mod = await import("./html2pdf.bundle.min-655f7464.js").then((n) => n.h);
|
|
20117
20117
|
return (mod == null ? void 0 : mod.default) || mod;
|
|
20118
20118
|
} catch {
|
|
20119
|
-
const mod2 = await import("./html2pdf.bundle-
|
|
20119
|
+
const mod2 = await import("./html2pdf.bundle-7796d91e.js").then((n) => n.h);
|
|
20120
20120
|
return (mod2 == null ? void 0 : mod2.default) || mod2;
|
|
20121
20121
|
}
|
|
20122
20122
|
};
|
|
@@ -27144,7 +27144,7 @@ function CombinedAutocompleteGrammarPlugin({
|
|
|
27144
27144
|
debounceDelay = 800
|
|
27145
27145
|
}) {
|
|
27146
27146
|
const [editor] = useLexicalComposerContext();
|
|
27147
|
-
const { toolbarState } = useToolbarState();
|
|
27147
|
+
const { toolbarState, updateToolbarState } = useToolbarState();
|
|
27148
27148
|
const lastTextMap = useRef([]);
|
|
27149
27149
|
const grammarService = useRef(new GrammarAIService(apiEndpoint));
|
|
27150
27150
|
const checkTimeout = useRef();
|
|
@@ -27207,7 +27207,7 @@ function CombinedAutocompleteGrammarPlugin({
|
|
|
27207
27207
|
setQueryString(null);
|
|
27208
27208
|
}, []);
|
|
27209
27209
|
const checkGrammar = useCallback(async () => {
|
|
27210
|
-
if (!toolbarState.
|
|
27210
|
+
if (!toolbarState.isAutocompleteEnabled || !enableAI) {
|
|
27211
27211
|
setErrors([]);
|
|
27212
27212
|
setErrorMap(/* @__PURE__ */ new Map());
|
|
27213
27213
|
setCheckingSentences(/* @__PURE__ */ new Set());
|
|
@@ -27217,8 +27217,6 @@ function CombinedAutocompleteGrammarPlugin({
|
|
|
27217
27217
|
if (!fullText)
|
|
27218
27218
|
return;
|
|
27219
27219
|
lastTextMap.current = nodeMap;
|
|
27220
|
-
if (fullText.trim() === lastCheckedText.current.trim())
|
|
27221
|
-
return;
|
|
27222
27220
|
if (fullText.trim().length < 3) {
|
|
27223
27221
|
setErrors([]);
|
|
27224
27222
|
setErrorMap(/* @__PURE__ */ new Map());
|
|
@@ -27466,6 +27464,11 @@ function CombinedAutocompleteGrammarPlugin({
|
|
|
27466
27464
|
if (!toolbarState.isAutocompleteEnabled) {
|
|
27467
27465
|
setQueryString(null);
|
|
27468
27466
|
setSuggestions([]);
|
|
27467
|
+
setErrors([]);
|
|
27468
|
+
setErrorMap(/* @__PURE__ */ new Map());
|
|
27469
|
+
setCheckingSentences(/* @__PURE__ */ new Set());
|
|
27470
|
+
} else {
|
|
27471
|
+
checkGrammar();
|
|
27469
27472
|
}
|
|
27470
27473
|
}, [toolbarState.isAutocompleteEnabled]);
|
|
27471
27474
|
useEffect$1(() => {
|
|
@@ -27567,6 +27570,8 @@ function CombinedAutocompleteGrammarPlugin({
|
|
|
27567
27570
|
};
|
|
27568
27571
|
}, []);
|
|
27569
27572
|
useEffect$1(() => {
|
|
27573
|
+
if (!toolbarState.isAutocompleteEnabled)
|
|
27574
|
+
return;
|
|
27570
27575
|
const unregister = editor.registerUpdateListener(() => {
|
|
27571
27576
|
clearTimeout(checkTimeout.current);
|
|
27572
27577
|
checkTimeout.current = window.setTimeout(checkGrammar, 1e3);
|
|
@@ -27822,22 +27827,50 @@ function CombinedAutocompleteGrammarPlugin({
|
|
|
27822
27827
|
] })
|
|
27823
27828
|
}
|
|
27824
27829
|
),
|
|
27830
|
+
/* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-gap-2", children: [
|
|
27831
|
+
/* @__PURE__ */ jsx(
|
|
27832
|
+
"button",
|
|
27833
|
+
{
|
|
27834
|
+
onClick: () => dismissError(error),
|
|
27835
|
+
className: "cteditor-flex-1 cteditor-px-4 cteditor-py-2 cteditor-text-sm cteditor-text-gray-600 hover:cteditor-bg-gray-100 cteditor-rounded-lg cteditor-border cteditor-border-gray-300",
|
|
27836
|
+
children: "Dismiss"
|
|
27837
|
+
}
|
|
27838
|
+
),
|
|
27839
|
+
/* @__PURE__ */ jsx(
|
|
27840
|
+
"button",
|
|
27841
|
+
{
|
|
27842
|
+
onClick: () => {
|
|
27843
|
+
updateToolbarState("isAutocompleteEnabled", false);
|
|
27844
|
+
setTooltipState(null);
|
|
27845
|
+
},
|
|
27846
|
+
className: "cteditor-px-3 cteditor-py-2 cteditor-text-xs cteditor-text-gray-500 hover:cteditor-text-gray-700 hover:cteditor-bg-gray-50 cteditor-rounded-lg cteditor-border cteditor-border-gray-200",
|
|
27847
|
+
title: "Turn off grammar checking",
|
|
27848
|
+
children: "Disable"
|
|
27849
|
+
}
|
|
27850
|
+
)
|
|
27851
|
+
] })
|
|
27852
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-gap-2", children: [
|
|
27825
27853
|
/* @__PURE__ */ jsx(
|
|
27826
27854
|
"button",
|
|
27827
27855
|
{
|
|
27828
27856
|
onClick: () => dismissError(error),
|
|
27829
|
-
className: "cteditor-
|
|
27857
|
+
className: "cteditor-flex-1 cteditor-px-4 cteditor-py-2 cteditor-text-sm cteditor-text-gray-600 hover:cteditor-bg-gray-100 cteditor-rounded-lg cteditor-border cteditor-border-gray-300",
|
|
27830
27858
|
children: "Dismiss"
|
|
27831
27859
|
}
|
|
27860
|
+
),
|
|
27861
|
+
/* @__PURE__ */ jsx(
|
|
27862
|
+
"button",
|
|
27863
|
+
{
|
|
27864
|
+
onClick: () => {
|
|
27865
|
+
updateToolbarState("isAutocompleteEnabled", false);
|
|
27866
|
+
setTooltipState(null);
|
|
27867
|
+
},
|
|
27868
|
+
className: "cteditor-px-3 cteditor-py-2 cteditor-text-xs cteditor-text-gray-500 hover:cteditor-text-gray-700 hover:cteditor-bg-gray-50 cteditor-rounded-lg cteditor-border cteditor-border-gray-200",
|
|
27869
|
+
title: "Turn off grammar checking",
|
|
27870
|
+
children: "Disable"
|
|
27871
|
+
}
|
|
27832
27872
|
)
|
|
27833
|
-
] })
|
|
27834
|
-
"button",
|
|
27835
|
-
{
|
|
27836
|
-
onClick: () => dismissError(error),
|
|
27837
|
-
className: "cteditor-w-full cteditor-mt-2 cteditor-px-4 cteditor-py-2 cteditor-text-sm cteditor-text-gray-600 hover:cteditor-bg-gray-100 cteditor-rounded-lg cteditor-border cteditor-border-gray-300",
|
|
27838
|
-
children: "Dismiss"
|
|
27839
|
-
}
|
|
27840
|
-
)
|
|
27873
|
+
] })
|
|
27841
27874
|
] }) })
|
|
27842
27875
|
}
|
|
27843
27876
|
),
|
|
@@ -34822,10 +34855,10 @@ const ToolbarWithEditor = (props) => {
|
|
|
34822
34855
|
};
|
|
34823
34856
|
const CombinedPluginWrapper = () => {
|
|
34824
34857
|
const { toolbarState } = useToolbarState();
|
|
34825
|
-
if (!toolbarState.isAutocompleteEnabled
|
|
34858
|
+
if (!toolbarState.isAutocompleteEnabled || !toolbarState.isGrammarCheckEnabled) {
|
|
34826
34859
|
return null;
|
|
34827
34860
|
}
|
|
34828
|
-
return /* @__PURE__ */ jsx(CombinedAutocompleteGrammarPlugin, { minMatchLength: 2, maxSuggestions: 10, enableAI: true });
|
|
34861
|
+
return /* @__PURE__ */ jsx(CombinedAutocompleteGrammarPlugin, { minMatchLength: 2, maxSuggestions: 10, enableAI: (toolbarState == null ? void 0 : toolbarState.isAutocompleteEnabled) ?? true });
|
|
34829
34862
|
};
|
|
34830
34863
|
const OnChangeWrapper = ({ onChange }) => {
|
|
34831
34864
|
const [editor] = useLexicalComposerContext();
|
|
@@ -35221,4 +35254,4 @@ export {
|
|
|
35221
35254
|
useHtmlView as u,
|
|
35222
35255
|
verifyApiKey as v
|
|
35223
35256
|
};
|
|
35224
|
-
//# sourceMappingURL=index-
|
|
35257
|
+
//# sourceMappingURL=index-d5866754.js.map
|