@payloadcms/richtext-lexical 3.55.0-internal.f8c92b5 → 3.56.0-internal.299316b
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/exports/client/Field-SOED2PIU.js +2 -0
- package/dist/exports/client/{Field-Q3PTZQ75.js.map → Field-SOED2PIU.js.map} +3 -3
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-FSKAVN4P.js +2 -0
- package/dist/exports/client/{chunk-CYLMY5ZJ.js.map → chunk-FSKAVN4P.js.map} +2 -2
- package/dist/exports/client/chunk-KZKGNMS3.js +12 -0
- package/dist/exports/client/{chunk-YCH4JNUH.js.map → chunk-KZKGNMS3.js.map} +2 -2
- package/dist/exports/client/{component-3PENNOM3.js → component-M3U253XK.js} +2 -2
- package/dist/exports/client/index.d.ts +0 -2
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +10 -10
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/server/rsc.d.ts +0 -1
- package/dist/exports/server/rsc.d.ts.map +1 -1
- package/dist/exports/server/rsc.js +0 -1
- package/dist/exports/server/rsc.js.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +10 -8
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/upload.js +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +39 -124
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +8 -6
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +3 -3
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +37 -20
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +53 -28
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
- package/dist/features/textState/feature.client.js +3 -1
- package/dist/features/textState/feature.client.js.map +1 -1
- package/dist/features/textState/feature.server.d.ts.map +1 -1
- package/dist/features/textState/feature.server.js +3 -1
- package/dist/features/textState/feature.server.js.map +1 -1
- package/dist/features/textState/i18n.d.ts +3 -0
- package/dist/features/textState/i18n.d.ts.map +1 -0
- package/dist/features/textState/i18n.js +108 -0
- package/dist/features/textState/i18n.js.map +1 -0
- package/dist/features/toolbars/shared/ToolbarButton/index.js +37 -35
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +30 -20
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.js +35 -22
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +15 -7
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +15 -7
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +141 -75
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +3 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +11 -2
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.js.map +1 -0
- package/dist/nodeTypes.d.ts +1 -13
- package/dist/nodeTypes.d.ts.map +1 -1
- package/dist/nodeTypes.js +1 -4
- package/dist/nodeTypes.js.map +1 -1
- package/package.json +27 -22
- package/dist/exports/client/Field-Q3PTZQ75.js +0 -2
- package/dist/exports/client/chunk-CYLMY5ZJ.js +0 -2
- package/dist/exports/client/chunk-YCH4JNUH.js +0 -12
- package/dist/field/RenderLexical/renderLexical.d.ts +0 -38
- package/dist/field/RenderLexical/renderLexical.d.ts.map +0 -1
- package/dist/field/RenderLexical/renderLexical.js +0 -96
- package/dist/field/RenderLexical/renderLexical.js.map +0 -1
- package/dist/field/RenderLexical/useRenderEditor.d.ts +0 -15
- package/dist/field/RenderLexical/useRenderEditor.d.ts.map +0 -1
- package/dist/field/RenderLexical/useRenderEditor.js +0 -159
- package/dist/field/RenderLexical/useRenderEditor.js.map +0 -1
- package/dist/utilities/buildEditorState.d.ts +0 -11
- package/dist/utilities/buildEditorState.d.ts.map +0 -1
- package/dist/utilities/buildEditorState.js +0 -76
- package/dist/utilities/buildEditorState.js.map +0 -1
- /package/dist/exports/client/{component-3PENNOM3.js.map → component-M3U253XK.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useLexicalComposerContext","eventFiles","$getNearestNodeFromDOMNode","$getNodeByKey","isHTMLElement","React","useEffect","useRef","useState","createPortal","useEditorConfigContext","Point","calculateDistanceFromScrollerElem","getNodeCloseToPoint","getTopLevelNodeKeys","isOnHandleElement","setHandlePosition","getBoundingClientRectWithoutTransform","setTargetLine","DRAGGABLE_BLOCK_MENU_CLASSNAME","DRAG_DATA_FORMAT","prevIndex","Infinity","getCurrentIndex","keysLength","Math","floor","setDragImage","dataTransfer","draggableBlockElem","transform","style","setTimeout","hideTargetLine","targetLineElem","lastTargetBlockElem","opacity","marginBottom","marginTop","useDraggableBlockMenu","editor","anchorElem","isEditable","scrollerElem","parentElement","menuRef","targetLineRef","debugHighlightRef","isDraggingBlockRef","setDraggableBlockElem","lastTargetBlock","setLastTargetBlock","editorConfig","blockHandleHorizontalOffset","admin","hideGutter","onDocumentMouseMove","event","target","distanceFromScrollerElem","pageX","pageY","topLevelNodeKeys","blockElem","_draggableBlockElem","foundAtIndex","isFoundNodeEmptyParagraph","cache_threshold","horizontalOffset","point","x","y","startIndex","length","useEdgeAsDefault","verbose","document","addEventListener","removeEventListener","current","onDragover","isFileTransfer","targetBlockElem","fuzzy","isBelow","willStayInSamePosition","getBoundingClientRect","width","preventDefault","boundingBox","elem","onDrop","dragData","getData","update","draggedNode","targetNode","height","targetBlockElemHeight","top","targetBlockElemTop","mouseY","window","scrollY","insertAfter","insertBefore","remove","allPrevHighlighters","querySelectorAll","forEach","highlighter","newInsertedElem","getElementByKey","getKey","newInsertedElemRect","highlightElem","createElement","className","backgroundColor","transition","zIndex","pointerEvents","boxSizing","borderRadius","position","body","appendChild","left","onDragStart","nodeKey","node","setData","onDragEnd","_jsxs","Fragment","_jsx","draggable","ref","DraggableBlockPlugin","t0","t1","undefined","_editable"],"sources":["../../../../../src/lexical/plugins/handles/DraggableBlockPlugin/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\nimport type { DragEvent as ReactDragEvent } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { eventFiles } from '@lexical/rich-text'\nimport { $getNearestNodeFromDOMNode, $getNodeByKey, isHTMLElement } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js'\nimport { Point } from '../../../utils/point.js'\nimport { calculateDistanceFromScrollerElem } from '../utils/calculateDistanceFromScrollerElem.js'\nimport { getNodeCloseToPoint } from '../utils/getNodeCloseToPoint.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\nimport { isOnHandleElement } from '../utils/isOnHandleElement.js'\nimport { setHandlePosition } from '../utils/setHandlePosition.js'\nimport { getBoundingClientRectWithoutTransform } from './getBoundingRectWithoutTransform.js'\nimport './index.scss'\nimport { setTargetLine } from './setTargetLine.js'\n\nconst DRAGGABLE_BLOCK_MENU_CLASSNAME = 'draggable-block-menu'\nconst DRAG_DATA_FORMAT = 'application/x-lexical-drag-block'\n\nlet prevIndex = Infinity\n\nfunction getCurrentIndex(keysLength: number): number {\n if (keysLength === 0) {\n return Infinity\n }\n if (prevIndex >= 0 && prevIndex < keysLength) {\n return prevIndex\n }\n\n return Math.floor(keysLength / 2)\n}\n\nfunction setDragImage(dataTransfer: DataTransfer, draggableBlockElem: HTMLElement) {\n const { transform } = draggableBlockElem.style\n\n // Remove dragImage borders\n dataTransfer.setDragImage(draggableBlockElem, 0, 0)\n\n setTimeout(() => {\n draggableBlockElem.style.transform = transform\n })\n}\n\nfunction hideTargetLine(\n targetLineElem: HTMLElement | null,\n lastTargetBlockElem: HTMLElement | null,\n) {\n if (targetLineElem) {\n targetLineElem.style.opacity = '0'\n }\n if (lastTargetBlockElem) {\n lastTargetBlockElem.style.opacity = ''\n // Delete marginBottom and marginTop values we set\n lastTargetBlockElem.style.marginBottom = ''\n lastTargetBlockElem.style.marginTop = ''\n //lastTargetBlock.style.border = 'none'\n }\n}\n\nfunction useDraggableBlockMenu(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n isEditable: boolean,\n): React.ReactElement {\n const scrollerElem = anchorElem.parentElement\n\n const menuRef = useRef<HTMLDivElement>(null)\n const targetLineRef = useRef<HTMLDivElement>(null)\n const debugHighlightRef = useRef<HTMLDivElement>(null)\n const isDraggingBlockRef = useRef<boolean>(false)\n const [draggableBlockElem, setDraggableBlockElem] = useState<HTMLElement | null>(null)\n const [lastTargetBlock, setLastTargetBlock] = useState<{\n boundingBox?: DOMRect\n elem: HTMLElement | null\n isBelow: boolean\n } | null>(null)\n\n const { editorConfig } = useEditorConfigContext()\n\n const blockHandleHorizontalOffset = editorConfig?.admin?.hideGutter ? -44 : -8\n\n useEffect(() => {\n /**\n * Handles positioning of the drag handle\n */\n function onDocumentMouseMove(event: MouseEvent) {\n const target = event.target\n if (!isHTMLElement(target)) {\n return\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n )\n if (distanceFromScrollerElem === -1) {\n setDraggableBlockElem(null)\n return\n }\n\n if (isOnHandleElement(target, DRAGGABLE_BLOCK_MENU_CLASSNAME)) {\n return\n }\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: _draggableBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n cache_threshold: 0,\n editor,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: false,\n verbose: false,\n })\n\n prevIndex = foundAtIndex\n\n //if (DEBUG && _draggableBlockElem) {\n //targetBlockElem.style.border = '3px solid red'\n // highlightElemOriginalPosition(debugHighlightRef, _draggableBlockElem, anchorElem)\n //}\n\n if (!_draggableBlockElem && !isFoundNodeEmptyParagraph) {\n return\n }\n\n if (draggableBlockElem !== _draggableBlockElem) {\n setDraggableBlockElem(_draggableBlockElem)\n }\n }\n\n // Since the draggableBlockElem is outside the actual editor, we need to listen to the document\n // to be able to detect when the mouse is outside the editor and respect a buffer around\n // the scrollerElem to avoid the draggableBlockElem disappearing too early.\n document?.addEventListener('mousemove', onDocumentMouseMove)\n\n return () => {\n document?.removeEventListener('mousemove', onDocumentMouseMove)\n }\n }, [scrollerElem, anchorElem, editor, draggableBlockElem])\n\n useEffect(() => {\n if (menuRef.current) {\n setHandlePosition(\n draggableBlockElem,\n menuRef.current,\n anchorElem,\n blockHandleHorizontalOffset,\n )\n }\n }, [anchorElem, draggableBlockElem, blockHandleHorizontalOffset])\n\n useEffect(() => {\n function onDragover(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n\n const { pageY, target } = event\n if (!isHTMLElement(target)) {\n return false\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: targetBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: true,\n verbose: true,\n })\n\n prevIndex = foundAtIndex\n\n const targetLineElem = targetLineRef.current\n // targetBlockElem === null shouldn't happen\n if (targetBlockElem === null || targetLineElem === null) {\n return false\n }\n\n if (draggableBlockElem !== targetBlockElem) {\n const { isBelow, willStayInSamePosition } = setTargetLine(\n editorConfig?.admin?.hideGutter ? '0px' : '3rem',\n blockHandleHorizontalOffset +\n (editorConfig?.admin?.hideGutter\n ? (menuRef?.current?.getBoundingClientRect()?.width ?? 0)\n : -(menuRef?.current?.getBoundingClientRect()?.width ?? 0)),\n targetLineElem,\n targetBlockElem,\n lastTargetBlock!,\n pageY,\n anchorElem,\n event,\n debugHighlightRef,\n isFoundNodeEmptyParagraph,\n )\n\n // Prevent default event to be able to trigger onDrop events\n // Calling preventDefault() adds the green plus icon to the cursor,\n // indicating that the drop is allowed.\n event.preventDefault()\n\n if (!willStayInSamePosition) {\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow,\n })\n }\n } else if (lastTargetBlock?.elem) {\n hideTargetLine(targetLineElem, lastTargetBlock.elem)\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow: false,\n })\n }\n\n return true\n }\n\n function onDrop(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n const { dataTransfer, pageY, target } = event\n const dragData = dataTransfer?.getData(DRAG_DATA_FORMAT) || ''\n\n editor.update(() => {\n const draggedNode = $getNodeByKey(dragData)\n if (!draggedNode) {\n return false\n }\n if (!isHTMLElement(target)) {\n return false\n }\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const { blockElem: targetBlockElem, isFoundNodeEmptyParagraph } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n useEdgeAsDefault: true,\n })\n\n if (!targetBlockElem) {\n return false\n }\n const targetNode = $getNearestNodeFromDOMNode(targetBlockElem)\n if (!targetNode) {\n return false\n }\n if (targetNode === draggedNode) {\n return true\n }\n\n const { height: targetBlockElemHeight, top: targetBlockElemTop } =\n getBoundingClientRectWithoutTransform(targetBlockElem)\n\n const mouseY = pageY\n const isBelow = mouseY >= targetBlockElemTop + targetBlockElemHeight / 2 + window.scrollY\n\n if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n // below targetBlockElem\n targetNode.insertAfter(draggedNode)\n } else {\n // above targetBlockElem\n targetNode.insertBefore(draggedNode)\n }\n } else {\n //\n targetNode.insertBefore(draggedNode)\n targetNode.remove()\n }\n\n /*\n if (pageY >= targetBlockElemTop + targetBlockElemHeight / 2) {\n targetNode.insertAfter(draggedNode)\n } else {\n targetNode.insertBefore(draggedNode)\n }*/\n if (draggableBlockElem !== null) {\n setDraggableBlockElem(null)\n }\n\n // find all previous elements with lexical-block-highlighter class and remove them\n const allPrevHighlighters = document.querySelectorAll('.lexical-block-highlighter')\n allPrevHighlighters.forEach((highlighter) => {\n highlighter.remove()\n })\n\n const newInsertedElem = editor.getElementByKey(draggedNode.getKey())\n setTimeout(() => {\n // add new temp html element to newInsertedElem with the same height and width and the class block-selected\n // to highlight the new inserted element\n const newInsertedElemRect = newInsertedElem?.getBoundingClientRect()\n if (!newInsertedElemRect) {\n return\n }\n const highlightElem = document.createElement('div')\n highlightElem.className = 'lexical-block-highlighter'\n\n highlightElem.style.backgroundColor = 'var(--theme-elevation-1000'\n highlightElem.style.transition = 'opacity 0.5s ease-in-out'\n highlightElem.style.zIndex = '1'\n highlightElem.style.pointerEvents = 'none'\n highlightElem.style.boxSizing = 'border-box'\n highlightElem.style.borderRadius = '4px'\n highlightElem.style.position = 'absolute'\n document.body.appendChild(highlightElem)\n\n highlightElem.style.opacity = '0.1'\n\n highlightElem.style.height = `${newInsertedElemRect.height + 8}px`\n highlightElem.style.width = `${newInsertedElemRect.width + 8}px`\n highlightElem.style.top = `${newInsertedElemRect.top + window.scrollY - 4}px`\n highlightElem.style.left = `${newInsertedElemRect.left - 4}px`\n\n setTimeout(() => {\n highlightElem.style.opacity = '0'\n setTimeout(() => {\n highlightElem.remove()\n }, 500)\n }, 1000)\n }, 120)\n })\n\n return true\n }\n\n // register onDragover event listeners:\n document.addEventListener('dragover', onDragover)\n // register onDrop event listeners:\n document.addEventListener('drop', onDrop)\n\n return () => {\n document.removeEventListener('dragover', onDragover)\n document.removeEventListener('drop', onDrop)\n }\n }, [\n scrollerElem,\n blockHandleHorizontalOffset,\n anchorElem,\n editor,\n lastTargetBlock,\n draggableBlockElem,\n editorConfig?.admin?.hideGutter,\n ])\n\n function onDragStart(event: ReactDragEvent<HTMLDivElement>): void {\n const dataTransfer = event.dataTransfer\n if (!dataTransfer || !draggableBlockElem) {\n return\n }\n setDragImage(dataTransfer, draggableBlockElem)\n let nodeKey = ''\n editor.update(() => {\n const node = $getNearestNodeFromDOMNode(draggableBlockElem)\n if (node) {\n nodeKey = node.getKey()\n }\n })\n isDraggingBlockRef.current = true\n dataTransfer.setData(DRAG_DATA_FORMAT, nodeKey)\n }\n\n function onDragEnd(): void {\n isDraggingBlockRef.current = false\n if (lastTargetBlock?.elem) {\n hideTargetLine(targetLineRef.current, lastTargetBlock?.elem)\n }\n }\n\n return createPortal(\n <React.Fragment>\n <div\n className=\"icon draggable-block-menu\"\n draggable\n onDragEnd={onDragEnd}\n onDragStart={onDragStart}\n ref={menuRef}\n >\n <div className={isEditable ? 'icon' : ''} />\n </div>\n <div className=\"draggable-block-target-line\" ref={targetLineRef} />\n <div className=\"debug-highlight\" ref={debugHighlightRef} />\n </React.Fragment>,\n anchorElem,\n )\n}\n\nexport function DraggableBlockPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n return useDraggableBlockMenu(editor, anchorElem, editor._editable)\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,0BAA0B,EAAEC,aAAa,EAAEC,aAAa,QAAQ;AACzE,YAAYC,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAC5C,SAASC,YAAY,QAAQ;AAE7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,KAAK,QAAQ;AACtB,SAASC,iCAAiC,QAAQ;AAClD,SAASC,mBAAmB,QAAQ;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BC,MAAA,EAAQC,UAAA,EAAYD,MAAA,CAAAsG,SAAgB;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["useLexicalComposerContext","eventFiles","$getNearestNodeFromDOMNode","$getNodeByKey","isHTMLElement","React","useEffect","useRef","useState","createPortal","useEditorConfigContext","Point","calculateDistanceFromScrollerElem","getNodeCloseToPoint","getTopLevelNodeKeys","isOnHandleElement","setHandlePosition","getBoundingClientRectWithoutTransform","setTargetLine","DRAGGABLE_BLOCK_MENU_CLASSNAME","DRAG_DATA_FORMAT","prevIndex","Infinity","getCurrentIndex","keysLength","Math","floor","setDragImage","dataTransfer","draggableBlockElem","transform","style","setTimeout","hideTargetLine","targetLineElem","lastTargetBlockElem","opacity","marginBottom","marginTop","useDraggableBlockMenu","editor","anchorElem","isEditable","scrollerElem","parentElement","menuRef","targetLineRef","debugHighlightRef","isDraggingBlockRef","setDraggableBlockElem","lastTargetBlock","setLastTargetBlock","editorConfig","blockHandleHorizontalOffset","admin","hideGutter","onDocumentMouseMove","event","target","distanceFromScrollerElem","pageX","pageY","topLevelNodeKeys","blockElem","_draggableBlockElem","foundAtIndex","isFoundNodeEmptyParagraph","cache_threshold","horizontalOffset","point","x","y","startIndex","length","useEdgeAsDefault","verbose","document","addEventListener","removeEventListener","current","onDragover","isFileTransfer","targetBlockElem","fuzzy","isBelow","willStayInSamePosition","getBoundingClientRect","width","preventDefault","boundingBox","elem","onDrop","dragData","getData","update","draggedNode","targetNode","height","targetBlockElemHeight","top","targetBlockElemTop","mouseY","window","scrollY","insertAfter","insertBefore","remove","allPrevHighlighters","querySelectorAll","forEach","highlighter","newInsertedElem","getElementByKey","getKey","newInsertedElemRect","highlightElem","createElement","className","backgroundColor","transition","zIndex","pointerEvents","boxSizing","borderRadius","position","body","appendChild","left","onDragStart","nodeKey","node","setData","onDragEnd","_jsxs","Fragment","_jsx","draggable","ref","type","DraggableBlockPlugin","t0","t1","undefined","_editable"],"sources":["../../../../../src/lexical/plugins/handles/DraggableBlockPlugin/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\nimport type { DragEvent as ReactDragEvent } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { eventFiles } from '@lexical/rich-text'\nimport { $getNearestNodeFromDOMNode, $getNodeByKey, isHTMLElement } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js'\nimport { Point } from '../../../utils/point.js'\nimport { calculateDistanceFromScrollerElem } from '../utils/calculateDistanceFromScrollerElem.js'\nimport { getNodeCloseToPoint } from '../utils/getNodeCloseToPoint.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\nimport { isOnHandleElement } from '../utils/isOnHandleElement.js'\nimport { setHandlePosition } from '../utils/setHandlePosition.js'\nimport { getBoundingClientRectWithoutTransform } from './getBoundingRectWithoutTransform.js'\nimport './index.scss'\nimport { setTargetLine } from './setTargetLine.js'\n\nconst DRAGGABLE_BLOCK_MENU_CLASSNAME = 'draggable-block-menu'\nconst DRAG_DATA_FORMAT = 'application/x-lexical-drag-block'\n\nlet prevIndex = Infinity\n\nfunction getCurrentIndex(keysLength: number): number {\n if (keysLength === 0) {\n return Infinity\n }\n if (prevIndex >= 0 && prevIndex < keysLength) {\n return prevIndex\n }\n\n return Math.floor(keysLength / 2)\n}\n\nfunction setDragImage(dataTransfer: DataTransfer, draggableBlockElem: HTMLElement) {\n const { transform } = draggableBlockElem.style\n\n // Remove dragImage borders\n dataTransfer.setDragImage(draggableBlockElem, 0, 0)\n\n setTimeout(() => {\n draggableBlockElem.style.transform = transform\n })\n}\n\nfunction hideTargetLine(\n targetLineElem: HTMLElement | null,\n lastTargetBlockElem: HTMLElement | null,\n) {\n if (targetLineElem) {\n targetLineElem.style.opacity = '0'\n }\n if (lastTargetBlockElem) {\n lastTargetBlockElem.style.opacity = ''\n // Delete marginBottom and marginTop values we set\n lastTargetBlockElem.style.marginBottom = ''\n lastTargetBlockElem.style.marginTop = ''\n //lastTargetBlock.style.border = 'none'\n }\n}\n\nfunction useDraggableBlockMenu(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n isEditable: boolean,\n): React.ReactElement {\n const scrollerElem = anchorElem.parentElement\n\n const menuRef = useRef<HTMLButtonElement>(null)\n const targetLineRef = useRef<HTMLDivElement>(null)\n const debugHighlightRef = useRef<HTMLDivElement>(null)\n const isDraggingBlockRef = useRef<boolean>(false)\n const [draggableBlockElem, setDraggableBlockElem] = useState<HTMLElement | null>(null)\n const [lastTargetBlock, setLastTargetBlock] = useState<{\n boundingBox?: DOMRect\n elem: HTMLElement | null\n isBelow: boolean\n } | null>(null)\n\n const { editorConfig } = useEditorConfigContext()\n\n const blockHandleHorizontalOffset = editorConfig?.admin?.hideGutter ? -44 : -8\n\n useEffect(() => {\n /**\n * Handles positioning of the drag handle\n */\n function onDocumentMouseMove(event: MouseEvent) {\n const target = event.target\n if (!isHTMLElement(target)) {\n return\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n )\n if (distanceFromScrollerElem === -1) {\n setDraggableBlockElem(null)\n return\n }\n\n if (isOnHandleElement(target, DRAGGABLE_BLOCK_MENU_CLASSNAME)) {\n return\n }\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: _draggableBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n cache_threshold: 0,\n editor,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: false,\n verbose: false,\n })\n\n prevIndex = foundAtIndex\n\n //if (DEBUG && _draggableBlockElem) {\n //targetBlockElem.style.border = '3px solid red'\n // highlightElemOriginalPosition(debugHighlightRef, _draggableBlockElem, anchorElem)\n //}\n\n if (!_draggableBlockElem && !isFoundNodeEmptyParagraph) {\n return\n }\n\n if (draggableBlockElem !== _draggableBlockElem) {\n setDraggableBlockElem(_draggableBlockElem)\n }\n }\n\n // Since the draggableBlockElem is outside the actual editor, we need to listen to the document\n // to be able to detect when the mouse is outside the editor and respect a buffer around\n // the scrollerElem to avoid the draggableBlockElem disappearing too early.\n document?.addEventListener('mousemove', onDocumentMouseMove)\n\n return () => {\n document?.removeEventListener('mousemove', onDocumentMouseMove)\n }\n }, [scrollerElem, anchorElem, editor, draggableBlockElem])\n\n useEffect(() => {\n if (menuRef.current) {\n setHandlePosition(\n draggableBlockElem,\n menuRef.current,\n anchorElem,\n blockHandleHorizontalOffset,\n )\n }\n }, [anchorElem, draggableBlockElem, blockHandleHorizontalOffset])\n\n useEffect(() => {\n function onDragover(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n\n const { pageY, target } = event\n if (!isHTMLElement(target)) {\n return false\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: targetBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: true,\n verbose: true,\n })\n\n prevIndex = foundAtIndex\n\n const targetLineElem = targetLineRef.current\n // targetBlockElem === null shouldn't happen\n if (targetBlockElem === null || targetLineElem === null) {\n return false\n }\n\n if (draggableBlockElem !== targetBlockElem) {\n const { isBelow, willStayInSamePosition } = setTargetLine(\n editorConfig?.admin?.hideGutter ? '0px' : '3rem',\n blockHandleHorizontalOffset +\n (editorConfig?.admin?.hideGutter\n ? (menuRef?.current?.getBoundingClientRect()?.width ?? 0)\n : -(menuRef?.current?.getBoundingClientRect()?.width ?? 0)),\n targetLineElem,\n targetBlockElem,\n lastTargetBlock!,\n pageY,\n anchorElem,\n event,\n debugHighlightRef,\n isFoundNodeEmptyParagraph,\n )\n\n // Prevent default event to be able to trigger onDrop events\n // Calling preventDefault() adds the green plus icon to the cursor,\n // indicating that the drop is allowed.\n event.preventDefault()\n\n if (!willStayInSamePosition) {\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow,\n })\n }\n } else if (lastTargetBlock?.elem) {\n hideTargetLine(targetLineElem, lastTargetBlock.elem)\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow: false,\n })\n }\n\n return true\n }\n\n function onDrop(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n const { dataTransfer, pageY, target } = event\n const dragData = dataTransfer?.getData(DRAG_DATA_FORMAT) || ''\n\n editor.update(() => {\n const draggedNode = $getNodeByKey(dragData)\n if (!draggedNode) {\n return false\n }\n if (!isHTMLElement(target)) {\n return false\n }\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const { blockElem: targetBlockElem, isFoundNodeEmptyParagraph } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n useEdgeAsDefault: true,\n })\n\n if (!targetBlockElem) {\n return false\n }\n const targetNode = $getNearestNodeFromDOMNode(targetBlockElem)\n if (!targetNode) {\n return false\n }\n if (targetNode === draggedNode) {\n return true\n }\n\n const { height: targetBlockElemHeight, top: targetBlockElemTop } =\n getBoundingClientRectWithoutTransform(targetBlockElem)\n\n const mouseY = pageY\n const isBelow = mouseY >= targetBlockElemTop + targetBlockElemHeight / 2 + window.scrollY\n\n if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n // below targetBlockElem\n targetNode.insertAfter(draggedNode)\n } else {\n // above targetBlockElem\n targetNode.insertBefore(draggedNode)\n }\n } else {\n //\n targetNode.insertBefore(draggedNode)\n targetNode.remove()\n }\n\n /*\n if (pageY >= targetBlockElemTop + targetBlockElemHeight / 2) {\n targetNode.insertAfter(draggedNode)\n } else {\n targetNode.insertBefore(draggedNode)\n }*/\n if (draggableBlockElem !== null) {\n setDraggableBlockElem(null)\n }\n\n // find all previous elements with lexical-block-highlighter class and remove them\n const allPrevHighlighters = document.querySelectorAll('.lexical-block-highlighter')\n allPrevHighlighters.forEach((highlighter) => {\n highlighter.remove()\n })\n\n const newInsertedElem = editor.getElementByKey(draggedNode.getKey())\n setTimeout(() => {\n // add new temp html element to newInsertedElem with the same height and width and the class block-selected\n // to highlight the new inserted element\n const newInsertedElemRect = newInsertedElem?.getBoundingClientRect()\n if (!newInsertedElemRect) {\n return\n }\n const highlightElem = document.createElement('div')\n highlightElem.className = 'lexical-block-highlighter'\n\n highlightElem.style.backgroundColor = 'var(--theme-elevation-1000'\n highlightElem.style.transition = 'opacity 0.5s ease-in-out'\n highlightElem.style.zIndex = '1'\n highlightElem.style.pointerEvents = 'none'\n highlightElem.style.boxSizing = 'border-box'\n highlightElem.style.borderRadius = '4px'\n highlightElem.style.position = 'absolute'\n document.body.appendChild(highlightElem)\n\n highlightElem.style.opacity = '0.1'\n\n highlightElem.style.height = `${newInsertedElemRect.height + 8}px`\n highlightElem.style.width = `${newInsertedElemRect.width + 8}px`\n highlightElem.style.top = `${newInsertedElemRect.top + window.scrollY - 4}px`\n highlightElem.style.left = `${newInsertedElemRect.left - 4}px`\n\n setTimeout(() => {\n highlightElem.style.opacity = '0'\n setTimeout(() => {\n highlightElem.remove()\n }, 500)\n }, 1000)\n }, 120)\n })\n\n return true\n }\n\n // register onDragover event listeners:\n document.addEventListener('dragover', onDragover)\n // register onDrop event listeners:\n document.addEventListener('drop', onDrop)\n\n return () => {\n document.removeEventListener('dragover', onDragover)\n document.removeEventListener('drop', onDrop)\n }\n }, [\n scrollerElem,\n blockHandleHorizontalOffset,\n anchorElem,\n editor,\n lastTargetBlock,\n draggableBlockElem,\n editorConfig?.admin?.hideGutter,\n ])\n\n function onDragStart(event: ReactDragEvent<HTMLButtonElement>): void {\n const dataTransfer = event.dataTransfer\n if (!dataTransfer || !draggableBlockElem) {\n return\n }\n setDragImage(dataTransfer, draggableBlockElem)\n let nodeKey = ''\n editor.update(() => {\n const node = $getNearestNodeFromDOMNode(draggableBlockElem)\n if (node) {\n nodeKey = node.getKey()\n }\n })\n isDraggingBlockRef.current = true\n dataTransfer.setData(DRAG_DATA_FORMAT, nodeKey)\n }\n\n function onDragEnd(): void {\n isDraggingBlockRef.current = false\n if (lastTargetBlock?.elem) {\n hideTargetLine(targetLineRef.current, lastTargetBlock?.elem)\n }\n }\n\n return createPortal(\n <React.Fragment>\n <button\n aria-label=\"Drag to move\"\n className=\"icon draggable-block-menu\"\n draggable\n onDragEnd={onDragEnd}\n onDragStart={onDragStart}\n ref={menuRef}\n type=\"button\"\n >\n <div className={isEditable ? 'icon' : ''} />\n </button>\n <div className=\"draggable-block-target-line\" ref={targetLineRef} />\n <div className=\"debug-highlight\" ref={debugHighlightRef} />\n </React.Fragment>,\n anchorElem,\n )\n}\n\nexport function DraggableBlockPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n return useDraggableBlockMenu(editor, anchorElem, editor._editable)\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,UAAU,QAAQ;AAC3B,SAASC,0BAA0B,EAAEC,aAAa,EAAEC,aAAa,QAAQ;AACzE,YAAYC,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC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AAnG,UAAA,EAAAoG;EAAA,IAAAD,EAIpC;EAHC,MAAAnG,UAAA,GAAAoG,EAA0B,KAAAC,SAAA,GAAAlE,QAAA,CAAAiD,IAAA,GAA1BgB,EAA0B;EAI1B,OAAArG,MAAA,IAAiBxC,yBAAA;EAAA,OACVuC,qBAAA,CAAsBC,MAAA,EAAQC,UAAA,EAAYD,MAAA,CAAAuG,SAAgB;AAAA","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ import { ContentEditable } from '@lexical/react/LexicalContentEditable.js';
|
|
|
6
6
|
import { useTranslation } from '@payloadcms/ui';
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
export function LexicalContentEditable(t0) {
|
|
9
|
-
const $ = _c(
|
|
9
|
+
const $ = _c(7);
|
|
10
10
|
const {
|
|
11
11
|
className,
|
|
12
12
|
editorConfig
|
|
@@ -16,12 +16,21 @@ export function LexicalContentEditable(t0) {
|
|
|
16
16
|
} = useTranslation();
|
|
17
17
|
let t1;
|
|
18
18
|
if ($[0] !== className || $[1] !== editorConfig?.admin?.placeholder || $[2] !== t) {
|
|
19
|
+
let t2;
|
|
20
|
+
if ($[4] !== editorConfig?.admin?.placeholder || $[5] !== t) {
|
|
21
|
+
t2 = editorConfig?.admin?.placeholder ?? t("lexical:general:placeholder");
|
|
22
|
+
$[4] = editorConfig?.admin?.placeholder;
|
|
23
|
+
$[5] = t;
|
|
24
|
+
$[6] = t2;
|
|
25
|
+
} else {
|
|
26
|
+
t2 = $[6];
|
|
27
|
+
}
|
|
19
28
|
t1 = _jsx(ContentEditable, {
|
|
20
29
|
"aria-placeholder": t("lexical:general:placeholder"),
|
|
21
30
|
className: className ?? "ContentEditable__root",
|
|
22
31
|
placeholder: _jsx("p", {
|
|
23
32
|
className: "editor-placeholder",
|
|
24
|
-
children:
|
|
33
|
+
children: t2
|
|
25
34
|
})
|
|
26
35
|
});
|
|
27
36
|
$[0] = className;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentEditable.js","names":["c","_c","ContentEditable","useTranslation","React","LexicalContentEditable","t0","$","className","editorConfig","t","t1","admin","placeholder","_jsx","children"],"sources":["../../../src/lexical/ui/ContentEditable.tsx"],"sourcesContent":["'use client'\nimport type { JSX } from 'react'\n\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport { useTranslation } from '@payloadcms/ui'\nimport * as React from 'react'\n\nimport './ContentEditable.scss'\nimport type { SanitizedClientEditorConfig } from '../config/types.js'\n\nexport function LexicalContentEditable({\n className,\n editorConfig,\n}: {\n className?: string\n editorConfig: SanitizedClientEditorConfig\n}): JSX.Element {\n const { t } = useTranslation<{}, string>()\n\n return (\n <ContentEditable\n aria-placeholder={t('lexical:general:placeholder')}\n className={className ?? 'ContentEditable__root'}\n placeholder={\n <p className=\"editor-placeholder\">\n {editorConfig?.admin?.placeholder ?? t('lexical:general:placeholder')}\n </p>\n }\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,YAAYC,KAAA,MAAW;AAKvB,OAAO,SAAAC,uBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAAgC;IAAAO,SAAA;IAAAC;EAAA,IAAAH,EAMtC;EACC;IAAAI;EAAA,IAAcP,cAAA;EAAA,IAAAQ,EAAA;EAAA,IAAAJ,CAAA,QAAAC,SAAA,IAAAD,CAAA,QAAAE,YAAA,EAAAG,KAAA,EAAAC,WAAA,IAAAN,CAAA,QAAAG,CAAA;
|
|
1
|
+
{"version":3,"file":"ContentEditable.js","names":["c","_c","ContentEditable","useTranslation","React","LexicalContentEditable","t0","$","className","editorConfig","t","t1","admin","placeholder","t2","_jsx","children"],"sources":["../../../src/lexical/ui/ContentEditable.tsx"],"sourcesContent":["'use client'\nimport type { JSX } from 'react'\n\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport { useTranslation } from '@payloadcms/ui'\nimport * as React from 'react'\n\nimport './ContentEditable.scss'\nimport type { SanitizedClientEditorConfig } from '../config/types.js'\n\nexport function LexicalContentEditable({\n className,\n editorConfig,\n}: {\n className?: string\n editorConfig: SanitizedClientEditorConfig\n}): JSX.Element {\n const { t } = useTranslation<{}, string>()\n\n return (\n <ContentEditable\n aria-placeholder={t('lexical:general:placeholder')}\n className={className ?? 'ContentEditable__root'}\n placeholder={\n <p className=\"editor-placeholder\">\n {editorConfig?.admin?.placeholder ?? t('lexical:general:placeholder')}\n </p>\n }\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,YAAYC,KAAA,MAAW;AAKvB,OAAO,SAAAC,uBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAAgC;IAAAO,SAAA;IAAAC;EAAA,IAAAH,EAMtC;EACC;IAAAI;EAAA,IAAcP,cAAA;EAAA,IAAAQ,EAAA;EAAA,IAAAJ,CAAA,QAAAC,SAAA,IAAAD,CAAA,QAAAE,YAAA,EAAAG,KAAA,EAAAC,WAAA,IAAAN,CAAA,QAAAG,CAAA;IAAA,IAAAI,EAAA;IAAA,IAAAP,CAAA,QAAAE,YAAA,EAAAG,KAAA,EAAAC,WAAA,IAAAN,CAAA,QAAAG,CAAA;MAQLI,EAAA,GAAAL,YAAA,EAAAG,KAAA,EAAAC,WAAA,IAAoCH,CAAA,CAAE;MAAAH,CAAA,MAAAE,YAAA,EAAAG,KAAA,EAAAC,WAAA;MAAAN,CAAA,MAAAG,CAAA;MAAAH,CAAA,MAAAO,EAAA;IAAA;MAAAA,EAAA,GAAAP,CAAA;IAAA;IAL7CI,EAAA,GAAAI,IAAA,CAAAb,eAAA;MAAA,oBACoBQ,CAAA,CAAE;MAAAF,SAAA,EACTA,SAAA,IAAa;MAAAK,WAAA,EAEtBE,IAAA,CAAC;QAAAP,SAAA,EAAY;QAAAQ,QAAA,EACVF;MAAsC,C;;;;;;;;;SAL7CH,E","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LexicalNodeContextMenuPlugin.d.ts","sourceRoot":"","sources":["../../../src/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.tsx"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LexicalNodeContextMenuPlugin.js","names":[],"sources":["../../../src/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.tsx"],"sourcesContent":["export * from '@lexical/react/LexicalNodeContextMenuPlugin'\n"],"mappings":"AAAA,cAAc","ignoreList":[]}
|
package/dist/nodeTypes.d.ts
CHANGED
|
@@ -30,19 +30,7 @@ type RecursiveNodes<T extends SerializedLexicalNode, Depth extends number = 4> =
|
|
|
30
30
|
children?: RecursiveNodes<T, DecrementDepth<Depth>>[];
|
|
31
31
|
} & T;
|
|
32
32
|
type DecrementDepth<N extends number> = [0, 0, 1, 2, 3, 4][N];
|
|
33
|
-
/**
|
|
34
|
-
* Alternative type to `SerializedEditorState` that automatically types your nodes
|
|
35
|
-
* more strictly, narrowing down nodes based on the `type` without having to manually
|
|
36
|
-
* type-cast.
|
|
37
|
-
*/
|
|
38
33
|
export type TypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> = SerializedEditorState<RecursiveNodes<T>>;
|
|
39
|
-
/**
|
|
40
|
-
* All node types included by default in a lexical editor without configuration.
|
|
41
|
-
*/
|
|
42
34
|
export type DefaultNodeTypes = SerializedAutoLinkNode | SerializedHeadingNode | SerializedHorizontalRuleNode | SerializedLineBreakNode | SerializedLinkNode | SerializedListItemNode | SerializedListNode | SerializedParagraphNode | SerializedQuoteNode | SerializedRelationshipNode | SerializedTabNode | SerializedTextNode | SerializedUploadNode;
|
|
43
|
-
|
|
44
|
-
* Like `TypedEditorState` but includes all default node types.
|
|
45
|
-
* You can pass *additional* node types as a generic parameter.
|
|
46
|
-
*/
|
|
47
|
-
export type DefaultTypedEditorState<TAdditionalNodeTypes extends null | SerializedLexicalNode = null> = [TAdditionalNodeTypes] extends null ? TypedEditorState<DefaultNodeTypes> : TypedEditorState<DefaultNodeTypes | NonNullable<TAdditionalNodeTypes>>;
|
|
35
|
+
export type DefaultTypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> = TypedEditorState<DefaultNodeTypes | T>;
|
|
48
36
|
//# sourceMappingURL=nodeTypes.d.ts.map
|
package/dist/nodeTypes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeTypes.d.ts","sourceRoot":"","sources":["../src/nodeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,IAAI,wBAAwB,EACnD,iBAAiB,IAAI,kBAAkB,EACvC,kBAAkB,IAAI,mBAAmB,EACzC,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,EACP,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAChF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAA;AACnG,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,+CAA+C,CAAA;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAC/E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8DAA8D,CAAA;AAChH,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAChG,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAClG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAA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AAkB,GAClB,uBAAuB,GACvB,mBAAmB,GACnB,0BAA0B,GAC1B,iBAAiB,GACjB,kBAAkB,GAClB,oBAAoB,CAAA;AAExB,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACzF,gBAAgB,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAA"}
|
package/dist/nodeTypes.js
CHANGED
package/dist/nodeTypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeTypes.js","names":[],"sources":["../src/nodeTypes.ts"],"sourcesContent":["import type {\n SerializedLineBreakNode as _SerializedLineBreakNode,\n SerializedTabNode as _SerializedTabNode,\n SerializedTextNode as _SerializedTextNode,\n SerializedEditorState,\n SerializedElementNode,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\n\nimport type { SerializedQuoteNode } from './features/blockquote/server/index.js'\nimport type { SerializedBlockNode } from './features/blocks/server/nodes/BlocksNode.js'\nimport type { SerializedInlineBlockNode } from './features/blocks/server/nodes/InlineBlocksNode.js'\nimport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from './features/experimental_table/server/index.js'\nimport type { SerializedHeadingNode } from './features/heading/server/index.js'\nimport type { SerializedHorizontalRuleNode } from './features/horizontalRule/server/nodes/HorizontalRuleNode.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './features/link/nodes/types.js'\nimport type { SerializedListItemNode, SerializedListNode } from './features/lists/plugin/index.js'\nimport type { SerializedRelationshipNode } from './features/relationship/server/nodes/RelationshipNode.js'\nimport type { SerializedUploadNode } from './features/upload/server/nodes/UploadNode.js'\n\nexport type {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedInlineBlockNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n SerializedUploadNode,\n}\n\nexport type SerializedParagraphNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n Spread<\n {\n textFormat: number\n type: 'paragraph'\n },\n SerializedElementNode<T>\n >\nexport type SerializedTextNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'text'\n },\n _SerializedTextNode\n>\n\nexport type SerializedTabNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'tab'\n },\n _SerializedTabNode\n>\n\nexport type SerializedLineBreakNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'linebreak'\n },\n _SerializedLineBreakNode\n>\n\ntype RecursiveNodes<T extends SerializedLexicalNode, Depth extends number = 4> = Depth extends 0\n ? T\n : { children?: RecursiveNodes<T, DecrementDepth<Depth>>[] } & T\n\ntype DecrementDepth<N extends number> = [0, 0, 1, 2, 3, 4][N]\n\
|
|
1
|
+
{"version":3,"file":"nodeTypes.js","names":[],"sources":["../src/nodeTypes.ts"],"sourcesContent":["import type {\n SerializedLineBreakNode as _SerializedLineBreakNode,\n SerializedTabNode as _SerializedTabNode,\n SerializedTextNode as _SerializedTextNode,\n SerializedEditorState,\n SerializedElementNode,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\n\nimport type { SerializedQuoteNode } from './features/blockquote/server/index.js'\nimport type { SerializedBlockNode } from './features/blocks/server/nodes/BlocksNode.js'\nimport type { SerializedInlineBlockNode } from './features/blocks/server/nodes/InlineBlocksNode.js'\nimport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from './features/experimental_table/server/index.js'\nimport type { SerializedHeadingNode } from './features/heading/server/index.js'\nimport type { SerializedHorizontalRuleNode } from './features/horizontalRule/server/nodes/HorizontalRuleNode.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './features/link/nodes/types.js'\nimport type { SerializedListItemNode, SerializedListNode } from './features/lists/plugin/index.js'\nimport type { SerializedRelationshipNode } from './features/relationship/server/nodes/RelationshipNode.js'\nimport type { SerializedUploadNode } from './features/upload/server/nodes/UploadNode.js'\n\nexport type {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedInlineBlockNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n SerializedUploadNode,\n}\n\nexport type SerializedParagraphNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n Spread<\n {\n textFormat: number\n type: 'paragraph'\n },\n SerializedElementNode<T>\n >\nexport type SerializedTextNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'text'\n },\n _SerializedTextNode\n>\n\nexport type SerializedTabNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'tab'\n },\n _SerializedTabNode\n>\n\nexport type SerializedLineBreakNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'linebreak'\n },\n _SerializedLineBreakNode\n>\n\ntype RecursiveNodes<T extends SerializedLexicalNode, Depth extends number = 4> = Depth extends 0\n ? T\n : { children?: RecursiveNodes<T, DecrementDepth<Depth>>[] } & T\n\ntype DecrementDepth<N extends number> = [0, 0, 1, 2, 3, 4][N]\n\nexport type TypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> =\n SerializedEditorState<RecursiveNodes<T>>\n\nexport type DefaultNodeTypes =\n | SerializedAutoLinkNode\n //| SerializedBlockNode // Not included by default\n | SerializedHeadingNode\n | SerializedHorizontalRuleNode\n | SerializedLineBreakNode\n | SerializedLinkNode\n | SerializedListItemNode\n | SerializedListNode\n | SerializedParagraphNode\n | SerializedQuoteNode\n | SerializedRelationshipNode\n | SerializedTabNode\n | SerializedTextNode\n | SerializedUploadNode\n\nexport type DefaultTypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> =\n TypedEditorState<DefaultNodeTypes | T>\n"],"mappings":"AAmGA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.56.0-internal.299316b",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -183,6 +183,11 @@
|
|
|
183
183
|
"types": "./dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts",
|
|
184
184
|
"default": "./dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js"
|
|
185
185
|
},
|
|
186
|
+
"./lexical/react/LexicalNodeContextMenuPlugin": {
|
|
187
|
+
"import": "./dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.js",
|
|
188
|
+
"types": "./dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.d.ts",
|
|
189
|
+
"default": "./dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.js"
|
|
190
|
+
},
|
|
186
191
|
"./lexical/react/LexicalDecoratorBlockNode": {
|
|
187
192
|
"import": "./dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.js",
|
|
188
193
|
"types": "./dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.d.ts",
|
|
@@ -343,16 +348,16 @@
|
|
|
343
348
|
]
|
|
344
349
|
},
|
|
345
350
|
"dependencies": {
|
|
346
|
-
"@lexical/headless": "0.
|
|
347
|
-
"@lexical/html": "0.
|
|
348
|
-
"@lexical/link": "0.
|
|
349
|
-
"@lexical/list": "0.
|
|
350
|
-
"@lexical/mark": "0.
|
|
351
|
-
"@lexical/react": "0.
|
|
352
|
-
"@lexical/rich-text": "0.
|
|
353
|
-
"@lexical/selection": "0.
|
|
354
|
-
"@lexical/table": "0.
|
|
355
|
-
"@lexical/utils": "0.
|
|
351
|
+
"@lexical/headless": "0.35.0",
|
|
352
|
+
"@lexical/html": "0.35.0",
|
|
353
|
+
"@lexical/link": "0.35.0",
|
|
354
|
+
"@lexical/list": "0.35.0",
|
|
355
|
+
"@lexical/mark": "0.35.0",
|
|
356
|
+
"@lexical/react": "0.35.0",
|
|
357
|
+
"@lexical/rich-text": "0.35.0",
|
|
358
|
+
"@lexical/selection": "0.35.0",
|
|
359
|
+
"@lexical/table": "0.35.0",
|
|
360
|
+
"@lexical/utils": "0.35.0",
|
|
356
361
|
"@types/uuid": "10.0.0",
|
|
357
362
|
"acorn": "8.12.1",
|
|
358
363
|
"bson-objectid": "2.0.4",
|
|
@@ -360,7 +365,7 @@
|
|
|
360
365
|
"dequal": "2.0.3",
|
|
361
366
|
"escape-html": "1.0.3",
|
|
362
367
|
"jsox": "1.2.121",
|
|
363
|
-
"lexical": "0.
|
|
368
|
+
"lexical": "0.35.0",
|
|
364
369
|
"mdast-util-from-markdown": "2.0.2",
|
|
365
370
|
"mdast-util-mdx-jsx": "3.1.3",
|
|
366
371
|
"micromark-extension-mdx-jsx": "3.0.1",
|
|
@@ -368,8 +373,8 @@
|
|
|
368
373
|
"react-error-boundary": "4.1.2",
|
|
369
374
|
"ts-essentials": "10.0.3",
|
|
370
375
|
"uuid": "10.0.0",
|
|
371
|
-
"@payloadcms/translations": "3.
|
|
372
|
-
"@payloadcms/ui": "3.
|
|
376
|
+
"@payloadcms/translations": "3.56.0-internal.299316b",
|
|
377
|
+
"@payloadcms/ui": "3.56.0-internal.299316b"
|
|
373
378
|
},
|
|
374
379
|
"devDependencies": {
|
|
375
380
|
"@babel/cli": "7.27.2",
|
|
@@ -377,27 +382,27 @@
|
|
|
377
382
|
"@babel/preset-env": "7.27.2",
|
|
378
383
|
"@babel/preset-react": "7.27.1",
|
|
379
384
|
"@babel/preset-typescript": "7.27.1",
|
|
380
|
-
"@lexical/eslint-plugin": "0.
|
|
385
|
+
"@lexical/eslint-plugin": "0.35.0",
|
|
381
386
|
"@types/escape-html": "1.0.4",
|
|
382
387
|
"@types/json-schema": "7.0.15",
|
|
383
388
|
"@types/node": "22.15.30",
|
|
384
|
-
"@types/react": "19.1.
|
|
385
|
-
"@types/react-dom": "19.1.
|
|
386
|
-
"babel-plugin-react-compiler": "19.1.0-rc.
|
|
389
|
+
"@types/react": "19.1.8",
|
|
390
|
+
"@types/react-dom": "19.1.6",
|
|
391
|
+
"babel-plugin-react-compiler": "19.1.0-rc.2",
|
|
387
392
|
"babel-plugin-transform-remove-imports": "^1.8.0",
|
|
388
393
|
"esbuild": "0.25.5",
|
|
389
394
|
"esbuild-sass-plugin": "3.3.1",
|
|
390
395
|
"swc-plugin-transform-remove-imports": "4.0.4",
|
|
391
|
-
"
|
|
392
|
-
"
|
|
396
|
+
"payload": "3.56.0-internal.299316b",
|
|
397
|
+
"@payloadcms/eslint-config": "3.28.0"
|
|
393
398
|
},
|
|
394
399
|
"peerDependencies": {
|
|
395
400
|
"@faceless-ui/modal": "3.0.0-beta.2",
|
|
396
401
|
"@faceless-ui/scroll-info": "2.0.0",
|
|
397
402
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
398
403
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
399
|
-
"@payloadcms/next": "3.
|
|
400
|
-
"payload": "3.
|
|
404
|
+
"@payloadcms/next": "3.56.0-internal.299316b",
|
|
405
|
+
"payload": "3.56.0-internal.299316b"
|
|
401
406
|
},
|
|
402
407
|
"engines": {
|
|
403
408
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";import{b as ke,c as we,f as _,h as ve,i as Te,j as De,k as Le,l as Me}from"./chunk-YCH4JNUH.js";import{a as Re,b as R}from"./chunk-BZZVLW4U.js";import{jsx as F,jsxs as ge}from"react/jsx-runtime";import{FieldDescription as xn,FieldError as En,FieldLabel as Cn,RenderCustomComponent as Et,useEditDepth as bn,useEffectEvent as Nn,useField as Pn}from"@payloadcms/ui";import{mergeFieldStyles as Sn}from"@payloadcms/ui/shared";import Ct,{useCallback as bt,useEffect as Nt,useMemo as Rn,useState as Pt}from"react";import{ErrorBoundary as kn}from"react-error-boundary";import"./bundled.css";import{jsx as O}from"react/jsx-runtime";import{LexicalComposer as gn}from"@lexical/react/LexicalComposer.js";import{useEditDepth as hn}from"@payloadcms/ui";import*as ht from"react";import{useMemo as yn}from"react";import{c as Zo}from"react/compiler-runtime";import{jsx as E,jsxs as te}from"react/jsx-runtime";import{useLexicalComposerContext as en}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as tn}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as on}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as nn}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as rn}from"@lexical/react/LexicalRichTextPlugin.js";import{BLUR_COMMAND as sn,COMMAND_PRIORITY_LOW as pt,FOCUS_COMMAND as ln}from"lexical";import*as q from"react";import{useEffect as an,useState as cn}from"react";import{jsx as Ae}from"react/jsx-runtime";import"react";var $=({anchorElem:t,clientProps:e,plugin:o})=>o.position==="floatingAnchorElem"&&t?o.Component&&Ae(o.Component,{anchorElem:t,clientProps:e}):o.Component&&Ae(o.Component,{clientProps:e});import{c as kt}from"react/compiler-runtime";import{useLexicalComposerContext as wt}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as ne,mergeRegister as vt}from"@lexical/utils";import{$createNodeSelection as Tt,$getEditor as X,$getNearestNodeFromDOMNode as Dt,$getSelection as re,$isDecoratorNode as K,$isElementNode as xe,$isLineBreakNode as Lt,$isNodeSelection as ie,$isRangeSelection as Be,$isRootOrShadowRoot as Mt,$isTextNode as At,$setSelection as Ie,CLICK_COMMAND as Bt,COMMAND_PRIORITY_LOW as W,KEY_ARROW_DOWN_COMMAND as It,KEY_ARROW_UP_COMMAND as _t,KEY_BACKSPACE_COMMAND as Ot,KEY_DELETE_COMMAND as Ft,SELECTION_CHANGE_COMMAND as $t}from"lexical";import{useEffect as Kt}from"react";function _e(){let t=kt(3),[e]=wt(),o=Gt,n,r;return t[0]!==e?(n=()=>vt(e.registerCommand(Bt,Vt,W),e.registerCommand(Ft,o,W),e.registerCommand(Ot,o,W),e.registerCommand($t,Yt,W),e.registerCommand(_t,zt,W),e.registerCommand(It,Ht,W)),r=[e],t[0]=e,t[1]=n,t[2]=r):(n=t[1],r=t[2]),Kt(n,r),null}function Ht(t){let e=re();if(ie(e)){t.preventDefault();let s=e.getNodes()[0]?.getNextSibling();if(K(s)){let y=X().getElementByKey(s.getKey());return y&&Z({element:y,node:s}),!0}if(!xe(s))return!0;let l=s.getFirstDescendant()??s;return l&&(ne(l,se)?.selectEnd(),t.preventDefault()),!0}if(!Be(e))return!1;let n=(e.isBackward()?e.anchor:e.focus).getNode(),r=ne(n,jt),c=r?.getNextSibling();if(!r||c!==Oe(r))return!1;if(K(c)){let s=X().getElementByKey(c.getKey());if(s)return Z({element:s,node:c}),t.preventDefault(),!0}return!1}function jt(t){return Oe(t)!==null}function zt(t){let e=re();if(ie(e)){let s=e.getNodes()[0]?.getPreviousSibling();if(K(s)){let y=X().getElementByKey(s.getKey());return y?(Z({element:y,node:s}),t.preventDefault(),!0):!1}if(!xe(s))return!1;let l=s.getLastDescendant()??s;return l?(ne(l,se)?.selectStart(),t.preventDefault(),!0):!1}if(!Be(e))return!1;let n=(e.isBackward()?e.anchor:e.focus).getNode(),r=ne(n,Wt),c=r?.getPreviousSibling();if(!r||c!==Fe(r))return!1;if(K(c)){let s=X().getElementByKey(c.getKey());if(s)return Z({element:s,node:c}),t.preventDefault(),!0}return!1}function Wt(t){return Fe(t)!==null}function Yt(){let t=Jt();return document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),t?(t.element?.classList.add("decorator-selected"),!0):!1}function Vt(t){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let e=qt(t);if(!e)return!0;let{target:o}=t;return!(o instanceof HTMLElement)||o.isContentEditable||o.closest('button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role="button"]')?Ie(null):Z(e),!0}function Gt(t){let e=re();return ie(e)?(t.preventDefault(),e.getNodes().forEach(Ut),!0):!1}function Ut(t){t.remove()}function qt(t){if(!(t.target instanceof HTMLElement))return;let e=t.target.closest('[data-lexical-decorator="true"]');if(!(e instanceof HTMLElement))return;let o=Dt(e);return K(o)?{element:e,node:o}:void 0}function Jt(){let t=re();if(!ie(t))return;let e=t.getNodes();if(e.length!==1)return;let o=e[0];return K(o)?{decorator:o,element:X().getElementByKey(o.getKey())}:void 0}function Z({element:t,node:e}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=Tt();o.add(e.getKey()),Ie(o),t.scrollIntoView({behavior:"smooth",block:"nearest"}),t.classList.add("decorator-selected")}function se(t){if(K(t)&&!t.isInline())return!0;if(!xe(t)||Mt(t))return!1;let e=t.getFirstChild(),o=e===null||Lt(e)||At(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&o}function Oe(t){let e=t.getNextSibling();for(;e!==null;){if(se(e))return e;e=e.getNextSibling()}return null}function Fe(t){let e=t.getPreviousSibling();for(;e!==null;){if(se(e))return e;e=e.getPreviousSibling()}return null}import{jsx as Ee}from"react/jsx-runtime";import{useLexicalComposerContext as oo}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as no,isHTMLElement as ro}from"lexical";import*as je from"react";import{useCallback as io,useEffect as He,useRef as so,useState as lo}from"react";import{createPortal as ao}from"react-dom";var Y=(t,e,o,n,r=50,c=25)=>{let s=0;if(t&&!t.contains(n)){let{bottom:l,left:u,right:y,top:h}=t.getBoundingClientRect(),a=h+window.scrollY,i=l+window.scrollY;if(o<a-c||o>i+c||e<u-r||e>y+r)return-1;(e<u||e>y)&&(s=e<u?e-u:e-y)}return s};import{$getNodeByKey as ae}from"lexical";function V(t){let e=t.getBoundingClientRect(),o=getComputedStyle(t).getPropertyValue("transform");if(!o||o==="none")return e;let n=o.split(",").pop();return e.y=e.y-Number(n?.replace(")","")),e}function le(t){let e=(u,y)=>u?parseFloat(window.getComputedStyle(u)[y]):0,{marginBottom:o,marginTop:n}=window.getComputedStyle(t),r=e(t.previousElementSibling,"marginBottom"),c=e(t.nextElementSibling,"marginTop"),s=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),c),marginTop:s}}import{$getRoot as Qt}from"lexical";function H(t){return t.getEditorState().read(()=>Qt().getChildrenKeys())}var Xt=1,Zt=-1,$e=0,A={props:null,result:null};function eo(t,e,o=20){let n=t.x-e.x,r=t.y-e.y;return n*n+r*r<=o*o}function G(t){let{anchorElem:e,cache_threshold:o=20,editor:n,fuzzy:r=!1,horizontalOffset:c=0,point:{x:s,y:l},startIndex:u=0,useEdgeAsDefault:y=!1}=t;if(o>0&&A.props&&A.result&&A.props.fuzzy===t.fuzzy&&A.props.horizontalOffset===t.horizontalOffset&&A.props.useEdgeAsDefault===t.useEdgeAsDefault&&eo(A.props.point,t.point,o))return A.result;let h=e.getBoundingClientRect(),a=H(n),i={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return n.getEditorState().read(()=>{if(y){let d=n.getElementByKey(a[0]),p=n.getElementByKey(a[a.length-1]);if(d&&p){let[f,m]=[V(d),V(p)];if(l<f.top?(i.blockElem=d,i.distance=f.top-l,i.blockNode=ae(a[0]),i.foundAtIndex=0):l>m.bottom&&(i.distance=l-m.bottom,i.blockNode=ae(a[a.length-1]),i.blockElem=p,i.foundAtIndex=a.length-1),i?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let g=u,x=$e;for(;g>=0&&g<a.length;){let d=a[g],p=n.getElementByKey(d);if(p===null)break;let f=new _(s+c,l),m=Le.fromDOMRect(V(p)),{marginBottom:C,marginTop:w}=le(p),S=m.generateNewRect({bottom:m.bottom+C,left:h.left,right:h.right,top:m.top-w}),{distance:b,isOnBottomSide:k,isOnTopSide:N}=S.distanceFromPoint(f);if(b===0){i.blockElem=p,i.blockNode=ae(d),i.foundAtIndex=g,i.distance=b,i.blockNode&&i.blockNode.getType()==="paragraph"&&i.blockNode.getTextContent()===""&&(!r&&!t.returnEmptyParagraphs&&(i.blockElem=null,i.blockNode=null),i.isFoundNodeEmptyParagraph=!0);break}else r&&b<i.distance&&(i.blockElem=p,i.blockNode=ae(d),i.distance=b,i.foundAtIndex=g);x===$e&&(N?x=Zt:k?x=Xt:x=1/0),g+=x}}),A.props=t,A.result={blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph},{blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph}}function ce(t,e){return!!t.closest(`.${e}`)}var to=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Ke(t){if(!t||to.includes(t.tagName)||t.offsetHeight===0||t.offsetWidth===0)return!1;let e=window.getComputedStyle(t);return!(e.display==="table-cell"||e.position==="absolute"||e.visibility==="hidden"||e.opacity==="0")}function ue(t,e,o,n=0){if(!t){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let r=t.getBoundingClientRect(),c=window.getComputedStyle(t),s=e.getBoundingClientRect(),l=o.getBoundingClientRect(),u;if(["lexical-block","lexical-upload","lexical-relationship"].some(a=>t.firstElementChild?.classList.contains(a)))u=r.top+8-l.top;else{let a=Ke(t)?parseInt(c.lineHeight,10):0;u=r.top+(a-s.height)/2-l.top}let h=n;e.style.opacity="1",e.style.transform=`translate(${h}px, ${u}px)`}var co="add-block-menu",de=1/0;function uo(t){return t===0?1/0:de>=0&&de<t?de:Math.floor(t/2)}function mo(t,e,o){let n=e.parentElement,{editorConfig:r}=R(),c=r?.admin?.hideGutter?-24:12,s=so(null),[l,u]=lo(null);He(()=>{function h(a){let i=a.target;if(!ro(i))return;let g=Y(n,a.pageX,a.pageY,i);if(g===-1){u(null);return}if(ce(i,co))return;let x=H(t),{blockElem:d,blockNode:p,foundAtIndex:f}=G({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-g,point:new _(a.x,a.y),returnEmptyParagraphs:!0,startIndex:uo(x.length),useEdgeAsDefault:!1});de=f,d&&p&&(l?.node!==p||l?.elem!==d)&&u({elem:d,node:p})}return document?.addEventListener("mousemove",h),()=>{document?.removeEventListener("mousemove",h)}},[n,e,t,l]),He(()=>{s.current&&l?.node&&ue(l?.elem,s.current,e,c)},[e,l,c]);let y=io(h=>{let a=l;a?.node&&(t.update(()=>{let i=!0;if((a?.node.getType()!=="paragraph"||a.node.getTextContent()!=="")&&(i=!1),!i){let g=no();a?.node.insertAfter(g),setTimeout(()=>{a={elem:t.getElementByKey(g.getKey()),node:g},u(a)},0)}}),setTimeout(()=>{t.update(()=>{t.focus(),a?.node&&"select"in a.node&&typeof a.node.select=="function"&&a.node.select()})},1),setTimeout(()=>{t.dispatchCommand(Te,{node:a?.node})},2),h.stopPropagation(),h.preventDefault())},[t,l]);return ao(Ee(je.Fragment,{children:Ee("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:h=>{y(h)},ref:s,type:"button",children:Ee("div",{className:o?"icon":""})})}),e)}function ze(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[n]=oo();return mo(n,o,n._editable)}import{jsx as me,jsxs as po}from"react/jsx-runtime";import{useLexicalComposerContext as go}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as Ve}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as Ge,$getNodeByKey as ho,isHTMLElement as Ce}from"lexical";import*as Xe from"react";import{useEffect as be,useRef as fe,useState as Ue}from"react";import{createPortal as yo}from"react-dom";var We=0,fo=-24;var j=0;function Ye(t,e,o,n,r,c,s,l,u,y=!1){let{height:h,top:a}=n.getBoundingClientRect(),{top:i,width:g}=s.getBoundingClientRect(),{marginBottom:x,marginTop:d}=le(n),p=a,f=c>=a+h/2+window.scrollY,m=!1;if(r?.elem)if(n!==r?.elem)(f&&r?.elem&&r?.elem===n.nextElementSibling||!f&&r?.elem&&r?.elem===n.previousElementSibling)&&(j++,j<200&&(m=!0));else{j++;let b=r?.boundingBox?.y,k=n.getBoundingClientRect().y;(f===r?.isBelow&&b===k||j<200)&&(m=!1)}if(m)return{isBelow:f,willStayInSamePosition:m};y?p+=h/2:f?p+=h+x/2:p-=d/2;let C=0;y||(f?C=-We:C=We);let w=p-i+C,S=fo-e;return o.style.width=`calc(${g}px - ${t})`,o.style.opacity=".8",o.style.transform=`translate(${S}px, calc(${w}px - 2px))`,r?.elem&&(r.elem.style.opacity="",r?.elem===n?f?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop="")),j=0,{isBelow:f,willStayInSamePosition:m}}var xo="draggable-block-menu",qe="application/x-lexical-drag-block",ee=1/0;function Je(t){return t===0?1/0:ee>=0&&ee<t?ee:Math.floor(t/2)}function Eo(t,e){let{transform:o}=e.style;t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=o})}function Qe(t,e){t&&(t.style.opacity="0"),e&&(e.style.opacity="",e.style.marginBottom="",e.style.marginTop="")}function Co(t,e,o){let n=e.parentElement,r=fe(null),c=fe(null),s=fe(null),l=fe(!1),[u,y]=Ue(null),[h,a]=Ue(null),{editorConfig:i}=R(),g=i?.admin?.hideGutter?-44:-8;be(()=>{function p(f){let m=f.target;if(!Ce(m))return;let C=Y(n,f.pageX,f.pageY,m);if(C===-1){y(null);return}if(ce(m,xo))return;let w=H(t),{blockElem:S,foundAtIndex:b,isFoundNodeEmptyParagraph:k}=G({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-C,point:new _(f.x,f.y),startIndex:Je(w.length),useEdgeAsDefault:!1,verbose:!1});ee=b,!(!S&&!k)&&u!==S&&y(S)}return document?.addEventListener("mousemove",p),()=>{document?.removeEventListener("mousemove",p)}},[n,e,t,u]),be(()=>{r.current&&ue(u,r.current,e,g)},[e,u,g]),be(()=>{function p(m){if(!l.current)return!1;let[C]=Ve(m);if(C)return!1;let{pageY:w,target:S}=m;if(!Ce(S))return!1;let b=Y(n,m.pageX,m.pageY,S,100,50),k=H(t),{blockElem:N,foundAtIndex:L,isFoundNodeEmptyParagraph:I}=G({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-b,point:new _(m.x,m.y),startIndex:Je(k.length),useEdgeAsDefault:!0,verbose:!0});ee=L;let v=c.current;if(N===null||v===null)return!1;if(u!==N){let{isBelow:T,willStayInSamePosition:J}=Ye(i?.admin?.hideGutter?"0px":"3rem",g+(i?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),v,N,h,w,e,m,s,I);m.preventDefault(),J||a({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:T})}else h?.elem&&(Qe(v,h.elem),a({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:!1}));return!0}function f(m){if(!l.current)return!1;let[C]=Ve(m);if(C)return!1;let{dataTransfer:w,pageY:S,target:b}=m,k=w?.getData(qe)||"";return t.update(()=>{let N=ho(k);if(!N||!Ce(b))return!1;let L=Y(n,m.pageX,m.pageY,b,100,50),{blockElem:I,isFoundNodeEmptyParagraph:v}=G({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-L,point:new _(m.x,m.y),useEdgeAsDefault:!0});if(!I)return!1;let T=Ge(I);if(!T)return!1;if(T===N)return!0;let{height:J,top:he}=V(I),z=S>=he+J/2+window.scrollY;v?(T.insertBefore(N),T.remove()):z?T.insertAfter(N):T.insertBefore(N),u!==null&&y(null),document.querySelectorAll(".lexical-block-highlighter").forEach(D=>{D.remove()});let oe=t.getElementByKey(N.getKey());setTimeout(()=>{let D=oe?.getBoundingClientRect();if(!D)return;let P=document.createElement("div");P.className="lexical-block-highlighter",P.style.backgroundColor="var(--theme-elevation-1000",P.style.transition="opacity 0.5s ease-in-out",P.style.zIndex="1",P.style.pointerEvents="none",P.style.boxSizing="border-box",P.style.borderRadius="4px",P.style.position="absolute",document.body.appendChild(P),P.style.opacity="0.1",P.style.height=`${D.height+8}px`,P.style.width=`${D.width+8}px`,P.style.top=`${D.top+window.scrollY-4}px`,P.style.left=`${D.left-4}px`,setTimeout(()=>{P.style.opacity="0",setTimeout(()=>{P.remove()},500)},1e3)},120)}),!0}return document.addEventListener("dragover",p),document.addEventListener("drop",f),()=>{document.removeEventListener("dragover",p),document.removeEventListener("drop",f)}},[n,g,e,t,h,u,i?.admin?.hideGutter]);function x(p){let f=p.dataTransfer;if(!f||!u)return;Eo(f,u);let m="";t.update(()=>{let C=Ge(u);C&&(m=C.getKey())}),l.current=!0,f.setData(qe,m)}function d(){l.current=!1,h?.elem&&Qe(c.current,h?.elem)}return yo(po(Xe.Fragment,{children:[me("div",{className:"icon draggable-block-menu",draggable:!0,onDragEnd:d,onDragStart:x,ref:r,children:me("div",{className:o?"icon":""})}),me("div",{className:"draggable-block-target-line",ref:c}),me("div",{className:"debug-highlight",ref:s})]}),e)}function Ze(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[n]=go();return Co(n,o,n._editable)}import{c as bo}from"react/compiler-runtime";import{jsx as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as No}from"@lexical/react/LexicalComposerContext";import{$createParagraphNode as Po,$getRoot as So}from"lexical";import"react";var et="insert-paragraph-at-end",tt=()=>{let t=bo(2),[e]=No(),{editorConfig:o}=R();if(o?.admin?.hideInsertParagraphAtEnd)return null;let n;return t[0]!==e?(n=Ne("div",{"aria-label":"Insert Paragraph",className:et,onClick:()=>{e.update(Ro)},role:"button",tabIndex:0,children:Ne("div",{className:`${et}-inside`,children:Ne("span",{children:"+"})})}),t[0]=e,t[1]=n):n=t[1],n};function Ro(){let t=Po();So().append(t),t.select()}import{c as ko}from"react/compiler-runtime";import{useLexicalComposerContext as wo}from"@lexical/react/LexicalComposerContext";import*as ot from"react";var nt=()=>{let t=ko(4),{editorConfig:e}=R(),[o]=wo(),n,r;return t[0]!==o||t[1]!==e.features.markdownTransformers?(n=()=>we(o,e.features.markdownTransformers??[]),r=[o,e.features.markdownTransformers],t[0]=o,t[1]=e.features.markdownTransformers,t[2]=n,t[3]=r):(n=t[2],r=t[3]),ot.useEffect(n,r),null};import{useLexicalComposerContext as vo}from"@lexical/react/LexicalComposerContext";import{$getSelection as To,$isRangeSelection as Do,RootNode as Lo}from"lexical";import{useEffect as Mo}from"react";function rt(){let[t]=vo();return Mo(()=>t.registerNodeTransform(Lo,e=>{let o=To();if(Do(o)){let n=o.anchor.getNode(),r=o.focus.getNode();(!n.isAttached()||!r.isAttached())&&(e.selectEnd(),console.warn("updateEditor: selection has been moved to the end of the editor because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node."))}return!1}),[t]),null}import{useLexicalComposerContext as Ao}from"@lexical/react/LexicalComposerContext";import{$getSelection as Bo,COMMAND_PRIORITY_LOW as Io,SELECT_ALL_COMMAND as _o}from"lexical";import{useEffect as Oo}from"react";function it(){let[t]=Ao();return Oo(()=>t.registerCommand(_o,()=>{if(Bo())return!1;let o=document.activeElement;return o instanceof HTMLInputElement&&o.select(),!0},Io),[t]),null}import{jsx as U,jsxs as lt}from"react/jsx-runtime";import{useLexicalComposerContext as $o}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as at}from"@payloadcms/ui";import{useCallback as Ko,useMemo as Ho,useState as jo}from"react";import"react";import*as ct from"react-dom";import{c as Fo}from"react/compiler-runtime";import"react";function st(t,e){let o=Fo(4),{maxLength:n,minLength:r}=e,c=n===void 0?75:n,s=r===void 0?1:r,l;return o[0]!==c||o[1]!==s||o[2]!==t?(l=u=>{let{query:y}=u,h="[^"+t+ve+"\\s]",i=new RegExp("(^|\\s|\\()(["+t+"]((?:"+h+"){0,"+c+"}))$").exec(y);if(i!==null){let g=i[1],x=i[3];if(x.length>=s)return{leadOffset:i.index+g.length,matchingString:x,replaceableString:i[2]}}return null},o[0]=c,o[1]=s,o[2]=t,o[3]=l):l=o[3],l}var B="slash-menu-popup";function zo({isSelected:t,item:e,onClick:o,onMouseEnter:n,ref:r}){let{fieldProps:{featureClientSchemaMap:c,schemaPath:s}}=R(),{i18n:l}=at(),u=`${B}__item ${B}__item-${e.key}`;t&&(u+=` ${B}__item--selected`);let y=e.key;return e.label&&(y=typeof e.label=="function"?e.label({featureClientSchemaMap:c,i18n:l,schemaPath:s}):e.label),y.length>25&&(y=y.substring(0,25)+"..."),lt("button",{"aria-selected":t,className:u,id:B+"__item-"+e.key,onClick:o,onMouseEnter:n,ref:r,role:"option",tabIndex:-1,type:"button",children:[e?.Icon&&U(e.Icon,{}),U("span",{className:`${B}__item-text`,children:y})]},e.key)}function ut({anchorElem:t=document.body}){let[e]=$o(),[o,n]=jo(null),{editorConfig:r}=R(),{i18n:c}=at(),{fieldProps:{featureClientSchemaMap:s,schemaPath:l}}=R(),u=st("/",{minLength:0}),y=Ko(()=>{let a=[];for(let i of r.features.slashMenu.dynamicGroups)if(o){let g=i({editor:e,queryString:o});a=a.concat(g)}return a},[e,o,r?.features]),h=Ho(()=>{let a=[];for(let i of r?.features.slashMenu.groups??[])a.push(i);if(o){a=a.map(g=>{let x=g.items.filter(d=>{let p=d.key;return d.label&&(p=typeof d.label=="function"?d.label({featureClientSchemaMap:s,i18n:c,schemaPath:l}):d.label),new RegExp(o,"gi").exec(p)?!0:d.keywords!=null?d.keywords.some(f=>new RegExp(o,"gi").exec(f)):!1});return x.length?{...g,items:x}:null}),a=a.filter(g=>g!=null);let i=y();for(let g of i){let x=a.find(d=>d.key===g.key);x?a=a.filter(d=>d.key!==g.key):x={...g,items:[]},x?.items?.length&&(x.items=x.items.concat(x.items)),a.push(x)}}return a},[o,r?.features.slashMenu.groups,y,s,c,l]);return U(De,{anchorElem:t,groups:h,menuRenderFn:(a,{selectedItemKey:i,selectItemAndCleanUp:g,setSelectedItemKey:x})=>a.current&&h.length?ct.createPortal(U("div",{className:B,children:h.map(d=>{let p=d.key;return d.label&&s&&(p=typeof d.label=="function"?d.label({featureClientSchemaMap:s,i18n:c,schemaPath:l}):d.label),lt("div",{className:`${B}__group ${B}__group-${d.key}`,children:[U("div",{className:`${B}__group-title`,children:p}),d.items.map((f,m)=>U(zo,{index:m,isSelected:i===f.key,item:f,onClick:()=>{x(f.key),g(f)},onMouseEnter:()=>{x(f.key)},ref:C=>{f.ref={current:C}}},f.key))]},d.key)})}),a.current):null,onQueryChange:n,triggerFn:u})}import{c as Wo}from"react/compiler-runtime";import{useLexicalComposerContext as Yo}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as Vo,TextNode as Go}from"lexical";import{useEffect as Uo}from"react";function dt(t){let e=Wo(6),{features:o}=t,[n]=Yo(),r;e[0]!==n||e[1]!==o.enabledFormats?(r=()=>{let s=qo(o.enabledFormats);if(s.length!==0)return n.registerNodeTransform(Go,l=>{s.forEach(u=>{l.hasFormat(u)&&l.toggleFormat(u)})})},e[0]=n,e[1]=o.enabledFormats,e[2]=r):r=e[2];let c;return e[3]!==n||e[4]!==o?(c=[n,o],e[3]=n,e[4]=o,e[5]=c):c=e[5],Uo(r,c),null}function qo(t){let e=Object.keys(Vo),o=new Set(t);return e.filter(n=>!o.has(n))}import{c as Jo}from"react/compiler-runtime";import{jsx as mt}from"react/jsx-runtime";import{ContentEditable as Qo}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as Xo}from"@payloadcms/ui";import"react";function ft(t){let e=Jo(4),{className:o,editorConfig:n}=t,{t:r}=Xo(),c;return e[0]!==o||e[1]!==n?.admin?.placeholder||e[2]!==r?(c=mt(Qo,{"aria-placeholder":r("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:mt("p",{className:"editor-placeholder",children:n?.admin?.placeholder??r("lexical:general:placeholder")})}),e[0]=o,e[1]=n?.admin?.placeholder,e[2]=r,e[3]=c):c=e[3],c}var gt=t=>{let e=Zo(14),{editorConfig:o,editorContainerRef:n,isSmallWidthViewport:r,onChange:c}=t,s=R(),[l]=en(),[u,y]=cn(null),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=d=>{d!==null&&y(d)},e[0]=h):h=e[0];let a=h,i,g;e[1]!==l||e[2]!==s?(i=()=>{if(!s?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}s?.parentEditor?.uuid&&s.parentEditor?.registerChild(s.uuid,s);let d=()=>{s.focusEditor(s)},p=()=>{s.blurEditor(s)},f=l.registerCommand(ln,()=>(d(),!0),pt),m=l.registerCommand(sn,()=>(p(),!0),pt);return()=>{f(),m(),s.parentEditor?.unregisterChild?.(s.uuid)}},g=[l,s],e[1]=l,e[2]=s,e[3]=i,e[4]=g):(i=e[3],g=e[4]),an(i,g);let x;if(e[5]!==l||e[6]!==o||e[7]!==n||e[8]!==u||e[9]!==r||e[10]!==c){let d;e[12]!==c?(d=(p,f,m)=>{(!m.has("focus")||m.size>1)&&c?.(p,f,m)},e[12]=c,e[13]=d):d=e[13],x=te(q.Fragment,{children:[o.features.plugins?.map(un),te("div",{className:"editor-container",ref:n,children:[o.features.plugins?.map(dn),E(rn,{contentEditable:E("div",{className:"editor-scroller",children:E("div",{className:"editor",ref:a,children:E(ft,{editorConfig:o})})}),ErrorBoundary:tn}),E(rt,{}),E(tt,{}),E(_e,{}),E(dt,{features:o.features}),E(it,{}),E(nn,{ignoreSelectionChange:!0,onChange:d}),u&&te(q.Fragment,{children:[!r&&l.isEditable()&&te(q.Fragment,{children:[o.admin?.hideDraggableBlockElement?null:E(Ze,{anchorElem:u}),o.admin?.hideAddBlockButton?null:E(ze,{anchorElem:u})]}),o.features.plugins?.map(p=>{if(p.position==="floatingAnchorElem"&&!(p.desktopOnly===!0&&r))return E($,{anchorElem:u,clientProps:p.clientProps,plugin:p},p.key)}),l.isEditable()&&E(q.Fragment,{children:E(ut,{anchorElem:u})})]}),l.isEditable()&&te(q.Fragment,{children:[E(on,{}),o?.features?.markdownTransformers?.length>0&&E(nt,{})]}),o.features.plugins?.map(mn),o.features.plugins?.map(fn)]}),o.features.plugins?.map(pn)]}),e[5]=l,e[6]=o,e[7]=n,e[8]=u,e[9]=r,e[10]=c,e[11]=x}else x=e[11];return x};function un(t){if(t.position==="aboveContainer")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function dn(t){if(t.position==="top")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function mn(t){if(t.position==="normal")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function fn(t){if(t.position==="bottom")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function pn(t){if(t.position==="belowContainer")return E($,{clientProps:t.clientProps,plugin:t},t.key)}var yt=({children:t,providers:e})=>{if(!e?.length)return t;let o=e[0];return e.length>1?O(o,{children:O(yt,{providers:e.slice(1),children:t})}):O(o,{children:t})},xt=t=>{let{composerKey:e,editorConfig:o,fieldProps:n,isSmallWidthViewport:r,onChange:c,readOnly:s,value:l}=t,u=R(),y=hn(),h=ht.useRef(null),a=yn(()=>{if(l&&typeof l!="object")throw new Error("The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: "+JSON.stringify(l));if(l&&Array.isArray(l)&&!("root"in l))throw new Error("You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended");if(l&&"jsonContent"in l)throw new Error("You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical");return{editable:s!==!0,editorState:l!=null?JSON.stringify(l):void 0,namespace:o.lexical.namespace,nodes:Me({editorConfig:o}),onError:i=>{throw i},theme:o.lexical.theme}},[o]);return a?O(gn,{initialConfig:a,children:O(Re,{editorConfig:o,editorContainerRef:h,fieldProps:n,parentContext:u?.editDepth===y?u:void 0,children:O(yt,{providers:o.features.providers,children:O(gt,{editorConfig:o,editorContainerRef:h,isSmallWidthViewport:r,onChange:c})})})},e+a.editable):O("p",{children:"Loading..."})};var pe="rich-text-lexical",wn=t=>{let{editorConfig:e,field:o,field:{admin:{className:n,description:r,readOnly:c}={},label:s,localized:l,required:u},path:y,readOnly:h,validate:a}=t,i=h||c,g=bn(),x=bt((M,Q)=>typeof a=="function"?a(M,{...Q,required:u}):!0,[a,u]),{customComponents:{AfterInput:d,BeforeInput:p,Description:f,Error:m,Label:C}={},disabled:w,initialValue:S,path:b,setValue:k,showError:N,value:L}=Pn({potentiallyStalePath:y,validate:x}),I=i||w,[v,T]=Pt(!1),[J,he]=Pt(),ye=Ct.useRef(S),z=Ct.useRef(L);Nt(()=>{let M=()=>{let Q=window.matchMedia("(max-width: 768px)").matches;Q!==v&&T(Q)};return M(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}},[v]);let Pe=[pe,"field-type",n,N&&"error",I&&`${pe}--read-only`,e?.admin?.hideGutter!==!0&&!v?`${pe}--show-gutter`:null].filter(Boolean).join(" "),oe=`${b}.${g}`,D=ke(),P=bt(M=>{D(()=>{let Se=M.toJSON();z.current=Se,k(Se)})},[k,D]),St=Rn(()=>Sn(o),[o]),Rt=Nn(M=>{z.current!==L&&JSON.stringify(z.current)!==JSON.stringify(L)&&(ye.current=M,z.current=L,he(new Date))});return Nt(()=>{Object.is(S,ye.current)||Rt(S)},[S]),ge("div",{className:Pe,style:St,children:[F(Et,{CustomComponent:m,Fallback:F(En,{path:b,showError:N})}),C||F(Cn,{label:s,localized:l,path:b,required:u}),ge("div",{className:`${pe}__wrap`,children:[ge(kn,{fallbackRender:vn,onReset:()=>{},children:[p,F(xt,{composerKey:oe,editorConfig:e,fieldProps:t,isSmallWidthViewport:v,onChange:P,readOnly:I,value:L},JSON.stringify({path:b,rerenderProviderKey:J})),d]}),f,F(Et,{CustomComponent:f,Fallback:F(xn,{description:r,path:b})})]})]},oe)};function vn({error:t}){return ge("div",{className:"errorBoundary",role:"alert",children:[F("p",{children:"Something went wrong:"}),F("pre",{style:{color:"red"},children:t.message})]})}var cs=wn;export{cs as RichText};
|
|
2
|
-
//# sourceMappingURL=Field-Q3PTZQ75.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as F}from"./chunk-BZZVLW4U.js";import{c as V}from"react/compiler-runtime";import{jsx as R}from"react/jsx-runtime";import{Drawer as q,EditDepthProvider as z,useModal as G}from"@payloadcms/ui";import"react";import{jsx as E,jsxs as O}from"react/jsx-runtime";import{Form as M,FormSubmit as v,RenderFields as T,useDocumentForm as $,useDocumentInfo as N,useServerFunctions as W,useTranslation as k}from"@payloadcms/ui";import{abortAndIgnore as P}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as y}from"payload/shared";import{useCallback as B,useEffect as I,useRef as H,useState as L}from"react";import{v4 as U}from"uuid";var j=({data:c,featureKey:e,fieldMapOverride:u,handleDrawerSubmit:m,schemaFieldsPathOverride:r,schemaPath:f,schemaPathSuffix:d})=>{let{t:p}=k(),{id:s,collectionSlug:i,getDocPreferences:a,globalSlug:n}=N(),{fields:t}=$(),l=H(new AbortController),[o,h]=L(!1),{fieldProps:{featureClientSchemaMap:w}}=F(),{getFormState:S}=W(),C=r??`${f}.lexical_internal_feature.${e}${d?`.${d}`:""}`,b=u??w[e]?.[C];I(()=>{let g=new AbortController;return(async()=>{let{state:_}=await S({id:s,collectionSlug:i,data:c??{},docPermissions:{fields:!0},docPreferences:await a(),documentFormState:y(t),globalSlug:n,initialBlockData:c,operation:"update",renderAllFields:!0,schemaPath:C,signal:g.signal});h(_)})(),()=>{P(g)}},[C,s,c,S,i,n,a,t]);let x=B(async({formState:g})=>{P(l.current);let A=new AbortController;l.current=A;let{state:_}=await S({id:s,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await a(),documentFormState:y(t),formState:g,globalSlug:n,initialBlockFormState:g,operation:"update",schemaPath:C,signal:A.signal});return _||g},[S,s,i,a,t,n,C]);return I(()=>()=>{P(l.current)},[]),o===!1?null:O(M,{beforeSubmit:[x],disableValidationOnSubmit:!0,fields:Array.isArray(b)?b:[],initialState:o,onChange:[x],onSubmit:m,uuid:U(),children:[E(T,{fields:Array.isArray(b)?b:[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:C,permissions:!0,readOnly:!1}),E(v,{children:p("fields:saveChanges")})]})};var Ce=c=>{let e=V(15),{className:u,data:m,drawerSlug:r,drawerTitle:f,featureKey:d,fieldMapOverride:p,handleDrawerSubmit:s,schemaFieldsPathOverride:i,schemaPath:a,schemaPathSuffix:n}=c,{closeModal:t}=G(),l=f??"",o;e[0]!==t||e[1]!==r||e[2]!==s?(o=(w,S)=>{t(r),setTimeout(()=>{s(w,S)},1)},e[0]=t,e[1]=r,e[2]=s,e[3]=o):o=e[3];let h;return e[4]!==u||e[5]!==m||e[6]!==r||e[7]!==d||e[8]!==p||e[9]!==i||e[10]!==a||e[11]!==n||e[12]!==l||e[13]!==o?(h=R(z,{children:R(q,{className:u,slug:r,title:l,children:R(j,{data:m,featureKey:d,fieldMapOverride:p,handleDrawerSubmit:o,schemaFieldsPathOverride:i,schemaPath:a,schemaPathSuffix:n})})}),e[4]=u,e[5]=m,e[6]=r,e[7]=d,e[8]=p,e[9]=i,e[10]=a,e[11]=n,e[12]=l,e[13]=o,e[14]=h):h=e[14],h};import{c as J}from"react/compiler-runtime";import{jsx as K}from"react/jsx-runtime";import{useAuth as Q,useConfig as X,useEntityVisibility as Y}from"@payloadcms/ui";import*as D from"react";var Z=(c,e)=>c.filter(({slug:u,admin:{enableRichTextRelationship:m},upload:r})=>e?.visibleEntities?.collections.includes(u)?e?.uploads?m&&!!r:r?!1:m:!1),we=c=>{let e=J(12),{children:u,FallbackComponent:m,uploads:r,...f}=c,d=r===void 0?!1:r,{config:p}=X(),{collections:s}=p,{user:i}=Q(),{visibleEntities:a}=Y(),n;e[0]!==s||e[1]!==d||e[2]!==i||e[3]!==a?(n=()=>Z(s,{uploads:d,user:i,visibleEntities:a}).map(ee),e[0]=s,e[1]=d,e[2]=i,e[3]=a,e[4]=n):n=e[4];let[t]=D.useState(n);if(!t.length)return m?K(m,{...f}):null;let l;if(e[5]!==u||e[6]!==t||e[7]!==f){let o;e[9]!==t||e[10]!==f?(o={...f,enabledCollectionSlugs:t},e[9]=t,e[10]=f,e[11]=o):o=e[11],l=D.cloneElement(u,o),e[5]=u,e[6]=t,e[7]=f,e[8]=l}else l=e[8];return l};function ee(c){let{slug:e}=c;return e}import{createCommand as te}from"lexical";var Re=te("INSERT_UPLOAD_WITH_DRAWER_COMMAND");export{Ce as a,we as b,Re as c};
|
|
2
|
-
//# sourceMappingURL=chunk-CYLMY5ZJ.js.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
var nt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";import{c as ce}from"react/compiler-runtime";import{useRef as ae}from"react";function Un(n){let t=ce(2),e=n===void 0?500:n,o=ae(void 0),r;return t[0]!==e?(r=s=>new Promise(i=>{let a=()=>{s(),i()};"requestIdleCallback"in window?("cancelIdleCallback"in window&&o.current!==void 0&&cancelIdleCallback(o.current),o.current=requestIdleCallback(a,{timeout:e})):le().then(a)}),t[0]=e,t[1]=r):r=t[1],r}function le(){return new Promise(n=>{setTimeout(n,100),requestAnimationFrame(()=>{setTimeout(n,0)})})}var G=class{_x;_y;constructor(t,e){this._x=t,this._y=e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}equals({x:t,y:e}){return this.x===t&&this.y===e}get x(){return this._x}get y(){return this._y}};function ot(n){return n instanceof G}import{jsx as ye}from"react/jsx-runtime";import{useLexicalComposerContext as be}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ke}from"@lexical/utils";import{$getSelection as Y,$isRangeSelection as W,$isTextNode as Ae,COMMAND_PRIORITY_LOW as Oe,createCommand as Me,getDOMSelection as Le}from"lexical";import{useCallback as mt,useEffect as gt,useState as $e}from"react";import*as X from"react";import{c as at}from"react/compiler-runtime";import{useLexicalComposerContext as lt}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as rt}from"@lexical/utils";import{$getSelection as ft,$isRangeSelection as fe,$setSelection as ue,COMMAND_PRIORITY_LOW as N,createCommand as de,KEY_ARROW_DOWN_COMMAND as me,KEY_ARROW_UP_COMMAND as ge,KEY_ENTER_COMMAND as pe,KEY_ESCAPE_COMMAND as he,KEY_TAB_COMMAND as xe}from"lexical";import{useCallback as z,useEffect as y,useLayoutEffect as Ee,useMemo as _e,useRef as Te,useState as Se}from"react";var we="slash-menu-popup",it=n=>{let t=document.getElementById("slash-menu");if(!t)return;let e=t.getBoundingClientRect();e.top+e.height>window.innerHeight&&t.scrollIntoView({block:"center"}),e.top<0&&t.scrollIntoView({block:"center"}),n.scrollIntoView({block:"nearest"})};function Re(n,t,e){let o=e;for(let r=o;r<=t.length;r++)n.substring(n.length-r)===t.substring(0,r)&&(o=r);return o}function Ce(n){let t=ft();if(!fe(t)||!t.isCollapsed())return;let e=t.anchor;if(e.type!=="text")return;let o=e.getNode();if(!o.isSimpleText())return;let r=e.offset,c=o.getTextContent().slice(0,r),s=n.replaceableString.length,i=Re(c,n.matchingString,s),a=r-i;if(a<0)return;let l;return a===0?[l]=o.splitText(r):[,l]=o.splitText(a,r),l}function Fe(n,t){let e=getComputedStyle(n),o=e.position==="absolute",r=t?/(auto|scroll|hidden)/:/(auto|scroll)/;if(e.position==="fixed")return document.body;for(let c=n;c=c.parentElement;)if(e=getComputedStyle(c),!(o&&e.position==="static")&&r.test(e.overflow+e.overflowY+e.overflowX))return c;return document.body}function st(n,t){let e=n.getBoundingClientRect(),o=t.getBoundingClientRect();return e.top>o.top&&e.top<o.bottom}function Ie(n,t,e,o){let r=at(7),[c]=lt(),s,i;r[0]!==c||r[1]!==e||r[2]!==o||r[3]!==n||r[4]!==t?(s=()=>{let a=t.current;if(a!=null&&n!=null){let l=c.getRootElement(),u=l!=null?Fe(l,!1):document.body,g=!1,m=st(a,u),p=function(){g||(window.requestAnimationFrame(function(){e(),g=!1}),g=!0);let d=st(a,u);d!==m&&(m=d,o?.(d))},f=new ResizeObserver(e);return window.addEventListener("resize",e),document.addEventListener("scroll",p,{capture:!0,passive:!0}),f.observe(a),()=>{f.disconnect(),window.removeEventListener("resize",e),document.removeEventListener("scroll",p,!0)}}},i=[c,o,e,n,t],r[0]=c,r[1]=e,r[2]=o,r[3]=n,r[4]=t,r[5]=s,r[6]=i):(s=r[5],i=r[6]),y(s,i)}var ct=de("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function ut({anchorElementRef:n,close:t,editor:e,groups:o,menuRenderFn:r,resolution:c,shouldSplitNodeWithQuery:s=!1}){let[i,a]=Se(null),l=c.match&&c.match.matchingString||"",u=z(f=>{let d=e.getRootElement();d!==null&&(d.setAttribute("aria-activedescendant",`${we}__item-${f.key}`),a(f.key))},[e]),g=z(()=>{if(o!==null&&l!=null){let f=o.flatMap(d=>d.items);if(f.length){let d=f[0];u(d)}}},[o,u,l]);y(()=>{g()},[l,g]);let m=z(f=>{t(),e.update(()=>{let d=c.match!=null&&s?Ce(c.match):null;d&&d.remove()}),setTimeout(()=>{let d;e.read(()=>{d=ft()?.clone()}),e.update(()=>{d&&ue(d)}),f.onSelect({editor:e,queryString:c.match?c.match.matchingString:""})},0)},[e,s,c.match,t]);y(()=>()=>{let f=e.getRootElement();f!==null&&f.removeAttribute("aria-activedescendant")},[e]),Ee(()=>{o===null?a(null):i===null&&g()},[o,i,u,g]),y(()=>rt(e.registerCommand(ct,({item:f})=>f.ref&&f.ref.current!=null?(it(f.ref.current),!0):!1,N)),[e,u]),y(()=>rt(e.registerCommand(me,f=>{let d=f;if(o!==null&&o.length&&i!==null){let h=o.flatMap(T=>T.items),x=h.findIndex(T=>T.key===i),E=x!==h.length-1?x+1:0,_=h[E];if(!_)return!1;u(_),_.ref!=null&&_.ref.current&&e.dispatchCommand(ct,{index:E,item:_}),d.preventDefault(),d.stopImmediatePropagation()}return!0},N),e.registerCommand(ge,f=>{let d=f;if(o!==null&&o.length&&i!==null){let h=o.flatMap(T=>T.items),x=h.findIndex(T=>T.key===i),E=x!==0?x-1:h.length-1,_=h[E];if(!_)return!1;u(_),_.ref!=null&&_.ref.current&&it(_.ref.current),d.preventDefault(),d.stopImmediatePropagation()}return!0},N),e.registerCommand(he,f=>{let d=f;return d.preventDefault(),d.stopImmediatePropagation(),t(),!0},N),e.registerCommand(xe,f=>{let d=f;if(o===null||i===null)return!1;let x=o.flatMap(E=>E.items).find(E=>E.key===i);return x?(d.preventDefault(),d.stopImmediatePropagation(),m(x),!0):!1},N),e.registerCommand(pe,f=>{if(o===null||i===null)return!1;let h=o.flatMap(x=>x.items).find(x=>x.key===i);return h?(f!==null&&(f.preventDefault(),f.stopImmediatePropagation()),m(h),!0):!1},N)),[m,t,e,o,i,u]);let p=_e(()=>({groups:o,selectedItemKey:i,selectItemAndCleanUp:m,setSelectedItemKey:a}),[m,i,o]);return r(n,p,c.match?c.match.matchingString:"")}function Ne(n,t){t!=null&&(n.className=t),n.setAttribute("aria-label","Slash menu"),n.setAttribute("role","listbox"),n.style.display="block",n.style.position="absolute"}function dt(n,t,e,o){let r=at(14),[c]=lt(),s;r[0]===Symbol.for("react.memo_cache_sentinel")?(s=nt?document.createElement("div"):null,r[0]=s):s=r[0];let i=Te(s),a;r[1]!==n||r[2]!==o||r[3]!==c||r[4]!==t?(a=()=>{if(i.current===null||parent===void 0)return;let f=c.getRootElement(),d=i.current,h=d.firstChild;if(f!==null&&t!==null){let{height:x,width:E}=t.getRect(),{left:_,top:T}=t.getRect(),I=T;if(T=T-(n.getBoundingClientRect().top+window.scrollY),_=_-(n.getBoundingClientRect().left+window.scrollX),d.style.left=`${_+window.scrollX}px`,d.style.height=`${x}px`,d.style.width=`${E}px`,h!==null){let S=h.getBoundingClientRect(),$=S.height,C=S.width,et=f.getBoundingClientRect();_+C>et.right&&(d.style.left=`${et.right-C+window.scrollX}px`);let ie=I+$+32>window.innerHeight,se=I<0;ie&&!se?d.style.top=`${T+32-$+window.scrollY-(x+24)}px`:d.style.top=`${T+window.scrollY+32}px`}d.isConnected||(Ne(d,o),n.append(d)),d.setAttribute("id","slash-menu"),i.current=d,f.setAttribute("aria-controls","slash-menu")}},r[1]=n,r[2]=o,r[3]=c,r[4]=t,r[5]=a):a=r[5];let l=a,u,g;r[6]!==c||r[7]!==l||r[8]!==t?(u=()=>{let f=c.getRootElement();if(t!==null)return l(),()=>{f!==null&&f.removeAttribute("aria-controls");let d=i.current;d!==null&&d.isConnected&&(d.remove(),d.removeAttribute("id"))}},g=[c,l,t],r[6]=c,r[7]=l,r[8]=t,r[9]=u,r[10]=g):(u=r[9],g=r[10]),y(u,g);let m;return r[11]!==t||r[12]!==e?(m=f=>{t!==null&&(f||e(null))},r[11]=t,r[12]=e,r[13]=m):m=r[13],Ie(t,i,l,m),i}var ro=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function De(n){let t=n.anchor;if(t.type!=="text")return null;let e=t.getNode();if(!e.isSimpleText())return null;let o=t.offset;return e.getTextContent().slice(0,o)}function pt(n,t,e){let o=Le(e);if(o===null||!o.isCollapsed)return!1;let r=o.anchorNode,c=n,s=o.anchorOffset;if(r==null||s==null)return!1;try{t.setStart(r,c),t.setEnd(r,s>1?s:1)}catch{return!1}return!0}function Be(n){let t;return n.getEditorState().read(()=>{let e=Y();W(e)&&(t=De(e))}),t}function ht(n,t){return t!==0?!1:n.getEditorState().read(()=>{let e=Y();if(W(e)){let c=e.anchor.getNode().getPreviousSibling();return Ae(c)&&c.isTextEntity()}return!1})}function xt(n){X.startTransition?X.startTransition(n):n()}var Pe=Me("ENABLE_SLASH_MENU_COMMAND");function io({anchorClassName:n,anchorElem:t,groups:e,menuRenderFn:o,onClose:r,onOpen:c,onQueryChange:s,triggerFn:i}){let[a]=be(),[l,u]=$e(null),g=dt(t,l,u,n),m=mt(()=>{u(null),r!=null&&l!==null&&r()},[r,l]),p=mt(f=>{u(f),c!=null&&l===null&&c(f)},[c,l]);return gt(()=>ke(a.registerCommand(Pe,({node:f})=>(a.getEditorState().read(()=>{let d={leadOffset:0,matchingString:"",replaceableString:""};if(!ht(a,d.leadOffset)&&f!==null){let h=a._window??window,x=h.document.createRange();pt(d.leadOffset,x,h)!==null&&xt(()=>p({getRect:()=>x.getBoundingClientRect(),match:d}));return}}),!0),Oe)),[a,p]),gt(()=>{let f=()=>{a.getEditorState().read(()=>{let h=a._window??window,x=h.document.createRange(),E=Y(),_=Be(a);if(!W(E)||!E.isCollapsed()||_===void 0||x===null){m();return}let T=i({editor:a,query:_});if(s(T?T.matchingString:null),T!==null&&!ht(a,T.leadOffset)&&pt(T.leadOffset,x,h)!==null){xt(()=>p({getRect:()=>x.getBoundingClientRect(),match:T}));return}m()})},d=a.registerUpdateListener(f);return()=>{d()}},[a,i,s,l,m,p]),g.current===null||l===null||a===null?null:ye(ut,{anchorElementRef:g,close:m,editor:a,groups:e,menuRenderFn:o,resolution:l,shouldSplitNodeWithQuery:!0})}var Et=class n{_bottom;_left;_right;_top;constructor(t,e,o,r){let[c,s]=e<=r?[e,r]:[r,e],[i,a]=t<=o?[t,o]:[o,t];this._top=c,this._right=a,this._left=i,this._bottom=s}static fromDOM(t){let{height:e,left:o,top:r,width:c}=t.getBoundingClientRect();return n.fromLWTH(o,c,r,e)}static fromDOMRect(t){let{height:e,left:o,top:r,width:c}=t;return n.fromLWTH(o,c,r,e)}static fromLTRB(t,e,o,r){return new n(t,e,o,r)}static fromLWTH(t,e,o,r){return new n(t,o,t+e,o+r)}static fromPoints(t,e){let{x:o,y:r}=t,{x:c,y:s}=e;return n.fromLTRB(o,r,c,s)}contains(t){if(ot(t)){let{x:s,y:i}=t,a=i<this._top,l=i>this._bottom,u=s<this._left,g=s>this._right;return{reason:{isOnBottomSide:l,isOnLeftSide:u,isOnRightSide:g,isOnTopSide:a},result:!a&&!l&&!u&&!g}}let{bottom:e,left:o,right:r,top:c}=t;return c>=this._top&&c<=this._bottom&&e>=this._top&&e<=this._bottom&&o>=this._left&&o<=this._right&&r>=this._left&&r<=this._right}distanceFromPoint(t){let e=this.contains(t);if(e.result)return{distance:0,isOnBottomSide:e.reason.isOnBottomSide,isOnLeftSide:e.reason.isOnLeftSide,isOnRightSide:e.reason.isOnRightSide,isOnTopSide:e.reason.isOnTopSide};let o=0,r=0;return t.x<this._left?o=this._left-t.x:t.x>this._right&&(o=t.x-this._right),t.y<this._top?r=this._top-t.y:t.y>this._bottom&&(r=t.y-this._bottom),{distance:Math.sqrt(o*o+r*r),isOnBottomSide:t.y>this._bottom,isOnLeftSide:t.x<this._left,isOnRightSide:t.x>this._right,isOnTopSide:t.y<this._top}}equals({bottom:t,left:e,right:o,top:r}){return r===this._top&&t===this._bottom&&e===this._left&&o===this._right}generateNewRect({bottom:t=this.bottom,left:e=this.left,right:o=this.right,top:r=this.top}){return new n(e,r,o,t)}intersectsWith(t){let{height:e,left:o,top:r,width:c}=t,{height:s,left:i,top:a,width:l}=this,u=o+c>=i+l?o+c:i+l,g=r+e>=a+s?r+e:a+s,m=o<=i?o:i,p=r<=a?r:a;return u-m<=c+l&&g-p<=e+s}get bottom(){return this._bottom}get height(){return Math.abs(this._bottom-this._top)}get left(){return this._left}get right(){return this._right}get top(){return this._top}get width(){return Math.abs(this._left-this._right)}};function lo({editorConfig:n}){return ve({nodes:n.features.nodes})}function ve({nodes:n}){return n.map(t=>"node"in t?t.node:t)}import{$getRoot as qe,$isDecoratorNode as Rt,$isElementNode as P,$isLineBreakNode as Qe,$isTextNode as v}from"lexical";import{$isListItemNode as He,$isListNode as _t}from"@lexical/list";import{$isHeadingNode as Ke,$isQuoteNode as Ue}from"@lexical/rich-text";import{$isParagraphNode as Ge,$isTextNode as ze}from"lexical";var w={markdownFormatKind:null,regEx:/(?:)/,regExForAutoFormatting:/(?:)/,requiresParagraphStart:!1},R={...w,requiresParagraphStart:!0},po={...R,export:b(1),markdownFormatKind:"paragraphH1",regEx:/^# /,regExForAutoFormatting:/^# /},ho={...R,export:b(2),markdownFormatKind:"paragraphH2",regEx:/^## /,regExForAutoFormatting:/^## /},xo={...R,export:b(3),markdownFormatKind:"paragraphH3",regEx:/^### /,regExForAutoFormatting:/^### /},Eo={...R,export:b(4),markdownFormatKind:"paragraphH4",regEx:/^#### /,regExForAutoFormatting:/^#### /},_o={...R,export:b(5),markdownFormatKind:"paragraphH5",regEx:/^##### /,regExForAutoFormatting:/^##### /},To={...R,export:b(6),markdownFormatKind:"paragraphH6",regEx:/^###### /,regExForAutoFormatting:/^###### /},So={...R,export:Ye,markdownFormatKind:"paragraphBlockQuote",regEx:/^> /,regExForAutoFormatting:/^> /},wo={...R,export:q,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})- /,regExForAutoFormatting:/^(\s{0,10})- /},Ro={...R,export:q,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})\* /,regExForAutoFormatting:/^(\s{0,10})\* /},Co={...R,export:q,markdownFormatKind:"paragraphOrderedList",regEx:/^(\s{0,10})(\d+)\.\s/,regExForAutoFormatting:/^(\s{0,10})(\d+)\.\s/},Fo={...R,markdownFormatKind:"horizontalRule",regEx:/^\*\*\*$/,regExForAutoFormatting:/^\*\*\* /},Io={...R,markdownFormatKind:"horizontalRule",regEx:/^---$/,regExForAutoFormatting:/^--- /},No={...w,exportFormat:"code",exportTag:"`",markdownFormatKind:"code",regEx:/(`)(\s*)([^`]*)(\s*)(`)()/,regExForAutoFormatting:/(`)(\s*\b)([^`]*)(\b\s*)(`)(\s)$/},yo={...w,exportFormat:"bold",exportTag:"**",markdownFormatKind:"bold",regEx:/(\*\*)(\s*)([^*]*)(\s*)(\*\*)()/,regExForAutoFormatting:/(\*\*)(\s*\b)([^*]*)(\b\s*)(\*\*)(\s)$/},bo={...w,exportFormat:"italic",exportTag:"*",markdownFormatKind:"italic",regEx:/(\*)(\s*)([^*]*)(\s*)(\*)()/,regExForAutoFormatting:/(\*)(\s*\b)([^*]*)(\b\s*)(\*)(\s)$/},ko={...w,exportFormat:"bold",exportTag:"_",markdownFormatKind:"bold",regEx:/(__)(\s*)([^_]*)(\s*)(__)()/,regExForAutoFormatting:/(__)(\s*)([^_]*)(\s*)(__)(\s)$/},Ao={...w,exportFormat:"italic",exportTag:"_",markdownFormatKind:"italic",regEx:/(_)()([^_]*)()(_)()/,regExForAutoFormatting:/(_)()([^_]*)()(_)(\s)$/},Oo={...w,exportFormat:"underline",exportTag:"<u>",exportTagClose:"</u>",markdownFormatKind:"underline",regEx:/(<u>)(\s*)([^<]*)(\s*)(<\/u>)()/,regExForAutoFormatting:/(<u>)(\s*\b)([^<]*)(\b\s*)(<\/u>)(\s)$/},Mo={...w,exportFormat:"strikethrough",exportTag:"~~",markdownFormatKind:"strikethrough",regEx:/(~~)(\s*)([^~]*)(\s*)(~~)()/,regExForAutoFormatting:/(~~)(\s*\b)([^~]*)(\b\s*)(~~)(\s)$/},Lo={...w,markdownFormatKind:"strikethrough_italic_bold",regEx:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)()/,regExForAutoFormatting:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)(\s)$/},$o={...w,markdownFormatKind:"italic_bold",regEx:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)/,regExForAutoFormatting:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)(\s)$/},Do={...w,markdownFormatKind:"strikethrough_italic",regEx:/(~~_)(\s*)([^_~]+)(\s*)(_~~)/,regExForAutoFormatting:/(~~_)(\s*)([^_~]+)(\s*)(_~~)(\s)$/},Bo={...w,markdownFormatKind:"strikethrough_bold",regEx:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)/,regExForAutoFormatting:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)(\s)$/},Po={...w,markdownFormatKind:"link",regEx:/(\[)([^\]]*)(\]\()([^)]*)(\)*)()/,regExForAutoFormatting:/(\[)([^\]]*)(\]\()([^)]*)(\)*)(\s)$/};function b(n){return(t,e)=>Ke(t)&&t.getTag()==="h"+n?"#".repeat(n)+" "+e(t):null}function q(n,t){return _t(n)?Tt(n,t,0):null}var Xe=4;function Tt(n,t,e){let o=[],r=n.getChildren(),c=0;for(let s of r)if(He(s)){if(s.getChildrenSize()===1){let l=s.getFirstChild();if(_t(l)){o.push(Tt(l,t,e+1));continue}}let i=" ".repeat(e*Xe),a=n.getListType()==="bullet"?"- ":`${n.getStart()+c}. `;o.push(i+a+t(s)),c++}return o.join(`
|
|
2
|
-
`)}function Ye(n,t){return Ue(n)?"> "+t(n):null}function D(n,t){let e={};for(let o of n){let r=t(o);r&&(e[r]?e[r].push(o):e[r]=[o])}return e}function k(n){let t=D(n,e=>e.type);return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}var A=/[!-/:-@[-`{-~\s]/,We=/^\s{0,3}$/;function L(n){if(!Ge(n))return!1;let t=n.getFirstChild();return t==null||n.getChildrenSize()===1&&ze(t)&&We.test(t.getTextContent())}function Ct(n,t=!1){let e=k(n),o=[...e.multilineElement,...e.element],r=!t,c=e.textFormat.filter(s=>s.format.length===1).sort((s,i)=>s.format.includes("code")&&!i.format.includes("code")?1:!s.format.includes("code")&&i.format.includes("code")?-1:0);return s=>{let i=[],a=(s||qe()).getChildren();return a.forEach((l,u)=>{let g=je(l,o,c,e.textMatch);g!=null&&i.push(r&&u>0&&!L(l)&&!L(a[u-1])?`
|
|
3
|
-
`.concat(g):g)}),i.join(`
|
|
4
|
-
`)}}function je(n,t,e,o){for(let r of t){if(!r.export)continue;let c=r.export(n,s=>H(s,e,o));if(c!=null)return c}return P(n)?H(n,e,o):Rt(n)?n.getTextContent():null}function H(n,t,e,o,r){let c=[],s=n.getChildren();o||(o=[]),r||(r=[]);t:for(let i of s){for(let a of e){if(!a.export)continue;let l=a.export(i,u=>H(u,t,e,o,[...r,...o]),(u,g)=>St(u,g,t,o,r));if(l!=null){c.push(l);continue t}}Qe(i)?c.push(`
|
|
5
|
-
`):v(i)?c.push(St(i,i.getTextContent(),t,o,r)):P(i)?c.push(H(i,t,e,o,r)):Rt(i)&&c.push(i.getTextContent())}return c.join("")}function St(n,t,e,o,r){let c=t.trim(),s=c;n.hasFormat("code")||(s=s.replace(/([*_`~\\])/g,"\\$1"));let i="",a="",l="",u=wt(n,!0),g=wt(n,!1),m=new Set;for(let p of e){let f=p.format[0],d=p.tag;B(n,f)&&!m.has(f)&&(m.add(f),(!B(u,f)||!o.find(h=>h.tag===d))&&(o.push({format:f,tag:d}),i+=d))}for(let p=0;p<o.length;p++){let f=o[p],d=B(n,f.format),h=B(g,f.format);if(d&&h)continue;let x=[...o];for(;x.length>p;){let E=x.pop();r&&E&&r.find(_=>_.tag===E.tag)||(E&&typeof E.tag=="string"&&(d?h||(l+=E.tag):a+=E.tag),o.pop())}break}return s=i+s+l,a+t.replace(c,()=>s)}function wt(n,t){let e=t?n.getPreviousSibling():n.getNextSibling();if(!e){let o=n.getParentOrThrow();o.isInline()&&(e=t?o.getPreviousSibling():o.getNextSibling())}for(;e;){if(P(e)){if(!e.isInline())break;let o=t?e.getLastDescendant():e.getFirstDescendant();if(v(o))return o;e=t?e.getPreviousSibling():e.getNextSibling()}if(v(e))return e;if(!P(e))return null}return null}function B(n,t){return v(n)&&n.hasFormat(t)}import{$isListItemNode as Ze,$isListNode as bt}from"@lexical/list";import{$isQuoteNode as Je}from"@lexical/rich-text";import{$findMatchingParent as tn}from"@lexical/utils";import{$createLineBreakNode as en,$createParagraphNode as nn,$createTextNode as on,$getRoot as rn,$getSelection as sn,$isParagraphNode as cn}from"lexical";import{$isTextNode as O}from"lexical";function Ft(n,t){let e=n.getTextContent(),o=Ve(e,t);if(!o)return null;let r=o.index||0,c=r+o[0].length,s=t.transformersByTag[o[1]];return{endIndex:c,match:o,startIndex:r,transformer:s}}function Ve(n,t){let e=n.match(t.openTagsRegExp);if(e==null)return null;for(let o of e){let r=o.replace(/^\s/,""),c=t.fullMatchRegExpByTag[r];if(c==null)continue;let s=n.match(c),i=t.transformersByTag[r];if(s!=null&&i!=null){if(i.intraword!==!1)return s;let{index:a=0}=s,l=n[a-1],u=n[a+s[0].length];if((!l||A.test(l))&&(!u||A.test(u)))return s}}return null}function It(n,t,e,o,r){let c=n.getTextContent(),s,i,a;if(r[0]===c?a=n:t===0?[a,s]=n.splitText(e):[i,a,s]=n.splitText(t,e),a.setTextContent(r[2]),o)for(let l of o.format)a.hasFormat(l)||a.toggleFormat(l);return{nodeAfter:s,nodeBefore:i,transformedNode:a}}function Nt(n,t){let e=n,o,r,c,s;for(let i of t){if(!i.replace||!i.importRegExp)continue;let a=e.getTextContent().match(i.importRegExp);if(!a)continue;let l=a.index||0,u=i.getEndIndex?i.getEndIndex(e,a):l+a[0].length;u!==!1&&(o===void 0||r===void 0||l<o&&u>r)&&(o=l,r=u,c=i,s=a)}return o===void 0||r===void 0||c===void 0||s===void 0?null:{endIndex:r,match:s,startIndex:o,transformer:c}}function yt(n,t,e,o,r){let c,s,i;if(t===0?[i,c]=n.splitText(e):[s,i,c]=n.splitText(t,e),!o.replace)return null;let a=i?o.replace(i,r):void 0;return{nodeAfter:c,nodeBefore:s,transformedNode:a||void 0}}function F(n,t,e){let o=Ft(n,t),r=Nt(n,e);if(o&&r&&(o.startIndex<=r.startIndex&&o.endIndex>=r.endIndex?r=null:o=null),o){let i=It(n,o.startIndex,o.endIndex,o.transformer,o.match);i.nodeAfter&&O(i.nodeAfter)&&!i.nodeAfter.hasFormat("code")&&F(i.nodeAfter,t,e),i.nodeBefore&&O(i.nodeBefore)&&!i.nodeBefore.hasFormat("code")&&F(i.nodeBefore,t,e),i.transformedNode&&O(i.transformedNode)&&!i.transformedNode.hasFormat("code")&&F(i.transformedNode,t,e)}else if(r){let i=yt(n,r.startIndex,r.endIndex,r.transformer,r.match);if(!i)return;i.nodeAfter&&O(i.nodeAfter)&&!i.nodeAfter.hasFormat("code")&&F(i.nodeAfter,t,e),i.nodeBefore&&O(i.nodeBefore)&&!i.nodeBefore.hasFormat("code")&&F(i.nodeBefore,t,e),i.transformedNode&&O(i.transformedNode)&&!i.transformedNode.hasFormat("code")&&F(i.transformedNode,t,e)}let s=n.getTextContent().replace(/\\([*_`~])/g,"$1");n.setTextContent(s)}function kt(n,t=!1){let e=k(n),o=fn(e.textFormat);return(r,c)=>{let s=r.split(`
|
|
6
|
-
`),i=s.length,a=c||rn();a.clear();for(let u=0;u<i;u++){let g=s[u],[m,p]=an(s,u,e.multilineElement,a);if(m){u=p;continue}ln(g,a,e.element,o,e.textMatch)}let l=a.getChildren();for(let u of l)!t&&L(u)&&a.getChildrenSize()>1&&u.remove();sn()!==null&&a.selectStart()}}function an(n,t,e,o){for(let r of e){let{handleImportAfterStartMatch:c,regExpEnd:s,regExpStart:i,replace:a}=r,l=n[t]?.match(i);if(!l)continue;if(c){let f=c({lines:n,rootNode:o,startLineIndex:t,startMatch:l,transformer:r});if(f===null)continue;if(f)return f}let u=typeof s=="object"&&"regExp"in s?s.regExp:s,g=s&&typeof s=="object"&&"optional"in s?s.optional:!s,m=t,p=n.length;for(;m<p;){let f=u?n[m]?.match(u):null;if(!f&&(!g||g&&m<p-1)){m++;continue}if(f&&t===m&&f.index===l.index){m++;continue}let d=[];if(f&&t===m)d.push(n[t].slice(l[0].length,-f[0].length));else for(let h=t;h<=m;h++){let x=n[h];if(h===t){let E=x.slice(l[0].length);d.push(E)}else if(h===m&&f){let E=x.slice(0,-f[0].length);d.push(E)}else d.push(x)}if(a(o,null,l,f,d,!0)!==!1)return[!0,m];break}}return[!1,t]}function ln(n,t,e,o,r){let c=on(n),s=nn();s.append(c),t.append(s);for(let{regExp:i,replace:a}of e){let l=n.match(i);if(l&&(c.setTextContent(n.slice(l[0].length)),a(s,[c],l,!0)!==!1))break}if(F(c,o,r),s.isAttached()&&n.length>0){let i=s.getPreviousSibling();if(cn(i)||Je(i)||bt(i)){let a=i;if(bt(i)){let l=i.getLastDescendant();l==null?a=null:a=tn(l,Ze)}a!=null&&a.getTextContentSize()>0&&(a.splice(a.getChildrenSize(),0,[en(),...s.getChildren()]),s.remove())}}}function fn(n){let t={},e={},o=[],r="(?<![\\\\])";for(let c of n){let{tag:s}=c;t[s]=c;let i=s.replace(/([*^+])/g,"\\$1");o.push(i),s.length===1?e[s]=new RegExp(`(?<![\\\\${i}])(${i})((\\\\${i})?.*?[^${i}\\s](\\\\${i})?)((?<!\\\\)|(?<=\\\\\\\\))(${i})(?![\\\\${i}])`):e[s]=new RegExp(`(?<!\\\\)(${i})((\\\\${i})?.*?[^\\s](\\\\${i})?)((?<!\\\\)|(?<=\\\\\\\\))(${i})(?!\\\\)`)}return{fullMatchRegExpByTag:e,openTagsRegExp:new RegExp(`${r}(${o.join("|")})`,"g"),transformersByTag:t}}import{$createRangeSelection as un,$getSelection as Q,$isLineBreakNode as dn,$isRangeSelection as j,$isRootOrShadowRoot as Ot,$isTextNode as Mt,$setSelection as mn}from"lexical";function gn(n,t,e,o){let r=n.getParent();if(!Ot(r)||n.getFirstChild()!==t)return!1;let c=t.getTextContent();if(c[e-1]!==" ")return!1;for(let{regExp:s,replace:i}of o){let a=c.match(s);if(a&&a[0].length===(a[0].endsWith(" ")?e:e-1)){let l=t.getNextSiblings(),[u,g]=t.splitText(e);u?.remove();let m=g?[g,...l]:l;if(i(n,m,a,!1)!==!1)return!0}}return!1}function pn(n,t,e,o){let r=n.getParent();if(!Ot(r)||n.getFirstChild()!==t)return!1;let c=t.getTextContent();if(c[e-1]!==" ")return!1;for(let{regExpEnd:s,regExpStart:i,replace:a}of o){if(s&&!("optional"in s)||s&&"optional"in s&&!s.optional)continue;let l=c.match(i);if(l&&l[0].length===(l[0].endsWith(" ")?e:e-1)){let u=t.getNextSiblings(),[g,m]=t.splitText(e);g?.remove();let p=m?[m,...u]:u;if(a(n,p,l,null,null,!1)!==!1)return!0}}return!1}function hn(n,t,e){let o=n.getTextContent(),r=o[t-1],c=e[r];if(c==null)return!1;t<o.length&&(o=o.slice(0,t));for(let s of c){if(!s.replace||!s.regExp)continue;let i=o.match(s.regExp);if(i===null)continue;let a=i.index||0,l=a+i[0].length,u;return a===0?[u]=n.splitText(l):[,u]=n.splitText(a,l),u&&(u.selectNext(0,0),s.replace(u,i)),!0}return!1}function xn(n,t,e){let o=n.getTextContent(),r=t-1,c=o[r],s=e[c];if(!s)return!1;for(let i of s){let{tag:a}=i,l=a.length,u=r-l+1;if(l>1&&!Lt(o,u,a,0,l)||o[u-1]===" ")continue;let g=o[r+1];if(i.intraword===!1&&g&&!A.test(g))continue;let m=n,p=m,f=At(o,u,a),d=p;for(;f<0&&(d=d.getPreviousSibling())&&!dn(d);)if(Mt(d)){let C=d.getTextContent();p=d,f=At(C,C.length,a)}if(f<0||p===m&&f+l===u)continue;let h=p.getTextContent();if(f>0&&h[f-1]===c)continue;let x=h[f-1];if(i.intraword===!1&&x&&!A.test(x))continue;let E=m.getTextContent(),_=E.slice(0,u)+E.slice(r+1);m.setTextContent(_);let T=p===m?_:h;p.setTextContent(T.slice(0,f)+T.slice(f+l));let I=Q(),S=un();mn(S);let $=r-l*(p===m?2:1)+1;S.anchor.set(p.__key,f,"text"),S.focus.set(m.__key,$,"text");for(let C of i.format)S.hasFormat(C)||S.formatText(C);S.anchor.set(S.focus.key,S.focus.offset,S.focus.type);for(let C of i.format)S.hasFormat(C)&&S.toggleFormat(C);return j(I)&&(S.format=I.format),!0}return!1}function At(n,t,e){let o=e.length;for(let r=t;r>=o;r--){let c=r-o;if(Lt(n,c,e,0,o)&&n[c+o]!==" ")return c}return-1}function Lt(n,t,e,o,r){for(let c=0;c<r;c++)if(n[t+c]!==e[o+c])return!1;return!0}function sr(n,t=K){let e=k(t),o=D(e.textFormat,({tag:s})=>s[s.length-1]),r=D(e.textMatch,({trigger:s})=>s);for(let s of t){let i=s.type;if(i==="element"||i==="text-match"||i==="multiline-element"){let a=s.dependencies;for(let l of a)if(!n.hasNode(l))throw new Error("MarkdownShortcuts: missing dependency %s for transformer. Ensure node dependency is included in editor initial config."+l.getType())}}let c=(s,i,a)=>{gn(s,i,a,e.element)||pn(s,i,a,e.multilineElement)||hn(i,a,r)||xn(i,a,o)};return n.registerUpdateListener(({dirtyLeaves:s,editorState:i,prevEditorState:a,tags:l})=>{if(l.has("collaboration")||l.has("historic")||n.isComposing())return;let u=i.read(Q),g=a.read(Q);if(!j(g)||!j(u)||!u.isCollapsed()||u.is(g))return;let m=u.anchor.key,p=u.anchor.offset,f=i._nodeMap.get(m);!Mt(f)||!s.has(m)||p!==1&&p>g.anchor.offset+1||n.update(()=>{if(f.hasFormat("code"))return;let d=f.getParent();d!==null&&c(d,f,u.anchor.offset)})})}import{$createListItemNode as En,$createListNode as _n,$isListItemNode as Tn,$isListNode as M,ListItemNode as Z,ListNode as J}from"@lexical/list";import{$createHeadingNode as Sn,$createQuoteNode as wn,$isHeadingNode as Rn,$isQuoteNode as $t,HeadingNode as Cn,QuoteNode as Fn}from"@lexical/rich-text";import{$createLineBreakNode as In}from"lexical";var Dt=/^[\t ]*$/,Ht=/^(\s*)(\d+)\.\s/,Kt=/^(\s*)[-*+]\s/,Ut=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,V=/^(#{1,6})\s/,Gt=/^>\s/,Nn=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,Bt=/[ \t]*(\\`\\`\\`|```)$/,yn=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,bn=/^\|(.+)\|\s?$/,kn=/^(\| ?:?-*:? ?)+\|\s?$/,Pt=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,vt=/^[ \t]*<\/[a-z_][\w-]*\s*>/i,An=n=>(t,e,o)=>{let r=n(o);r.append(...e),t.replace(r),r.select(0,0)},zt=4;function On(n){let t=n.match(/\t/g),e=n.match(/ /g),o=0;return t&&(o+=t.length),e&&(o+=Math.floor(e.length/zt)),o}var tt=n=>(t,e,o)=>{let r=t.getPreviousSibling(),c=t.getNextSibling(),s=En(n==="check"?o[3]==="x":void 0);if(M(c)&&c.getListType()===n){let a=c.getFirstChild();a!==null?a.insertBefore(s):c.append(s),t.remove()}else if(M(r)&&r.getListType()===n)r.append(s),t.remove();else{let a=_n(n,n==="number"?Number(o[2]):void 0);a.append(s),t.replace(a)}s.append(...e),s.select(0,0);let i=On(o[1]);i&&s.setIndent(i)},U=(n,t,e)=>{let o=[],r=n.getChildren(),c=0;for(let s of r)if(Tn(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(M(u)){o.push(U(u,t,e+1));continue}}let i=" ".repeat(e*zt),a=n.getListType(),l=a==="number"?`${n.getStart()+c}. `:a==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";o.push(i+l+t(s)),c++}return o.join(`
|
|
7
|
-
`)},Xt={type:"element",dependencies:[Cn],export:(n,t)=>{if(!Rn(n))return null;let e=Number(n.getTag().slice(1));return"#".repeat(e)+" "+t(n)},regExp:V,replace:An(n=>{let t="h"+n[1].length;return Sn(t)})},Yt={type:"element",dependencies:[Fn],export:(n,t)=>{if(!$t(n))return null;let e=t(n).split(`
|
|
8
|
-
`),o=[];for(let r of e)o.push("> "+r);return o.join(`
|
|
9
|
-
`)},regExp:Gt,replace:(n,t,e,o)=>{if(o){let c=n.getPreviousSibling();if($t(c)){c.splice(c.getChildrenSize(),0,[In(),...t]),c.select(0,0),n.remove();return}}let r=wn();r.append(...t),n.replace(r),r.select(0,0)}},Wt={type:"element",dependencies:[J,Z],export:(n,t)=>M(n)?U(n,t,0):null,regExp:Kt,replace:tt("bullet")},Mn={type:"element",dependencies:[J,Z],export:(n,t)=>M(n)?U(n,t,0):null,regExp:Ut,replace:tt("check")},qt={type:"element",dependencies:[J,Z],export:(n,t)=>M(n)?U(n,t,0):null,regExp:Ht,replace:tt("number")},Qt={type:"text-format",format:["code"],tag:"`"},jt={type:"text-format",format:["highlight"],tag:"=="},Vt={type:"text-format",format:["bold","italic"],tag:"***"},Zt={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Jt={type:"text-format",format:["bold"],tag:"**"},te={type:"text-format",format:["bold"],intraword:!1,tag:"__"},ee={type:"text-format",format:["strikethrough"],tag:"~~"},ne={type:"text-format",format:["italic"],tag:"*"},oe={type:"text-format",format:["italic"],intraword:!1,tag:"_"};function re(n,t){let e=n.split(`
|
|
10
|
-
`),o=!1,r=[],c=0;for(let s=0;s<e.length;s++){let i=e[s],a=r[r.length-1];if(yn.test(i)){r.push(i);continue}if(Bt.test(i)){c===0&&(o=!0),c===1&&(o=!1),c>0&&c--,r.push(i);continue}if(Nn.test(i)){o=!0,c++,r.push(i);continue}if(o){r.push(i);continue}Dt.test(i)||Dt.test(a)||!a||V.test(a)||V.test(i)||Gt.test(i)||Ht.test(i)||Kt.test(i)||Ut.test(i)||bn.test(i)||kn.test(i)||!t||Pt.test(i)||vt.test(i)||Pt.test(a)||vt.test(a)||Bt.test(a)?r.push(i):r[r.length-1]=a+" "+i.trim()}return r.join(`
|
|
11
|
-
`)}var Ln=[Xt,Yt,Wt,qt],$n=[],Dn=[Qt,Vt,Zt,Jt,te,jt,ne,oe,ee],Bn=[],K=[...Ln,...$n,...Dn,...Bn];function pr(n,t=K,e,o=!1,r=!0){let c=o?n:re(n,r);return kt(t,o)(c,e)}function hr(n=K,t,e=!1){return Ct(n,e)(t)}export{nt as a,Un as b,sr as c,pr as d,hr as e,G as f,ot as g,ro as h,Pe as i,io as j,Et as k,lo as l};
|
|
12
|
-
//# sourceMappingURL=chunk-YCH4JNUH.js.map
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type ServerFunction } from 'payload';
|
|
2
|
-
import { type DefaultTypedEditorState, type LexicalFieldAdminProps } from '../../index.js';
|
|
3
|
-
export type RenderLexicalServerFunctionArgs = {
|
|
4
|
-
admin?: LexicalFieldAdminProps;
|
|
5
|
-
/**
|
|
6
|
-
* {global|collection}.entitySlug.fieldSchemaPath
|
|
7
|
-
*
|
|
8
|
-
* @example collection.posts.richText
|
|
9
|
-
*/
|
|
10
|
-
editorTarget: string;
|
|
11
|
-
/**
|
|
12
|
-
* Pass the value this richtext field will receive when rendering it on the server.
|
|
13
|
-
* This helps provide initial state for sub-fields that are immediately rendered (like blocks)
|
|
14
|
-
* so that we can avoid multiple waterfall requests for each block that renders on the client.
|
|
15
|
-
*/
|
|
16
|
-
initialValue?: DefaultTypedEditorState;
|
|
17
|
-
/**
|
|
18
|
-
* Name of the field to render
|
|
19
|
-
*/
|
|
20
|
-
name: string;
|
|
21
|
-
/**
|
|
22
|
-
* Path to the field to render
|
|
23
|
-
* @default field name
|
|
24
|
-
*/
|
|
25
|
-
path?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Schema path to the field to render.
|
|
28
|
-
*/
|
|
29
|
-
schemaPath: string;
|
|
30
|
-
};
|
|
31
|
-
export type RenderLexicalServerFunctionReturnType = {
|
|
32
|
-
Component: React.ReactNode;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* @experimental - may break in minor releases
|
|
36
|
-
*/
|
|
37
|
-
export declare const _internal_renderLexical: ServerFunction<RenderLexicalServerFunctionArgs, Promise<RenderLexicalServerFunctionReturnType>>;
|
|
38
|
-
//# sourceMappingURL=renderLexical.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderLexical.d.ts","sourceRoot":"","sources":["../../../src/field/RenderLexical/renderLexical.tsx"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,SAAS,CAAA;AAEhB,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAG5B,MAAM,gBAAgB,CAAA;AAEvB,MAAM,MAAM,+BAA+B,GAAG;IAC5C,KAAK,CAAC,EAAE,sBAAsB,CAAA;IAC9B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AACD,MAAM,MAAM,qCAAqC,GAAG;IAAE,SAAS,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAA;AAElF;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,cAAc,CAClD,+BAA+B,EAC/B,OAAO,CAAC,qCAAqC,CAAC,CAgG/C,CAAA"}
|