ct-rich-text-editor 1.0.5 → 1.0.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index-6a36a18c.js","sources":["../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalAutoFocusPlugin.dev.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalAutoFocusPlugin.prod.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalAutoFocusPlugin.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalCollaborationContext.dev.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalCollaborationContext.prod.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalCollaborationContext.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalNestedComposer.dev.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalNestedComposer.prod.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalNestedComposer.mjs","../src/components/ImageView/ImageResizer.tsx","../src/components/ImageView/index.tsx"],"sourcesContent":["/**\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 { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { useEffect } from 'react';\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\nfunction AutoFocusPlugin({\n defaultSelection\n}) {\n const [editor] = useLexicalComposerContext();\n useEffect(() => {\n editor.focus(() => {\n // If we try and move selection to the same point with setBaseAndExtent, it won't\n // trigger a re-focus on the element. So in the case this occurs, we'll need to correct it.\n // Normally this is fine, Selection API !== Focus API, but fore the intents of the naming\n // of this plugin, which should preserve focus too.\n const activeElement = document.activeElement;\n const rootElement = editor.getRootElement();\n if (rootElement !== null && (activeElement === null || !rootElement.contains(activeElement))) {\n // Note: preventScroll won't work in Webkit.\n rootElement.focus({\n preventScroll: true\n });\n }\n }, {\n defaultSelection\n });\n }, [defaultSelection, editor]);\n return null;\n}\n\nexport { AutoFocusPlugin };\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{useLexicalComposerContext as e}from\"@lexical/react/LexicalComposerContext\";import{useEffect as t}from\"react\";function o({defaultSelection:o}){const[l]=e();return t((()=>{l.focus((()=>{const e=document.activeElement,t=l.getRootElement();null===t||null!==e&&t.contains(e)||t.focus({preventScroll:!0})}),{defaultSelection:o})}),[o,l]),null}export{o as AutoFocusPlugin};\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 * as modDev from './LexicalAutoFocusPlugin.dev.mjs';\nimport * as modProd from './LexicalAutoFocusPlugin.prod.mjs';\nconst mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;\nexport const AutoFocusPlugin = mod.AutoFocusPlugin;","/**\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 { createContext, useContext } from 'react';\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\nconst entries = [['Cat', 'rgb(125, 50, 0)'], ['Dog', 'rgb(100, 0, 0)'], ['Rabbit', 'rgb(150, 0, 0)'], ['Frog', 'rgb(200, 0, 0)'], ['Fox', 'rgb(200, 75, 0)'], ['Hedgehog', 'rgb(0, 75, 0)'], ['Pigeon', 'rgb(0, 125, 0)'], ['Squirrel', 'rgb(75, 100, 0)'], ['Bear', 'rgb(125, 100, 0)'], ['Tiger', 'rgb(0, 0, 150)'], ['Leopard', 'rgb(0, 0, 200)'], ['Zebra', 'rgb(0, 0, 250)'], ['Wolf', 'rgb(0, 100, 150)'], ['Owl', 'rgb(0, 100, 100)'], ['Gull', 'rgb(100, 0, 100)'], ['Squid', 'rgb(150, 0, 150)']];\nconst randomEntry = entries[Math.floor(Math.random() * entries.length)];\nconst CollaborationContext = /*#__PURE__*/createContext({\n clientID: 0,\n color: randomEntry[1],\n isCollabActive: false,\n name: randomEntry[0],\n yjsDocMap: new Map()\n});\nfunction useCollaborationContext(username, color) {\n const collabContext = useContext(CollaborationContext);\n if (username != null) {\n collabContext.name = username;\n }\n if (color != null) {\n collabContext.color = color;\n }\n return collabContext;\n}\n\nexport { CollaborationContext, useCollaborationContext };\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{createContext as r,useContext as g}from\"react\";const o=[[\"Cat\",\"rgb(125, 50, 0)\"],[\"Dog\",\"rgb(100, 0, 0)\"],[\"Rabbit\",\"rgb(150, 0, 0)\"],[\"Frog\",\"rgb(200, 0, 0)\"],[\"Fox\",\"rgb(200, 75, 0)\"],[\"Hedgehog\",\"rgb(0, 75, 0)\"],[\"Pigeon\",\"rgb(0, 125, 0)\"],[\"Squirrel\",\"rgb(75, 100, 0)\"],[\"Bear\",\"rgb(125, 100, 0)\"],[\"Tiger\",\"rgb(0, 0, 150)\"],[\"Leopard\",\"rgb(0, 0, 200)\"],[\"Zebra\",\"rgb(0, 0, 250)\"],[\"Wolf\",\"rgb(0, 100, 150)\"],[\"Owl\",\"rgb(0, 100, 100)\"],[\"Gull\",\"rgb(100, 0, 100)\"],[\"Squid\",\"rgb(150, 0, 150)\"]],b=o[Math.floor(Math.random()*o.length)],e=r({clientID:0,color:b[1],isCollabActive:!1,name:b[0],yjsDocMap:new Map});function l(r,o){const b=g(e);return null!=r&&(b.name=r),null!=o&&(b.color=o),b}export{e as CollaborationContext,l as useCollaborationContext};\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 * as modDev from './LexicalCollaborationContext.dev.mjs';\nimport * as modProd from './LexicalCollaborationContext.prod.mjs';\nconst mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;\nexport const CollaborationContext = mod.CollaborationContext;\nexport const useCollaborationContext = mod.useCollaborationContext;","/**\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 { useCollaborationContext } from '@lexical/react/LexicalCollaborationContext';\nimport { LexicalComposerContext, createLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { useRef, useContext, useMemo, useEffect } from 'react';\nimport { jsx } from 'react/jsx-runtime';\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\nfunction getTransformSetFromKlass(klass) {\n const transform = klass.transform();\n return transform !== null ? new Set([transform]) : new Set();\n}\nfunction LexicalNestedComposer({\n initialEditor,\n children,\n initialNodes,\n initialTheme,\n skipCollabChecks\n}) {\n const wasCollabPreviouslyReadyRef = useRef(false);\n const parentContext = useContext(LexicalComposerContext);\n if (parentContext == null) {\n {\n throw Error(`Unexpected parent context null on a nested composer`);\n }\n }\n const [parentEditor, {\n getTheme: getParentTheme\n }] = parentContext;\n const composerContext = useMemo(() => {\n const composerTheme = initialTheme || getParentTheme() || undefined;\n const context = createLexicalComposerContext(parentContext, composerTheme);\n if (composerTheme !== undefined) {\n initialEditor._config.theme = composerTheme;\n }\n initialEditor._parentEditor = parentEditor;\n if (!initialNodes) {\n const parentNodes = initialEditor._nodes = new Map(parentEditor._nodes);\n for (const [type, entry] of parentNodes) {\n initialEditor._nodes.set(type, {\n exportDOM: entry.exportDOM,\n klass: entry.klass,\n replace: entry.replace,\n replaceWithKlass: entry.replaceWithKlass,\n transforms: getTransformSetFromKlass(entry.klass)\n });\n }\n } else {\n for (let klass of initialNodes) {\n let replace = null;\n let replaceWithKlass = null;\n if (typeof klass !== 'function') {\n const options = klass;\n klass = options.replace;\n replace = options.with;\n replaceWithKlass = options.withKlass || null;\n }\n const registeredKlass = initialEditor._nodes.get(klass.getType());\n initialEditor._nodes.set(klass.getType(), {\n exportDOM: registeredKlass ? registeredKlass.exportDOM : undefined,\n klass,\n replace,\n replaceWithKlass,\n transforms: getTransformSetFromKlass(klass)\n });\n }\n }\n initialEditor._config.namespace = parentEditor._config.namespace;\n initialEditor._editable = parentEditor._editable;\n return [initialEditor, context];\n },\n // We only do this for init\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n\n // If collaboration is enabled, make sure we don't render the children until the collaboration subdocument is ready.\n const {\n isCollabActive,\n yjsDocMap\n } = useCollaborationContext();\n const isCollabReady = skipCollabChecks || wasCollabPreviouslyReadyRef.current || yjsDocMap.has(initialEditor.getKey());\n useEffect(() => {\n if (isCollabReady) {\n wasCollabPreviouslyReadyRef.current = true;\n }\n }, [isCollabReady]);\n\n // Update `isEditable` state of nested editor in response to the same change on parent editor.\n useEffect(() => {\n return parentEditor.registerEditableListener(editable => {\n initialEditor.setEditable(editable);\n });\n }, [initialEditor, parentEditor]);\n return /*#__PURE__*/jsx(LexicalComposerContext.Provider, {\n value: composerContext,\n children: !isCollabActive || isCollabReady ? children : null\n });\n}\n\nexport { LexicalNestedComposer };\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{useCollaborationContext as e}from\"@lexical/react/LexicalCollaborationContext\";import{LexicalComposerContext as t,createLexicalComposerContext as r}from\"@lexical/react/LexicalComposerContext\";import{useRef as o,useContext as n,useMemo as l,useEffect as i}from\"react\";import{jsx as a}from\"react/jsx-runtime\";function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,\"default\")?e.default:e}var c=s((function(e){const t=new URLSearchParams;t.append(\"code\",e);for(let e=1;e<arguments.length;e++)t.append(\"v\",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));function p(e){const t=e.transform();return null!==t?new Set([t]):new Set}function d({initialEditor:s,children:d,initialNodes:f,initialTheme:u,skipCollabChecks:m}){const h=o(!1),x=n(t);null==x&&c(9);const[_,{getTheme:g}]=x,v=l((()=>{const e=u||g()||void 0,t=r(x,e);if(void 0!==e&&(s._config.theme=e),s._parentEditor=_,f)for(let e of f){let t=null,r=null;if(\"function\"!=typeof e){const o=e;e=o.replace,t=o.with,r=o.withKlass||null}const o=s._nodes.get(e.getType());s._nodes.set(e.getType(),{exportDOM:o?o.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:r,transforms:p(e)})}else{const e=s._nodes=new Map(_._nodes);for(const[t,r]of e)s._nodes.set(t,{exportDOM:r.exportDOM,klass:r.klass,replace:r.replace,replaceWithKlass:r.replaceWithKlass,transforms:p(r.klass)})}return s._config.namespace=_._config.namespace,s._editable=_._editable,[s,t]}),[]),{isCollabActive:w,yjsDocMap:b}=e(),M=m||h.current||b.has(s.getKey());return i((()=>{M&&(h.current=!0)}),[M]),i((()=>_.registerEditableListener((e=>{s.setEditable(e)}))),[s,_]),a(t.Provider,{value:v,children:!w||M?d:null})}export{d as LexicalNestedComposer};\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 * as modDev from './LexicalNestedComposer.dev.mjs';\nimport * as modProd from './LexicalNestedComposer.prod.mjs';\nconst mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;\nexport const LexicalNestedComposer = mod.LexicalNestedComposer;","/**\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 */\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 const maxWidthContainer = maxWidth\n ? maxWidth\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","/**\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 { 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 * as React from \"react\";\nimport { Suspense, useCallback, useEffect, useRef, useState } from \"react\";\n// import brokenImage from '../images/image-broken.svg';\nimport { initialConfig } from \"src/constants\";\nimport { $isImageNode } from \"src/nodes/ImageNode\";\nimport LocalStoragePlugin from \"src/plugins/LocalStoragePlugin\";\n\nimport ImageResizer from \"./ImageResizer\";\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 return (\n <img\n className={className || undefined}\n src={src}\n alt={altText}\n ref={imageRef}\n style={{\n height,\n maxWidth,\n width,\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}: {\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}): 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\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 alert(\"s\");\n // TODO This is just a 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 draggable = isSelected && $isNodeSelection(selection) && !isResizing;\n const isFocused = (isSelected || isResizing) && isEditable;\n return (\n <Suspense fallback={null}>\n <>\n <div draggable={draggable}>\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 </div>\n\n {showCaption && (\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>Enter a caption...</span>}\n className=\"ImageNode__contentEditable\"\n />\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n\n <OnChangePlugin onChange={(e) => console.log(\"e\")} />\n <HistoryPlugin />\n <LocalStoragePlugin namespace={initialConfig.namespace} />\n </LexicalNestedComposer>\n </div>\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 </Suspense>\n );\n}\n"],"names":["AutoFocusPlugin","defaultSelection","editor","useLexicalComposerContext","useEffect","activeElement","rootElement","o","l","e","t","mod","modDev","modProd","entries","randomEntry","CollaborationContext","createContext","useCollaborationContext","username","color","collabContext","useContext","b","r","g","getTransformSetFromKlass","klass","transform","LexicalNestedComposer","initialEditor","children","initialNodes","initialTheme","skipCollabChecks","wasCollabPreviouslyReadyRef","useRef","parentContext","LexicalComposerContext","parentEditor","getParentTheme","composerContext","useMemo","composerTheme","context","createLexicalComposerContext","replace","replaceWithKlass","options","registeredKlass","parentNodes","type","entry","isCollabActive","yjsDocMap","isCollabReady","editable","jsx","s","c","p","d","f","u","m","h","x","n","_","v","w","M","i","a","clamp","value","min","max","Direction","ImageResizer","onResizeStart","onResizeEnd","buttonRef","imageRef","maxWidth","showCaption","setShowCaption","captionsEnabled","controlWrapperRef","userSelect","positioningRef","editorRootElement","maxWidthContainer","maxHeightContainer","minWidth","minHeight","setStartCursor","direction","ew","ns","nwse","cursorDir","setEndCursor","handlePointerDown","event","image","controlWrapper","width","height","zoom","calculateZoomLevel","positioning","handlePointerMove","handlePointerUp","isHorizontal","isVertical","diff","jsxs","imageCache","RIGHT_CLICK_IMAGE_COMMAND","createCommand","useSuspenseImage","src","resolve","img","LazyImage","altText","className","onError","BrokenImage","ImageComponent","nodeKey","resizable","caption","isSelected","setSelected","clearSelection","useLexicalNodeSelection","isResizing","setIsResizing","useState","selection","setSelection","activeEditorRef","isLoadError","setIsLoadError","isEditable","useLexicalEditable","$onDelete","useCallback","payload","deleteSelection","$getSelection","$isNodeSelection","node","$isImageNode","$onEnter","latestSelection","buttonElem","$setSelection","$onEscape","parentRootElement","onClick","onRightClick","$isRangeSelection","isMounted","unregister","mergeRegister","editorState","SELECTION_CHANGE_COMMAND","activeEditor","COMMAND_PRIORITY_LOW","CLICK_COMMAND","DRAGSTART_COMMAND","KEY_DELETE_COMMAND","KEY_BACKSPACE_COMMAND","KEY_ENTER_COMMAND","KEY_ESCAPE_COMMAND","$getNodeByKey","nextWidth","nextHeight","draggable","isFocused","Suspense","Fragment","RootNode","TextNode","LineBreakNode","ParagraphNode","LinkNode","CodeNode","RichTextPlugin","ContentEditable","LexicalErrorBoundary","OnChangePlugin","HistoryPlugin","LocalStoragePlugin","initialConfig"],"mappings":";;;;;;;;;;;;;AAmBA,SAASA,GAAgB;AAAA,EACvB,kBAAAC;AACF,GAAG;AACD,QAAM,CAACC,CAAM,IAAIC;AACjB,SAAAC,EAAU,MAAM;AACd,IAAAF,EAAO,MAAM,MAAM;AAKjB,YAAMG,IAAgB,SAAS,eACzBC,IAAcJ,EAAO;AAC3B,MAAII,MAAgB,SAASD,MAAkB,QAAQ,CAACC,EAAY,SAASD,CAAa,MAExFC,EAAY,MAAM;AAAA,QAChB,eAAe;AAAA,MACzB,CAAS;AAAA,IAET,GAAO;AAAA,MACD,kBAAAL;AAAA,IACN,CAAK;AAAA,EACL,GAAK,CAACA,GAAkBC,CAAM,CAAC,GACtB;AACT;;;;;AClCoH,SAASK,GAAE,EAAC,kBAAiBA,EAAC,GAAE;AAAC,QAAK,CAACC,CAAC,IAAEC,EAAG;AAAC,SAAOC,EAAG,MAAI;AAAC,IAAAF,EAAE,MAAO,MAAI;AAAC,YAAMC,IAAE,SAAS,eAAcC,IAAEF,EAAE,eAAgB;AAAC,MAAOE,MAAP,QAAiBD,MAAP,QAAUC,EAAE,SAASD,CAAC,KAAGC,EAAE,MAAM,EAAC,eAAc,GAAE,CAAC;AAAA,IAAC,GAAG,EAAC,kBAAiBH,EAAC,CAAC;AAAA,EAAC,GAAG,CAACA,GAAEC,CAAC,CAAC,GAAE;AAAI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,EAAA;AAAA,YAACsI;AAAA,YAAA;AAAA,cACC,iBACEtI,gBAAAA,EAAA;AAAA,gBAACuI;AAAA,gBAAA;AAAA,kBACC,oBAAiB;AAAA,kBACjB,aAAa,MAAOvI,gBAAAA,EAAAA,IAAA,QAAA,EAAK,UAAkB,qBAAA,CAAA;AAAA,kBAC3C,WAAU;AAAA,gBAAA;AAAA,cACZ;AAAA,cAEF,eAAewI;AAAA,YAAA;AAAA,UACjB;AAAA,UAEAxI,gBAAAA,MAACyI,MAAe,UAAU,CAACzL,MAAM,QAAQ,IAAI,GAAG,GAAG;AAAA,gCAClD0L,IAAc,EAAA;AAAA,UACd1I,gBAAAA,EAAAA,IAAA2I,IAAA,EAAmB,WAAWC,GAAc,UAAW,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAE5D;AAAA,IAEDjE,KAAaqB,EAAiBZ,CAAS,KAAKyC,KAC3C7H,gBAAAA,EAAA;AAAA,MAACsB;AAAA,MAAA;AAAA,QACC,aAAAM;AAAA,QACA,gBAAAC;AAAA,QACA,QAAApF;AAAA,QACA,WAAAgF;AAAA,QACA,UAAAC;AAAA,QACA,UAAAC;AAAA,QACA,eAAAJ;AAAA,QACA,aAAAC;AAAA,QACA,iBAAiB,CAAC+D,KAAezD;AAAA,MAAA;AAAA,IACnC;AAAA,EAAA,EAEJ,CAAA,EACF,CAAA;AAEJ;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8]}
1
+ {"version":3,"file":"index-7bdb5524.js","sources":["../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalAutoFocusPlugin.dev.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalAutoFocusPlugin.prod.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalAutoFocusPlugin.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalCollaborationContext.dev.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalCollaborationContext.prod.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalCollaborationContext.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalNestedComposer.dev.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalNestedComposer.prod.mjs","../../../node_modules/.pnpm/@lexical+react@0.24.0_react-dom@18.3.1_react@18.3.1__react@18.3.1_yjs@13.6.24/node_modules/@lexical/react/LexicalNestedComposer.mjs","../src/components/ImageView/ImageResizer.tsx","../src/components/ImageView/index.tsx"],"sourcesContent":["/**\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 { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { useEffect } from 'react';\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\nfunction AutoFocusPlugin({\n defaultSelection\n}) {\n const [editor] = useLexicalComposerContext();\n useEffect(() => {\n editor.focus(() => {\n // If we try and move selection to the same point with setBaseAndExtent, it won't\n // trigger a re-focus on the element. So in the case this occurs, we'll need to correct it.\n // Normally this is fine, Selection API !== Focus API, but fore the intents of the naming\n // of this plugin, which should preserve focus too.\n const activeElement = document.activeElement;\n const rootElement = editor.getRootElement();\n if (rootElement !== null && (activeElement === null || !rootElement.contains(activeElement))) {\n // Note: preventScroll won't work in Webkit.\n rootElement.focus({\n preventScroll: true\n });\n }\n }, {\n defaultSelection\n });\n }, [defaultSelection, editor]);\n return null;\n}\n\nexport { AutoFocusPlugin };\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{useLexicalComposerContext as e}from\"@lexical/react/LexicalComposerContext\";import{useEffect as t}from\"react\";function o({defaultSelection:o}){const[l]=e();return t((()=>{l.focus((()=>{const e=document.activeElement,t=l.getRootElement();null===t||null!==e&&t.contains(e)||t.focus({preventScroll:!0})}),{defaultSelection:o})}),[o,l]),null}export{o as AutoFocusPlugin};\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 * as modDev from './LexicalAutoFocusPlugin.dev.mjs';\nimport * as modProd from './LexicalAutoFocusPlugin.prod.mjs';\nconst mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;\nexport const AutoFocusPlugin = mod.AutoFocusPlugin;","/**\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 { createContext, useContext } from 'react';\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\nconst entries = [['Cat', 'rgb(125, 50, 0)'], ['Dog', 'rgb(100, 0, 0)'], ['Rabbit', 'rgb(150, 0, 0)'], ['Frog', 'rgb(200, 0, 0)'], ['Fox', 'rgb(200, 75, 0)'], ['Hedgehog', 'rgb(0, 75, 0)'], ['Pigeon', 'rgb(0, 125, 0)'], ['Squirrel', 'rgb(75, 100, 0)'], ['Bear', 'rgb(125, 100, 0)'], ['Tiger', 'rgb(0, 0, 150)'], ['Leopard', 'rgb(0, 0, 200)'], ['Zebra', 'rgb(0, 0, 250)'], ['Wolf', 'rgb(0, 100, 150)'], ['Owl', 'rgb(0, 100, 100)'], ['Gull', 'rgb(100, 0, 100)'], ['Squid', 'rgb(150, 0, 150)']];\nconst randomEntry = entries[Math.floor(Math.random() * entries.length)];\nconst CollaborationContext = /*#__PURE__*/createContext({\n clientID: 0,\n color: randomEntry[1],\n isCollabActive: false,\n name: randomEntry[0],\n yjsDocMap: new Map()\n});\nfunction useCollaborationContext(username, color) {\n const collabContext = useContext(CollaborationContext);\n if (username != null) {\n collabContext.name = username;\n }\n if (color != null) {\n collabContext.color = color;\n }\n return collabContext;\n}\n\nexport { CollaborationContext, useCollaborationContext };\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{createContext as r,useContext as g}from\"react\";const o=[[\"Cat\",\"rgb(125, 50, 0)\"],[\"Dog\",\"rgb(100, 0, 0)\"],[\"Rabbit\",\"rgb(150, 0, 0)\"],[\"Frog\",\"rgb(200, 0, 0)\"],[\"Fox\",\"rgb(200, 75, 0)\"],[\"Hedgehog\",\"rgb(0, 75, 0)\"],[\"Pigeon\",\"rgb(0, 125, 0)\"],[\"Squirrel\",\"rgb(75, 100, 0)\"],[\"Bear\",\"rgb(125, 100, 0)\"],[\"Tiger\",\"rgb(0, 0, 150)\"],[\"Leopard\",\"rgb(0, 0, 200)\"],[\"Zebra\",\"rgb(0, 0, 250)\"],[\"Wolf\",\"rgb(0, 100, 150)\"],[\"Owl\",\"rgb(0, 100, 100)\"],[\"Gull\",\"rgb(100, 0, 100)\"],[\"Squid\",\"rgb(150, 0, 150)\"]],b=o[Math.floor(Math.random()*o.length)],e=r({clientID:0,color:b[1],isCollabActive:!1,name:b[0],yjsDocMap:new Map});function l(r,o){const b=g(e);return null!=r&&(b.name=r),null!=o&&(b.color=o),b}export{e as CollaborationContext,l as useCollaborationContext};\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 * as modDev from './LexicalCollaborationContext.dev.mjs';\nimport * as modProd from './LexicalCollaborationContext.prod.mjs';\nconst mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;\nexport const CollaborationContext = mod.CollaborationContext;\nexport const useCollaborationContext = mod.useCollaborationContext;","/**\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 { useCollaborationContext } from '@lexical/react/LexicalCollaborationContext';\nimport { LexicalComposerContext, createLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { useRef, useContext, useMemo, useEffect } from 'react';\nimport { jsx } from 'react/jsx-runtime';\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\nfunction getTransformSetFromKlass(klass) {\n const transform = klass.transform();\n return transform !== null ? new Set([transform]) : new Set();\n}\nfunction LexicalNestedComposer({\n initialEditor,\n children,\n initialNodes,\n initialTheme,\n skipCollabChecks\n}) {\n const wasCollabPreviouslyReadyRef = useRef(false);\n const parentContext = useContext(LexicalComposerContext);\n if (parentContext == null) {\n {\n throw Error(`Unexpected parent context null on a nested composer`);\n }\n }\n const [parentEditor, {\n getTheme: getParentTheme\n }] = parentContext;\n const composerContext = useMemo(() => {\n const composerTheme = initialTheme || getParentTheme() || undefined;\n const context = createLexicalComposerContext(parentContext, composerTheme);\n if (composerTheme !== undefined) {\n initialEditor._config.theme = composerTheme;\n }\n initialEditor._parentEditor = parentEditor;\n if (!initialNodes) {\n const parentNodes = initialEditor._nodes = new Map(parentEditor._nodes);\n for (const [type, entry] of parentNodes) {\n initialEditor._nodes.set(type, {\n exportDOM: entry.exportDOM,\n klass: entry.klass,\n replace: entry.replace,\n replaceWithKlass: entry.replaceWithKlass,\n transforms: getTransformSetFromKlass(entry.klass)\n });\n }\n } else {\n for (let klass of initialNodes) {\n let replace = null;\n let replaceWithKlass = null;\n if (typeof klass !== 'function') {\n const options = klass;\n klass = options.replace;\n replace = options.with;\n replaceWithKlass = options.withKlass || null;\n }\n const registeredKlass = initialEditor._nodes.get(klass.getType());\n initialEditor._nodes.set(klass.getType(), {\n exportDOM: registeredKlass ? registeredKlass.exportDOM : undefined,\n klass,\n replace,\n replaceWithKlass,\n transforms: getTransformSetFromKlass(klass)\n });\n }\n }\n initialEditor._config.namespace = parentEditor._config.namespace;\n initialEditor._editable = parentEditor._editable;\n return [initialEditor, context];\n },\n // We only do this for init\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n\n // If collaboration is enabled, make sure we don't render the children until the collaboration subdocument is ready.\n const {\n isCollabActive,\n yjsDocMap\n } = useCollaborationContext();\n const isCollabReady = skipCollabChecks || wasCollabPreviouslyReadyRef.current || yjsDocMap.has(initialEditor.getKey());\n useEffect(() => {\n if (isCollabReady) {\n wasCollabPreviouslyReadyRef.current = true;\n }\n }, [isCollabReady]);\n\n // Update `isEditable` state of nested editor in response to the same change on parent editor.\n useEffect(() => {\n return parentEditor.registerEditableListener(editable => {\n initialEditor.setEditable(editable);\n });\n }, [initialEditor, parentEditor]);\n return /*#__PURE__*/jsx(LexicalComposerContext.Provider, {\n value: composerContext,\n children: !isCollabActive || isCollabReady ? children : null\n });\n}\n\nexport { LexicalNestedComposer };\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{useCollaborationContext as e}from\"@lexical/react/LexicalCollaborationContext\";import{LexicalComposerContext as t,createLexicalComposerContext as r}from\"@lexical/react/LexicalComposerContext\";import{useRef as o,useContext as n,useMemo as l,useEffect as i}from\"react\";import{jsx as a}from\"react/jsx-runtime\";function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,\"default\")?e.default:e}var c=s((function(e){const t=new URLSearchParams;t.append(\"code\",e);for(let e=1;e<arguments.length;e++)t.append(\"v\",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));function p(e){const t=e.transform();return null!==t?new Set([t]):new Set}function d({initialEditor:s,children:d,initialNodes:f,initialTheme:u,skipCollabChecks:m}){const h=o(!1),x=n(t);null==x&&c(9);const[_,{getTheme:g}]=x,v=l((()=>{const e=u||g()||void 0,t=r(x,e);if(void 0!==e&&(s._config.theme=e),s._parentEditor=_,f)for(let e of f){let t=null,r=null;if(\"function\"!=typeof e){const o=e;e=o.replace,t=o.with,r=o.withKlass||null}const o=s._nodes.get(e.getType());s._nodes.set(e.getType(),{exportDOM:o?o.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:r,transforms:p(e)})}else{const e=s._nodes=new Map(_._nodes);for(const[t,r]of e)s._nodes.set(t,{exportDOM:r.exportDOM,klass:r.klass,replace:r.replace,replaceWithKlass:r.replaceWithKlass,transforms:p(r.klass)})}return s._config.namespace=_._config.namespace,s._editable=_._editable,[s,t]}),[]),{isCollabActive:w,yjsDocMap:b}=e(),M=m||h.current||b.has(s.getKey());return i((()=>{M&&(h.current=!0)}),[M]),i((()=>_.registerEditableListener((e=>{s.setEditable(e)}))),[s,_]),a(t.Provider,{value:v,children:!w||M?d:null})}export{d as LexicalNestedComposer};\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 * as modDev from './LexicalNestedComposer.dev.mjs';\nimport * as modProd from './LexicalNestedComposer.prod.mjs';\nconst mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;\nexport const LexicalNestedComposer = mod.LexicalNestedComposer;","/**\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 */\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 const maxWidthContainer = maxWidth\n ? maxWidth\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","/**\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 { 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 * as React from \"react\";\nimport { Suspense, useCallback, useEffect, useRef, useState } from \"react\";\n// import brokenImage from '../images/image-broken.svg';\nimport { initialConfig } from \"src/constants\";\nimport { $isImageNode } from \"src/nodes/ImageNode\";\nimport LocalStoragePlugin from \"src/plugins/LocalStoragePlugin\";\n\nimport ImageResizer from \"./ImageResizer\";\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 return (\n <img\n className={className || undefined}\n src={src}\n alt={altText}\n ref={imageRef}\n style={{\n height,\n maxWidth,\n width,\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}: {\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}): 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\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 alert(\"s\");\n // TODO This is just a 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 draggable = isSelected && $isNodeSelection(selection) && !isResizing;\n const isFocused = (isSelected || isResizing) && isEditable;\n return (\n <Suspense fallback={null}>\n <>\n <div draggable={draggable}>\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 </div>\n\n {showCaption && (\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>Enter a caption...</span>}\n className=\"ImageNode__contentEditable\"\n />\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n\n <OnChangePlugin onChange={(e) => console.log(\"e\")} />\n <HistoryPlugin />\n <LocalStoragePlugin namespace={initialConfig.namespace} />\n </LexicalNestedComposer>\n </div>\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 </Suspense>\n );\n}\n"],"names":["AutoFocusPlugin","defaultSelection","editor","useLexicalComposerContext","useEffect","activeElement","rootElement","o","l","e","t","mod","modDev","modProd","entries","randomEntry","CollaborationContext","createContext","useCollaborationContext","username","color","collabContext","useContext","b","r","g","getTransformSetFromKlass","klass","transform","LexicalNestedComposer","initialEditor","children","initialNodes","initialTheme","skipCollabChecks","wasCollabPreviouslyReadyRef","useRef","parentContext","LexicalComposerContext","parentEditor","getParentTheme","composerContext","useMemo","composerTheme","context","createLexicalComposerContext","replace","replaceWithKlass","options","registeredKlass","parentNodes","type","entry","isCollabActive","yjsDocMap","isCollabReady","editable","jsx","s","c","p","d","f","u","m","h","x","n","_","v","w","M","i","a","clamp","value","min","max","Direction","ImageResizer","onResizeStart","onResizeEnd","buttonRef","imageRef","maxWidth","showCaption","setShowCaption","captionsEnabled","controlWrapperRef","userSelect","positioningRef","editorRootElement","maxWidthContainer","maxHeightContainer","minWidth","minHeight","setStartCursor","direction","ew","ns","nwse","cursorDir","setEndCursor","handlePointerDown","event","image","controlWrapper","width","height","zoom","calculateZoomLevel","positioning","handlePointerMove","handlePointerUp","isHorizontal","isVertical","diff","jsxs","imageCache","RIGHT_CLICK_IMAGE_COMMAND","createCommand","useSuspenseImage","src","resolve","img","LazyImage","altText","className","onError","BrokenImage","ImageComponent","nodeKey","resizable","caption","isSelected","setSelected","clearSelection","useLexicalNodeSelection","isResizing","setIsResizing","useState","selection","setSelection","activeEditorRef","isLoadError","setIsLoadError","isEditable","useLexicalEditable","$onDelete","useCallback","payload","deleteSelection","$getSelection","$isNodeSelection","node","$isImageNode","$onEnter","latestSelection","buttonElem","$setSelection","$onEscape","parentRootElement","onClick","onRightClick","$isRangeSelection","isMounted","unregister","mergeRegister","editorState","SELECTION_CHANGE_COMMAND","activeEditor","COMMAND_PRIORITY_LOW","CLICK_COMMAND","DRAGSTART_COMMAND","KEY_DELETE_COMMAND","KEY_BACKSPACE_COMMAND","KEY_ENTER_COMMAND","KEY_ESCAPE_COMMAND","$getNodeByKey","nextWidth","nextHeight","draggable","isFocused","Suspense","Fragment","RootNode","TextNode","LineBreakNode","ParagraphNode","LinkNode","CodeNode","RichTextPlugin","ContentEditable","LexicalErrorBoundary","OnChangePlugin","HistoryPlugin","LocalStoragePlugin","initialConfig"],"mappings":";;;;;;;;;;;;;AAmBA,SAASA,GAAgB;AAAA,EACvB,kBAAAC;AAC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