@payloadcms/richtext-lexical 3.2.2 → 3.2.3-canary.3e78927
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-JP7H7AZE.js → Field-KHGUSLMB.js} +2 -2
- package/dist/exports/client/{Field-JP7H7AZE.js.map → Field-KHGUSLMB.js.map} +2 -2
- package/dist/exports/client/{RelationshipComponent-XOQBVKA3.js → RelationshipComponent-F77EQHRG.js} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-4J2ONJMB.js +2 -0
- package/dist/exports/client/chunk-4J2ONJMB.js.map +7 -0
- package/dist/exports/client/{chunk-XCEM47RI.js → chunk-AXXPUMFU.js} +2 -2
- package/dist/exports/client/{chunk-5PBXL4HT.js → chunk-F26IQ5RE.js} +2 -2
- package/dist/exports/client/{chunk-5PBXL4HT.js.map → chunk-F26IQ5RE.js.map} +1 -1
- package/dist/exports/client/chunk-H3D3IU3G.js +2 -0
- package/dist/exports/client/{chunk-DOK5S7LE.js.map → chunk-H3D3IU3G.js.map} +2 -2
- package/dist/exports/client/{chunk-2CYU43GM.js → chunk-INBEEENE.js} +2 -2
- package/dist/exports/client/{chunk-2CYU43GM.js.map → chunk-INBEEENE.js.map} +1 -1
- package/dist/exports/client/{chunk-ZTAS32RX.js → chunk-PGMIO4IN.js} +2 -2
- package/dist/exports/client/{chunk-2L2Z4JHF.js → chunk-XOABLBHB.js} +2 -2
- package/dist/exports/client/{chunk-2L2Z4JHF.js.map → chunk-XOABLBHB.js.map} +1 -1
- package/dist/exports/client/{component-D6PKVJ2K.js → component-NSAU5Y76.js} +2 -2
- package/dist/exports/client/component-SX36AJXS.js +2 -0
- package/dist/exports/client/{component-ANB7VZLA.js.map → component-SX36AJXS.js.map} +2 -2
- package/dist/exports/client/componentInline-B5YNOX32.js +2 -0
- package/dist/exports/client/index.js +17 -17
- package/dist/exports/client/index.js.map +2 -2
- package/dist/features/blocks/client/component/BlockContent.js +8 -8
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockCollapsible.js +5 -5
- package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +1 -1
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/plugin/index.js +7 -4
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +3 -3
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +3 -3
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +6 -6
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/utils/useDebounce.js +3 -3
- package/dist/features/experimental_table/client/utils/useDebounce.js.map +1 -1
- package/dist/features/horizontalRule/client/component/index.js +19 -18
- package/dist/features/horizontalRule/client/component/index.js.map +1 -1
- package/dist/features/horizontalRule/client/plugin/index.js +13 -12
- package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
- package/dist/features/indent/client/plugins/index.js +3 -3
- package/dist/features/indent/client/plugins/index.js.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.js +3 -3
- package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/link/index.js +9 -5
- package/dist/features/link/client/plugins/link/index.js.map +1 -1
- package/dist/features/relationship/client/drawer/index.js +13 -13
- package/dist/features/relationship/client/drawer/index.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +23 -19
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +19 -18
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +39 -31
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +31 -23
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js +27 -26
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +36 -36
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/upload/client/drawer/index.js +3 -3
- package/dist/features/upload/client/drawer/index.js.map +1 -1
- package/dist/features/upload/client/plugin/index.js +6 -3
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.js +7 -7
- package/dist/field/index.js.map +1 -1
- package/dist/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
- package/dist/getDefaultSanitizedEditorConfig.js +2 -3
- package/dist/getDefaultSanitizedEditorConfig.js.map +1 -1
- package/dist/lexical/LexicalEditor.js +15 -15
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +17 -17
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +17 -17
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js +4 -4
- package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js.map +1 -1
- package/dist/lexical/plugins/TextPlugin/index.js +3 -3
- package/dist/lexical/plugins/TextPlugin/index.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +3 -3
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.js +11 -11
- package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +10 -10
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDrawer.js +14 -14
- package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +11 -11
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
- package/package.json +15 -15
- package/dist/exports/client/chunk-DOK5S7LE.js +0 -2
- package/dist/exports/client/chunk-WHL7AV5U.js +0 -2
- package/dist/exports/client/chunk-WHL7AV5U.js.map +0 -7
- package/dist/exports/client/component-ANB7VZLA.js +0 -2
- package/dist/exports/client/componentInline-GXYBWVCR.js +0 -2
- /package/dist/exports/client/{RelationshipComponent-XOQBVKA3.js.map → RelationshipComponent-F77EQHRG.js.map} +0 -0
- /package/dist/exports/client/{chunk-XCEM47RI.js.map → chunk-AXXPUMFU.js.map} +0 -0
- /package/dist/exports/client/{chunk-ZTAS32RX.js.map → chunk-PGMIO4IN.js.map} +0 -0
- /package/dist/exports/client/{component-D6PKVJ2K.js.map → component-NSAU5Y76.js.map} +0 -0
- /package/dist/exports/client/{componentInline-GXYBWVCR.js.map → componentInline-B5YNOX32.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","mergeRegister","$getSelection","$isRangeSelection","$isTextNode","COMMAND_PRIORITY_LOW","createCommand","useCallback","useEffect","useState","React","LexicalMenu","useMenuAnchorRef","PUNCTUATION","getTextUpToAnchor","selection","anchor","type","anchorNode","getNode","isSimpleText","anchorOffset","offset","getTextContent","slice","tryToPositionRange","leadOffset","range","editorWindow","domSelection","getSelection","isCollapsed","startOffset","endOffset","setStart","setEnd","error","getQueryTextForSearch","editor","text","getEditorState","read","isSelectionOnEntityBoundary","prevSibling","getPreviousSibling","isTextEntity","startTransition","callback","useDynamicPositioning","ENABLE_SLASH_MENU_COMMAND","LexicalTypeaheadMenuPlugin","t0","$","anchorClassName","anchorElem","groups","menuRenderFn","onClose","onOpen","onQueryChange","triggerFn","resolution","setResolution","anchorElementRef","t1","closeTypeahead","t2","res","openTypeahead","t3","t4","registerCommand","t5","node","match","matchingString","replaceableString","_window","window","document","createRange","isRangePositioned","getRect","getBoundingClientRect","updateListener","editorWindow_0","range_0","undefined","match_0","query","isRangePositioned_0","removeUpdateListener","registerUpdateListener","t6","t7","current","_jsx","close","shouldSplitNodeWithQuery"],"sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand, LexicalEditor, ParagraphNode, RangeSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $isTextNode,\n COMMAND_PRIORITY_LOW,\n createCommand,\n} from 'lexical'\nimport { type JSX, useCallback, useEffect, useState } from 'react'\nimport * as React from 'react'\n\nimport type { MenuTextMatch, TriggerFn } from '../useMenuTriggerMatch.js'\nimport type { MenuRenderFn, MenuResolution } from './LexicalMenu.js'\nimport type { SlashMenuGroupInternal } from './types.js'\n\nimport { LexicalMenu, useMenuAnchorRef } from './LexicalMenu.js'\n\nexport const PUNCTUATION = '\\\\.,\\\\+\\\\*\\\\?\\\\$\\\\@\\\\|#{}\\\\(\\\\)\\\\^\\\\-\\\\[\\\\]\\\\\\\\/!%\\'\"~=<>_:;'\n\nfunction getTextUpToAnchor(selection: RangeSelection): null | string {\n const anchor = selection.anchor\n if (anchor.type !== 'text') {\n return null\n }\n const anchorNode = anchor.getNode()\n if (!anchorNode.isSimpleText()) {\n return null\n }\n const anchorOffset = anchor.offset\n return anchorNode.getTextContent().slice(0, anchorOffset)\n}\n\nfunction tryToPositionRange(leadOffset: number, range: Range, editorWindow: Window): boolean {\n const domSelection = editorWindow.getSelection()\n if (domSelection === null || !domSelection.isCollapsed) {\n return false\n }\n const anchorNode = domSelection.anchorNode\n const startOffset = leadOffset\n const endOffset = domSelection.anchorOffset\n\n if (anchorNode == null || endOffset == null) {\n return false\n }\n\n try {\n range.setStart(anchorNode, startOffset)\n // if endOffset is 0, positioning the range for when you click the plus button to open the slash menu will fial\n range.setEnd(anchorNode, endOffset > 1 ? endOffset : 1)\n } catch (error) {\n return false\n }\n\n return true\n}\n\nfunction getQueryTextForSearch(editor: LexicalEditor): string | undefined {\n let text\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if (!$isRangeSelection(selection)) {\n return\n }\n text = getTextUpToAnchor(selection)\n })\n return text\n}\n\nfunction isSelectionOnEntityBoundary(editor: LexicalEditor, offset: number): boolean {\n if (offset !== 0) {\n return false\n }\n return editor.getEditorState().read(() => {\n const selection = $getSelection()\n if ($isRangeSelection(selection)) {\n const anchor = selection.anchor\n const anchorNode = anchor.getNode()\n const prevSibling = anchorNode.getPreviousSibling()\n return $isTextNode(prevSibling) && prevSibling.isTextEntity()\n }\n return false\n })\n}\n\nfunction startTransition(callback: () => void) {\n if (React.startTransition) {\n React.startTransition(callback)\n } else {\n callback()\n }\n}\n\nexport { useDynamicPositioning } from './LexicalMenu.js'\n\nexport type TypeaheadMenuPluginProps = {\n anchorClassName?: string\n anchorElem: HTMLElement\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\n onClose?: () => void\n onOpen?: (resolution: MenuResolution) => void\n onQueryChange: (matchingString: null | string) => void\n triggerFn: TriggerFn\n}\n\nexport const ENABLE_SLASH_MENU_COMMAND: LexicalCommand<{\n node: ParagraphNode\n}> = createCommand('ENABLE_SLASH_MENU_COMMAND')\n\nexport function LexicalTypeaheadMenuPlugin({\n anchorClassName,\n anchorElem,\n groups,\n menuRenderFn,\n onClose,\n onOpen,\n onQueryChange,\n triggerFn,\n}: TypeaheadMenuPluginProps): JSX.Element | null {\n const [editor] = useLexicalComposerContext()\n const [resolution, setResolution] = useState<MenuResolution | null>(null)\n const anchorElementRef = useMenuAnchorRef(anchorElem, resolution, setResolution, anchorClassName)\n\n const closeTypeahead = useCallback(() => {\n setResolution(null)\n if (onClose != null && resolution !== null) {\n onClose()\n }\n }, [onClose, resolution])\n\n const openTypeahead = useCallback(\n (res: MenuResolution) => {\n setResolution(res)\n if (onOpen != null && resolution === null) {\n onOpen(res)\n }\n },\n [onOpen, resolution],\n )\n\n // This is mainly used for the AddBlockHandlePlugin, so that the slash menu can be opened from there\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n ENABLE_SLASH_MENU_COMMAND,\n ({ node }) => {\n editor.getEditorState().read(() => {\n const match: MenuTextMatch = {\n leadOffset: 0,\n matchingString: '',\n replaceableString: '',\n }\n if (!isSelectionOnEntityBoundary(editor, match.leadOffset)) {\n if (node !== null) {\n const editorWindow = editor._window ?? window\n const range = editorWindow.document.createRange()\n\n const isRangePositioned = tryToPositionRange(match.leadOffset, range, editorWindow)\n if (isRangePositioned !== null) {\n startTransition(() =>\n openTypeahead({\n getRect: () => {\n return range.getBoundingClientRect()\n },\n match,\n }),\n )\n }\n\n return\n }\n }\n })\n\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, openTypeahead])\n\n useEffect(() => {\n const updateListener = () => {\n editor.getEditorState().read(() => {\n const editorWindow = editor._window ?? window\n const range = editorWindow.document.createRange()\n const selection = $getSelection()\n const text = getQueryTextForSearch(editor)\n\n if (\n !$isRangeSelection(selection) ||\n !selection.isCollapsed() ||\n text === undefined ||\n range === null\n ) {\n closeTypeahead()\n return\n }\n\n const match = triggerFn({ editor, query: text })\n onQueryChange(match ? match.matchingString : null)\n\n if (match !== null && !isSelectionOnEntityBoundary(editor, match.leadOffset)) {\n const isRangePositioned = tryToPositionRange(match.leadOffset, range, editorWindow)\n if (isRangePositioned !== null) {\n startTransition(() =>\n openTypeahead({\n getRect: () => {\n return range.getBoundingClientRect()\n },\n match,\n }),\n )\n return\n }\n }\n closeTypeahead()\n })\n }\n\n const removeUpdateListener = editor.registerUpdateListener(updateListener)\n\n return () => {\n removeUpdateListener()\n }\n }, [editor, triggerFn, onQueryChange, resolution, closeTypeahead, openTypeahead])\n\n return anchorElementRef.current === null || resolution === null || editor === null ? null : (\n <LexicalMenu\n anchorElementRef={anchorElementRef}\n close={closeTypeahead}\n editor={editor}\n groups={groups}\n menuRenderFn={menuRenderFn}\n resolution={resolution}\n shouldSplitNodeWithQuery\n />\n )\n}\n\nexport type { MenuRenderFn, MenuResolution, MenuTextMatch, TriggerFn }\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,aAAa,QAAQ;AAC9B,SACEC,aAAa,EACbC,iBAAiB,EACjBC,WAAW,EACXC,oBAAoB,EACpBC,aAAa,QACR;AACP,SAAmBC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAC3D,YAAYC,KAAA,MAAW;AAMvB,SAASC,WAAW,EAAEC,gBAAgB,QAAQ;AAE9C,OAAO,MAAMC,WAAA,GAAc;AAE3B,SAASC,kBAAkBC,SAAyB;EAClD,MAAMC,MAAA,GAASD,SAAA,CAAUC,MAAM;EAC/B,IAAIA,MAAA,CAAOC,IAAI,KAAK,QAAQ;IAC1B,OAAO;EACT;EACA,MAAMC,UAAA,GAAaF,MAAA,CAAOG,OAAO;EACjC,IAAI,CAACD,UAAA,CAAWE,YAAY,IAAI;IAC9B,OAAO;EACT;EACA,MAAMC,YAAA,GAAeL,MAAA,CAAOM,MAAM;EAClC,OAAOJ,UAAA,CAAWK,cAAc,GAAGC,KAAK,CAAC,GAAGH,YAAA;AAC9C;AAEA,SAASI,mBAAmBC,UAAkB,EAAEC,KAAY,EAAEC,YAAoB;EAChF,MAAMC,YAAA,GAAeD,YAAA,CAAaE,YAAY;EAC9C,IAAID,YAAA,KAAiB,QAAQ,CAACA,YAA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names":["c","_c","useLexicalComposerContext","mergeRegister","$getSelection","$isRangeSelection","$isTextNode","COMMAND_PRIORITY_LOW","createCommand","useCallback","useEffect","useState","React","LexicalMenu","useMenuAnchorRef","PUNCTUATION","getTextUpToAnchor","selection","anchor","type","anchorNode","getNode","isSimpleText","anchorOffset","offset","getTextContent","slice","tryToPositionRange","leadOffset","range","editorWindow","domSelection","getSelection","isCollapsed","startOffset","endOffset","setStart","setEnd","error","getQueryTextForSearch","editor","text","getEditorState","read","isSelectionOnEntityBoundary","prevSibling","getPreviousSibling","isTextEntity","startTransition","callback","useDynamicPositioning","ENABLE_SLASH_MENU_COMMAND","LexicalTypeaheadMenuPlugin","t0","$","anchorClassName","anchorElem","groups","menuRenderFn","onClose","onOpen","onQueryChange","triggerFn","resolution","setResolution","anchorElementRef","t1","closeTypeahead","t2","res","openTypeahead","t3","t4","registerCommand","t5","node","match","matchingString","replaceableString","_window","window","document","createRange","isRangePositioned","getRect","getBoundingClientRect","updateListener","editorWindow_0","range_0","undefined","match_0","query","isRangePositioned_0","removeUpdateListener","registerUpdateListener","t6","t7","current","_jsx","close","shouldSplitNodeWithQuery"],"sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand, LexicalEditor, ParagraphNode, RangeSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $isTextNode,\n COMMAND_PRIORITY_LOW,\n createCommand,\n} from 'lexical'\nimport { type JSX, useCallback, useEffect, useState } from 'react'\nimport * as React from 'react'\n\nimport type { MenuTextMatch, TriggerFn } from '../useMenuTriggerMatch.js'\nimport type { MenuRenderFn, MenuResolution } from './LexicalMenu.js'\nimport type { SlashMenuGroupInternal } from './types.js'\n\nimport { LexicalMenu, useMenuAnchorRef } from './LexicalMenu.js'\n\nexport const PUNCTUATION = '\\\\.,\\\\+\\\\*\\\\?\\\\$\\\\@\\\\|#{}\\\\(\\\\)\\\\^\\\\-\\\\[\\\\]\\\\\\\\/!%\\'\"~=<>_:;'\n\nfunction getTextUpToAnchor(selection: RangeSelection): null | string {\n const anchor = selection.anchor\n if (anchor.type !== 'text') {\n return null\n }\n const anchorNode = anchor.getNode()\n if (!anchorNode.isSimpleText()) {\n return null\n }\n const anchorOffset = anchor.offset\n return anchorNode.getTextContent().slice(0, anchorOffset)\n}\n\nfunction tryToPositionRange(leadOffset: number, range: Range, editorWindow: Window): boolean {\n const domSelection = editorWindow.getSelection()\n if (domSelection === null || !domSelection.isCollapsed) {\n return false\n }\n const anchorNode = domSelection.anchorNode\n const startOffset = leadOffset\n const endOffset = domSelection.anchorOffset\n\n if (anchorNode == null || endOffset == null) {\n return false\n }\n\n try {\n range.setStart(anchorNode, startOffset)\n // if endOffset is 0, positioning the range for when you click the plus button to open the slash menu will fial\n range.setEnd(anchorNode, endOffset > 1 ? endOffset : 1)\n } catch (error) {\n return false\n }\n\n return true\n}\n\nfunction getQueryTextForSearch(editor: LexicalEditor): string | undefined {\n let text\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if (!$isRangeSelection(selection)) {\n return\n }\n text = getTextUpToAnchor(selection)\n })\n return text\n}\n\nfunction isSelectionOnEntityBoundary(editor: LexicalEditor, offset: number): boolean {\n if (offset !== 0) {\n return false\n }\n return editor.getEditorState().read(() => {\n const selection = $getSelection()\n if ($isRangeSelection(selection)) {\n const anchor = selection.anchor\n const anchorNode = anchor.getNode()\n const prevSibling = anchorNode.getPreviousSibling()\n return $isTextNode(prevSibling) && prevSibling.isTextEntity()\n }\n return false\n })\n}\n\nfunction startTransition(callback: () => void) {\n if (React.startTransition) {\n React.startTransition(callback)\n } else {\n callback()\n }\n}\n\nexport { useDynamicPositioning } from './LexicalMenu.js'\n\nexport type TypeaheadMenuPluginProps = {\n anchorClassName?: string\n anchorElem: HTMLElement\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\n onClose?: () => void\n onOpen?: (resolution: MenuResolution) => void\n onQueryChange: (matchingString: null | string) => void\n triggerFn: TriggerFn\n}\n\nexport const ENABLE_SLASH_MENU_COMMAND: LexicalCommand<{\n node: ParagraphNode\n}> = createCommand('ENABLE_SLASH_MENU_COMMAND')\n\nexport function LexicalTypeaheadMenuPlugin({\n anchorClassName,\n anchorElem,\n groups,\n menuRenderFn,\n onClose,\n onOpen,\n onQueryChange,\n triggerFn,\n}: TypeaheadMenuPluginProps): JSX.Element | null {\n const [editor] = useLexicalComposerContext()\n const [resolution, setResolution] = useState<MenuResolution | null>(null)\n const anchorElementRef = useMenuAnchorRef(anchorElem, resolution, setResolution, anchorClassName)\n\n const closeTypeahead = useCallback(() => {\n setResolution(null)\n if (onClose != null && resolution !== null) {\n onClose()\n }\n }, [onClose, resolution])\n\n const openTypeahead = useCallback(\n (res: MenuResolution) => {\n setResolution(res)\n if (onOpen != null && resolution === null) {\n onOpen(res)\n }\n },\n [onOpen, resolution],\n )\n\n // This is mainly used for the AddBlockHandlePlugin, so that the slash menu can be opened from there\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n ENABLE_SLASH_MENU_COMMAND,\n ({ node }) => {\n editor.getEditorState().read(() => {\n const match: MenuTextMatch = {\n leadOffset: 0,\n matchingString: '',\n replaceableString: '',\n }\n if (!isSelectionOnEntityBoundary(editor, match.leadOffset)) {\n if (node !== null) {\n const editorWindow = editor._window ?? window\n const range = editorWindow.document.createRange()\n\n const isRangePositioned = tryToPositionRange(match.leadOffset, range, editorWindow)\n if (isRangePositioned !== null) {\n startTransition(() =>\n openTypeahead({\n getRect: () => {\n return range.getBoundingClientRect()\n },\n match,\n }),\n )\n }\n\n return\n }\n }\n })\n\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, openTypeahead])\n\n useEffect(() => {\n const updateListener = () => {\n editor.getEditorState().read(() => {\n const editorWindow = editor._window ?? window\n const range = editorWindow.document.createRange()\n const selection = $getSelection()\n const text = getQueryTextForSearch(editor)\n\n if (\n !$isRangeSelection(selection) ||\n !selection.isCollapsed() ||\n text === undefined ||\n range === null\n ) {\n closeTypeahead()\n return\n }\n\n const match = triggerFn({ editor, query: text })\n onQueryChange(match ? match.matchingString : null)\n\n if (match !== null && !isSelectionOnEntityBoundary(editor, match.leadOffset)) {\n const isRangePositioned = tryToPositionRange(match.leadOffset, range, editorWindow)\n if (isRangePositioned !== null) {\n startTransition(() =>\n openTypeahead({\n getRect: () => {\n return range.getBoundingClientRect()\n },\n match,\n }),\n )\n return\n }\n }\n closeTypeahead()\n })\n }\n\n const removeUpdateListener = editor.registerUpdateListener(updateListener)\n\n return () => {\n removeUpdateListener()\n }\n }, [editor, triggerFn, onQueryChange, resolution, closeTypeahead, openTypeahead])\n\n return anchorElementRef.current === null || resolution === null || editor === null ? null : (\n <LexicalMenu\n anchorElementRef={anchorElementRef}\n close={closeTypeahead}\n editor={editor}\n groups={groups}\n menuRenderFn={menuRenderFn}\n resolution={resolution}\n shouldSplitNodeWithQuery\n />\n )\n}\n\nexport type { MenuRenderFn, MenuResolution, MenuTextMatch, TriggerFn }\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,aAAa,QAAQ;AAC9B,SACEC,aAAa,EACbC,iBAAiB,EACjBC,WAAW,EACXC,oBAAoB,EACpBC,aAAa,QACR;AACP,SAAmBC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAC3D,YAAYC,KAAA,MAAW;AAMvB,SAASC,WAAW,EAAEC,gBAAgB,QAAQ;AAE9C,OAAO,MAAMC,WAAA,GAAc;AAE3B,SAASC,kBAAkBC,SAAyB;EAClD,MAAMC,MAAA,GAASD,SAAA,CAAUC,MAAM;EAC/B,IAAIA,MAAA,CAAOC,IAAI,KAAK,QAAQ;IAC1B,OAAO;EACT;EACA,MAAMC,UAAA,GAAaF,MAAA,CA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A,IAAAJ,CAAA,SAAAS,UAAA;IAEzEiC,EAAA,GAAA/B,gBAAA,CAAAgC,OAAA,SAA6B,IAAQlC,UAAA,SAAe,IAAQvB,MAAA,SAAW,UAC5E0D,IAAA,CAAArF,WAAA;MAAAoD,gBAAA;MAAAkC,KAAA,EAEShC,cAAA;MAAA3B,MAAA;MAAAiB,MAAA;MAAAC,YAAA;MAAAK,UAAA;MAAAqC,wBAAA;IAAA,C;;;;;;;;;;;SAHJJ,E","ignoreList":[]}
|
|
@@ -15,7 +15,7 @@ export function useMenuTriggerMatch(trigger, t0) {
|
|
|
15
15
|
const maxLength = t1 === undefined ? 75 : t1;
|
|
16
16
|
const minLength = t2 === undefined ? 1 : t2;
|
|
17
17
|
let t3;
|
|
18
|
-
if ($[0] !==
|
|
18
|
+
if ($[0] !== maxLength || $[1] !== minLength || $[2] !== trigger) {
|
|
19
19
|
t3 = t4 => {
|
|
20
20
|
const {
|
|
21
21
|
query
|
|
@@ -36,9 +36,9 @@ export function useMenuTriggerMatch(trigger, t0) {
|
|
|
36
36
|
}
|
|
37
37
|
return null;
|
|
38
38
|
};
|
|
39
|
-
$[0] =
|
|
40
|
-
$[1] =
|
|
41
|
-
$[2] =
|
|
39
|
+
$[0] = maxLength;
|
|
40
|
+
$[1] = minLength;
|
|
41
|
+
$[2] = trigger;
|
|
42
42
|
$[3] = t3;
|
|
43
43
|
} else {
|
|
44
44
|
t3 = $[3];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMenuTriggerMatch.js","names":["c","_c","useCallback","PUNCTUATION","useMenuTriggerMatch","trigger","t0","$","maxLength","t1","minLength","t2","undefined","t3","t4","query","validChars","TypeaheadTriggerRegex","RegExp","match","exec","maybeLeadingWhitespace","matchingString","length","leadOffset","index","replaceableString"],"sources":["../../../../src/lexical/plugins/SlashMenu/useMenuTriggerMatch.ts"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useCallback } from 'react'\n\nimport { PUNCTUATION } from './LexicalTypeaheadMenuPlugin/index.js'\n\nexport type TriggerFn = ({\n editor,\n query,\n}: {\n editor: LexicalEditor\n /** The query string is the POTENTIAL trigger AND the text after the trigger text. */\n query: string\n}) => MenuTextMatch | null\n\nexport type MenuTextMatch = {\n leadOffset: number\n matchingString: string\n replaceableString: string\n}\n\n/**\n * Returns a function which checks if the trigger (e.g. '/') is present in the query and, if so, returns the matching string (text after the trigger)\n */\nexport function useMenuTriggerMatch(\n /**\n * Text which triggers the menu. Everything after this text will be used as the query.\n */\n trigger: string,\n { maxLength = 75, minLength = 1 }: { maxLength?: number; minLength?: number },\n): TriggerFn {\n return useCallback(\n ({ query }) => {\n const validChars = '[^' + trigger + PUNCTUATION + '\\\\s]'\n const TypeaheadTriggerRegex = new RegExp(\n '(^|\\\\s|\\\\()(' +\n '[' +\n trigger +\n ']' +\n '((?:' +\n validChars +\n '){0,' +\n maxLength +\n '})' +\n ')$',\n )\n const match = TypeaheadTriggerRegex.exec(query)\n if (match !== null) {\n const maybeLeadingWhitespace = match[1]\n\n /**\n * matchingString is only the text AFTER the trigger text. (So everything after the /)\n */\n const matchingString = match[3]\n\n if (matchingString.length >= minLength) {\n return {\n leadOffset: match.index + maybeLeadingWhitespace.length,\n matchingString,\n replaceableString: match[2], // replaceableString is the trigger text + the matching string\n }\n }\n }\n return null\n },\n [maxLength, minLength, trigger],\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,WAAW,QAAQ;AAE5B,SAASC,WAAW,QAAQ;AAiB5B;;;AAGA,OAAO,SAAAC,oBAAAC,OAAA,EAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAKL;IAAAO,SAAA,EAAAC,EAAA;IAAAC,SAAA,EAAAC;EAAA,IAAAL,EAA6E;EAA3E,MAAAE,SAAA,GAAAC,EAAc,KAAAG,SAAA,QAAdH,EAAc;EAAE,MAAAC,SAAA,GAAAC,EAAa,KAAAC,SAAA,OAAbD,EAAa;EAAA,IAAAE,EAAA;EAAA,IAAAN,CAAA,
|
|
1
|
+
{"version":3,"file":"useMenuTriggerMatch.js","names":["c","_c","useCallback","PUNCTUATION","useMenuTriggerMatch","trigger","t0","$","maxLength","t1","minLength","t2","undefined","t3","t4","query","validChars","TypeaheadTriggerRegex","RegExp","match","exec","maybeLeadingWhitespace","matchingString","length","leadOffset","index","replaceableString"],"sources":["../../../../src/lexical/plugins/SlashMenu/useMenuTriggerMatch.ts"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useCallback } from 'react'\n\nimport { PUNCTUATION } from './LexicalTypeaheadMenuPlugin/index.js'\n\nexport type TriggerFn = ({\n editor,\n query,\n}: {\n editor: LexicalEditor\n /** The query string is the POTENTIAL trigger AND the text after the trigger text. */\n query: string\n}) => MenuTextMatch | null\n\nexport type MenuTextMatch = {\n leadOffset: number\n matchingString: string\n replaceableString: string\n}\n\n/**\n * Returns a function which checks if the trigger (e.g. '/') is present in the query and, if so, returns the matching string (text after the trigger)\n */\nexport function useMenuTriggerMatch(\n /**\n * Text which triggers the menu. Everything after this text will be used as the query.\n */\n trigger: string,\n { maxLength = 75, minLength = 1 }: { maxLength?: number; minLength?: number },\n): TriggerFn {\n return useCallback(\n ({ query }) => {\n const validChars = '[^' + trigger + PUNCTUATION + '\\\\s]'\n const TypeaheadTriggerRegex = new RegExp(\n '(^|\\\\s|\\\\()(' +\n '[' +\n trigger +\n ']' +\n '((?:' +\n validChars +\n '){0,' +\n maxLength +\n '})' +\n ')$',\n )\n const match = TypeaheadTriggerRegex.exec(query)\n if (match !== null) {\n const maybeLeadingWhitespace = match[1]\n\n /**\n * matchingString is only the text AFTER the trigger text. (So everything after the /)\n */\n const matchingString = match[3]\n\n if (matchingString.length >= minLength) {\n return {\n leadOffset: match.index + maybeLeadingWhitespace.length,\n matchingString,\n replaceableString: match[2], // replaceableString is the trigger text + the matching string\n }\n }\n }\n return null\n },\n [maxLength, minLength, trigger],\n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,EAkC0B;AAAA","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ export function TextPlugin(t0) {
|
|
|
11
11
|
} = t0;
|
|
12
12
|
const [editor] = useLexicalComposerContext();
|
|
13
13
|
let t1;
|
|
14
|
-
if ($[0] !==
|
|
14
|
+
if ($[0] !== editor || $[1] !== features.enabledFormats) {
|
|
15
15
|
t1 = () => {
|
|
16
16
|
const disabledFormats = getDisabledFormats(features.enabledFormats);
|
|
17
17
|
if (disabledFormats.length === 0) {
|
|
@@ -25,8 +25,8 @@ export function TextPlugin(t0) {
|
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
|
-
$[0] =
|
|
29
|
-
$[1] =
|
|
28
|
+
$[0] = editor;
|
|
29
|
+
$[1] = features.enabledFormats;
|
|
30
30
|
$[2] = t1;
|
|
31
31
|
} else {
|
|
32
32
|
t1 = $[2];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","TEXT_TYPE_TO_FORMAT","TextNode","useEffect","TextPlugin","t0","$","features","editor","t1","enabledFormats","disabledFormats","getDisabledFormats","length","registerNodeTransform","textNode","forEach","disabledFormat","hasFormat","toggleFormat","t2","highlight","allFormats","Object","keys","enabledSet","Set","filter","format","has"],"sources":["../../../../src/lexical/plugins/TextPlugin/index.tsx"],"sourcesContent":["'use client'\nimport type { TextFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TEXT_TYPE_TO_FORMAT, TextNode } from 'lexical'\nimport { type SanitizedClientFeatures } from 'packages/richtext-lexical/src/features/typesClient.js'\nimport { useEffect } from 'react'\n\nexport function TextPlugin({ features }: { features: SanitizedClientFeatures }) {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n const disabledFormats = getDisabledFormats(features.enabledFormats as TextFormatType[])\n if (disabledFormats.length === 0) {\n return\n }\n // Ideally override the TextNode with our own TextNode (changing its setFormat or toggleFormat methods),\n // would be more performant. If we find a noticeable perf regression we can switch to that option.\n // Overriding the FORMAT_TEXT_COMMAND and PASTE_COMMAND commands is not an option I considered because\n // there might be other forms of mutation that we might not be considering. For example:\n // browser extensions or Payload/Lexical plugins that have their own commands.\n return editor.registerNodeTransform(TextNode, (textNode) => {\n disabledFormats.forEach((disabledFormat) => {\n if (textNode.hasFormat(disabledFormat)) {\n textNode.toggleFormat(disabledFormat)\n }\n })\n })\n }, [editor, features])\n\n return null\n}\n\nfunction getDisabledFormats(enabledFormats: TextFormatType[]): TextFormatType[] {\n // not sure why Lexical added highlight as TextNode format.\n // see https://github.com/facebook/lexical/pull/3583\n // We are going to implement it in other way to support multiple colors\n delete TEXT_TYPE_TO_FORMAT.highlight\n const allFormats = Object.keys(TEXT_TYPE_TO_FORMAT) as TextFormatType[]\n const enabledSet = new Set(enabledFormats)\n\n return allFormats.filter((format) => !enabledSet.has(format))\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,QAAQ,QAAQ;AAE9C,SAASC,SAAS,QAAQ;AAE1B,OAAO,SAAAC,WAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAP,EAAA;EAAoB;IAAAQ;EAAA,IAAAF,EAAmD;EAC5E,OAAAG,MAAA,IAAiBR,yBAAA;EAAA,IAAAS,EAAA;EAAA,IAAAH,CAAA,QAAAC,QAAA,CAAAG,cAAA
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","TEXT_TYPE_TO_FORMAT","TextNode","useEffect","TextPlugin","t0","$","features","editor","t1","enabledFormats","disabledFormats","getDisabledFormats","length","registerNodeTransform","textNode","forEach","disabledFormat","hasFormat","toggleFormat","t2","highlight","allFormats","Object","keys","enabledSet","Set","filter","format","has"],"sources":["../../../../src/lexical/plugins/TextPlugin/index.tsx"],"sourcesContent":["'use client'\nimport type { TextFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TEXT_TYPE_TO_FORMAT, TextNode } from 'lexical'\nimport { type SanitizedClientFeatures } from 'packages/richtext-lexical/src/features/typesClient.js'\nimport { useEffect } from 'react'\n\nexport function TextPlugin({ features }: { features: SanitizedClientFeatures }) {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n const disabledFormats = getDisabledFormats(features.enabledFormats as TextFormatType[])\n if (disabledFormats.length === 0) {\n return\n }\n // Ideally override the TextNode with our own TextNode (changing its setFormat or toggleFormat methods),\n // would be more performant. If we find a noticeable perf regression we can switch to that option.\n // Overriding the FORMAT_TEXT_COMMAND and PASTE_COMMAND commands is not an option I considered because\n // there might be other forms of mutation that we might not be considering. For example:\n // browser extensions or Payload/Lexical plugins that have their own commands.\n return editor.registerNodeTransform(TextNode, (textNode) => {\n disabledFormats.forEach((disabledFormat) => {\n if (textNode.hasFormat(disabledFormat)) {\n textNode.toggleFormat(disabledFormat)\n }\n })\n })\n }, [editor, features])\n\n return null\n}\n\nfunction getDisabledFormats(enabledFormats: TextFormatType[]): TextFormatType[] {\n // not sure why Lexical added highlight as TextNode format.\n // see https://github.com/facebook/lexical/pull/3583\n // We are going to implement it in other way to support multiple colors\n delete TEXT_TYPE_TO_FORMAT.highlight\n const allFormats = Object.keys(TEXT_TYPE_TO_FORMAT) as TextFormatType[]\n const enabledSet = new Set(enabledFormats)\n\n return allFormats.filter((format) => !enabledSet.has(format))\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,QAAQ,QAAQ;AAE9C,SAASC,SAAS,QAAQ;AAE1B,OAAO,SAAAC,WAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAP,EAAA;EAAoB;IAAAQ;EAAA,IAAAF,EAAmD;EAC5E,OAAAG,MAAA,IAAiBR,yBAAA;EAAA,IAAAS,EAAA;EAAA,IAAAH,CAA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();
|
|
16
16
|
let t1;
|
|
17
|
-
if ($[0] !==
|
|
17
|
+
if ($[0] !== className || $[1] !== t) {
|
|
18
18
|
t1 = _jsx(ContentEditable, {
|
|
19
19
|
"aria-placeholder": t("lexical:general:placeholder"),
|
|
20
20
|
className: className ?? "ContentEditable__root",
|
|
@@ -23,8 +23,8 @@ export function LexicalContentEditable(t0) {
|
|
|
23
23
|
children: t("lexical:general:placeholder")
|
|
24
24
|
})
|
|
25
25
|
});
|
|
26
|
-
$[0] =
|
|
27
|
-
$[1] =
|
|
26
|
+
$[0] = className;
|
|
27
|
+
$[1] = t;
|
|
28
28
|
$[2] = t1;
|
|
29
29
|
} else {
|
|
30
30
|
t1 = $[2];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentEditable.js","names":["c","_c","ContentEditable","useTranslation","React","LexicalContentEditable","t0","$","className","t","t1","_jsx","placeholder","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'\n\nexport function LexicalContentEditable({ className }: { className?: string }): 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={<p className=\"editor-placeholder\">{t('lexical:general:placeholder')}</p>}\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,YAAYC,KAAA,MAAW;AAIvB,OAAO,SAAAC,uBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAAgC;IAAAO;EAAA,IAAAF,EAAqC;EAC1E;IAAAG;EAAA,IAAcN,cAAA;EAAA,IAAAO,EAAA;EAAA,IAAAH,CAAA,
|
|
1
|
+
{"version":3,"file":"ContentEditable.js","names":["c","_c","ContentEditable","useTranslation","React","LexicalContentEditable","t0","$","className","t","t1","_jsx","placeholder","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'\n\nexport function LexicalContentEditable({ className }: { className?: string }): 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={<p className=\"editor-placeholder\">{t('lexical:general:placeholder')}</p>}\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,YAAYC,KAAA,MAAW;AAIvB,OAAO,SAAAC,uBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAAgC;IAAAO;EAAA,IAAAF,EAAqC;EAC1E;IAAAG;EAAA,IAAcN,cAAA;EAAA,IAAAO,EAAA;EAAA,IAAAH,CAAA,QAAAC,SAAA,IAAAD,CAAA,QAAAE,CAAA;IAGZC,EAAA,GAAAC,IAAA,CAAAT,eAAA;MAAA,oBACoBO,CAAA,CAAE;MAAAD,SAAA,EACTA,SAAA,IAAa;MAAAI,WAAA,EACXD,IAAA,CAAC;QAAAH,SAAA,EAAY;QAAAK,QAAA,EAAsBJ,CAAA,CAAE;MAAA,C;;;;;;;;SAHpDC,E","ignoreList":[]}
|
|
@@ -44,7 +44,7 @@ export const FieldsDrawer = t0 => {
|
|
|
44
44
|
t2 = $[3];
|
|
45
45
|
}
|
|
46
46
|
let t3;
|
|
47
|
-
if ($[4] !==
|
|
47
|
+
if ($[4] !== className || $[5] !== data || $[6] !== drawerSlug || $[7] !== featureKey || $[8] !== fieldMapOverride || $[9] !== schemaFieldsPathOverride || $[10] !== schemaPath || $[11] !== schemaPathSuffix || $[12] !== t1 || $[13] !== t2) {
|
|
48
48
|
t3 = _jsx(EditDepthProvider, {
|
|
49
49
|
children: _jsx(Drawer, {
|
|
50
50
|
className,
|
|
@@ -61,16 +61,16 @@ export const FieldsDrawer = t0 => {
|
|
|
61
61
|
})
|
|
62
62
|
})
|
|
63
63
|
});
|
|
64
|
-
$[4] =
|
|
65
|
-
$[5] =
|
|
66
|
-
$[6] =
|
|
67
|
-
$[7] =
|
|
68
|
-
$[8] =
|
|
69
|
-
$[9] =
|
|
70
|
-
$[10] =
|
|
71
|
-
$[11] =
|
|
72
|
-
$[12] =
|
|
73
|
-
$[13] =
|
|
64
|
+
$[4] = className;
|
|
65
|
+
$[5] = data;
|
|
66
|
+
$[6] = drawerSlug;
|
|
67
|
+
$[7] = featureKey;
|
|
68
|
+
$[8] = fieldMapOverride;
|
|
69
|
+
$[9] = schemaFieldsPathOverride;
|
|
70
|
+
$[10] = schemaPath;
|
|
71
|
+
$[11] = schemaPathSuffix;
|
|
72
|
+
$[12] = t1;
|
|
73
|
+
$[13] = t2;
|
|
74
74
|
$[14] = t3;
|
|
75
75
|
} else {
|
|
76
76
|
t3 = $[14];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","names":["c","_c","Drawer","EditDepthProvider","useModal","React","DrawerContent","FieldsDrawer","t0","$","className","data","drawerSlug","drawerTitle","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","closeModal","t1","t2","args","args2","setTimeout","t3","_jsx","children","slug","title"],"sources":["../../../src/utilities/fieldsDrawer/Drawer.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,MAAM,EAAEC,iBAAiB,EAAEC,QAAQ,QAAQ;AACpD,OAAOC,KAAA,MAAW;AAElB,SAASC,aAAa,QAAQ;AAe9B;;;;;AAKA,OAAO,MAAMC,YAAA,GAA4CC,EAAA;EAAA,MAAAC,CAAA,GAAAR,EAAA;EAAC;IAAAS,SAAA;IAAAC,IAAA;IAAAC,UAAA;IAAAC,WAAA;IAAAC,UAAA;IAAAC,gBAAA;IAAAC,kBAAA;IAAAC,wBAAA;IAAAC,UAAA;IAAAC;EAAA,IAAAX,EAWzD;EACC;IAAAY;EAAA,IAAuBhB,QAAA;EAKoC,MAAAiB,EAAA,GAAAR,WAAA,IAAe;EAAA,IAAAS,EAAA;EAAA,IAAAb,CAAA,QAAAW,UAAA,IAAAX,CAAA,QAAAG,UAAA,IAAAH,CAAA,QAAAO,kBAAA;IAK9CM,EAAA,GAAAA,CAAAC,IAAA,EAAAC,KAAA;MAGlBJ,UAAA,CAAWR,UAAA;MAMXa,UAAA;QACET,kBAAA,CAAmBO,IAAA,EAAMC,KAAA;MAAA,IACxB;IAAA;IACLf,CAAA,MAAAW,UAAA;IAAAX,CAAA,MAAAG,UAAA;IAAAH,CAAA,MAAAO,kBAAA;IAAAP,CAAA,MAAAa,EAAA;EAAA;IAAAA,EAAA,GAAAb,CAAA;EAAA;EAAA,IAAAiB,EAAA;EAAA,IAAAjB,CAAA,QAAAE,IAAA,IAAAF,CAAA,QAAAK,UAAA,IAAAL,CAAA,QAAAM,gBAAA,IAAAN,CAAA,
|
|
1
|
+
{"version":3,"file":"Drawer.js","names":["c","_c","Drawer","EditDepthProvider","useModal","React","DrawerContent","FieldsDrawer","t0","$","className","data","drawerSlug","drawerTitle","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","closeModal","t1","t2","args","args2","setTimeout","t3","_jsx","children","slug","title"],"sources":["../../../src/utilities/fieldsDrawer/Drawer.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n"],"mappings":"AAAA;;A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;QAAAQ,SAAA;QAAAmB,IAAA,EAAoCjB,UAAA;QAAAkB,KAAA,EAAmBT,EAAe;QAAAO,QAAA,EACpED,IAAA,CAAArB,aAAA;UAAAK,IAAA;UAAAG,UAAA;UAAAC,gBAAA;UAAAC,kBAAA,EAIsBM,EAYpB;UAAAL,wBAAA;UAAAC,UAAA;UAAAC;QAAA,C;;;;;;;;;;;;;;;;;SAlBNO,E;CA0BJ","ignoreList":[]}
|
|
@@ -40,7 +40,7 @@ export const useLexicalDocumentDrawer = args => {
|
|
|
40
40
|
}
|
|
41
41
|
const storeSelection = t1;
|
|
42
42
|
let t2;
|
|
43
|
-
if ($[2] !==
|
|
43
|
+
if ($[2] !== editor || $[3] !== selectionState) {
|
|
44
44
|
t2 = () => {
|
|
45
45
|
if (selectionState) {
|
|
46
46
|
editor.update(() => {
|
|
@@ -51,8 +51,8 @@ export const useLexicalDocumentDrawer = args => {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
$[2] =
|
|
55
|
-
$[3] =
|
|
54
|
+
$[2] = editor;
|
|
55
|
+
$[3] = selectionState;
|
|
56
56
|
$[4] = t2;
|
|
57
57
|
} else {
|
|
58
58
|
t2 = $[4];
|
|
@@ -71,7 +71,7 @@ export const useLexicalDocumentDrawer = args => {
|
|
|
71
71
|
const closeDocumentDrawer = t3;
|
|
72
72
|
let t4;
|
|
73
73
|
let t5;
|
|
74
|
-
if ($[7] !==
|
|
74
|
+
if ($[7] !== documentDrawerSlug || $[8] !== modalState || $[9] !== restoreSelection || $[10] !== wasOpen) {
|
|
75
75
|
t4 = () => {
|
|
76
76
|
if (!wasOpen) {
|
|
77
77
|
return;
|
|
@@ -85,10 +85,10 @@ export const useLexicalDocumentDrawer = args => {
|
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
t5 = [modalState, documentDrawerSlug, restoreSelection, wasOpen];
|
|
88
|
-
$[7] =
|
|
88
|
+
$[7] = documentDrawerSlug;
|
|
89
89
|
$[8] = modalState;
|
|
90
|
-
$[9] =
|
|
91
|
-
$[10] =
|
|
90
|
+
$[9] = restoreSelection;
|
|
91
|
+
$[10] = wasOpen;
|
|
92
92
|
$[11] = t4;
|
|
93
93
|
$[12] = t5;
|
|
94
94
|
} else {
|
|
@@ -109,15 +109,15 @@ export const useLexicalDocumentDrawer = args => {
|
|
|
109
109
|
t6 = $[15];
|
|
110
110
|
}
|
|
111
111
|
let t7;
|
|
112
|
-
if ($[16] !==
|
|
112
|
+
if ($[16] !== DocumentDrawer || $[17] !== closeDocumentDrawer || $[18] !== documentDrawerSlug || $[19] !== t6) {
|
|
113
113
|
t7 = {
|
|
114
114
|
closeDocumentDrawer,
|
|
115
115
|
DocumentDrawer,
|
|
116
116
|
documentDrawerSlug,
|
|
117
117
|
DocumentDrawerToggler: t6
|
|
118
118
|
};
|
|
119
|
-
$[16] =
|
|
120
|
-
$[17] =
|
|
119
|
+
$[16] = DocumentDrawer;
|
|
120
|
+
$[17] = closeDocumentDrawer;
|
|
121
121
|
$[18] = documentDrawerSlug;
|
|
122
122
|
$[19] = t6;
|
|
123
123
|
$[20] = t7;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLexicalDocumentDrawer.js","names":["c","_c","useLexicalComposerContext","useDocumentDrawer","useModal","$getPreviousSelection","$getSelection","$setSelection","useCallback","useEffect","useState","useLexicalDocumentDrawer","args","$","editor","selectionState","setSelectionState","wasOpen","setWasOpen","DocumentDrawer","DocumentDrawerToggler","t0","closeDrawer","drawerSlug","documentDrawerSlug","modalState","t1","read","selection","storeSelection","t2","update","clone","discrete","skipTransforms","restoreSelection","t3","closeDocumentDrawer","t4","t5","thisModalState","isOpen","setTimeout","t6","props","_jsx","onClick","t7"],"sources":["../../../src/utilities/fieldsDrawer/useLexicalDocumentDrawer.tsx"],"sourcesContent":["'use client'\nimport type { UseDocumentDrawer } from '@payloadcms/ui'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useDocumentDrawer, useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useDocumentDrawer that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalDocumentDrawer = (\n args: Parameters<UseDocumentDrawer>[0],\n): {\n closeDocumentDrawer: () => void\n DocumentDrawer: ReturnType<UseDocumentDrawer>[0]\n documentDrawerSlug: string\n DocumentDrawerToggler: ReturnType<UseDocumentDrawer>[1]\n} => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const [\n DocumentDrawer,\n DocumentDrawerToggler,\n { closeDrawer: closeDrawer, drawerSlug: documentDrawerSlug },\n ] = useDocumentDrawer(args)\n const { modalState } = useModal()\n\n const storeSelection = useCallback(() => {\n editor.read(() => {\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n })\n setWasOpen(true)\n }, [editor])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeDocumentDrawer = () => {\n //restoreSelection() // Should already be stored by the useEffect below\n closeDrawer()\n }\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[documentDrawerSlug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n setTimeout(() => {\n restoreSelection()\n }, 1)\n }\n }, [modalState, documentDrawerSlug, restoreSelection, wasOpen])\n\n return {\n closeDocumentDrawer,\n DocumentDrawer,\n documentDrawerSlug,\n DocumentDrawerToggler: (props) => <DocumentDrawerToggler {...props} onClick={storeSelection} />,\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,iBAAiB,EAAEC,QAAQ,QAAQ;AAC5C,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,aAAa,QAAQ;AACpE,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAEjD;;;;;AAKA,OAAO,MAAMC,wBAAA,GAA2BC,IAAA;EAAA,MAAAC,CAAA,GAAAZ,EAAA;EAQtC,OAAAa,MAAA,IAAiBZ,yBAAA;EACjB,OAAAa,cAAA,EAAAC,iBAAA,IAA4CN,QAAA,KAA+B;EAC3E,OAAAO,OAAA,EAAAC,UAAA,IAA8BR,QAAA,MAAkB;EAEhD,OAAAS,cAAA,EAAAC,qBAAA,EAAAC,EAAA,IAIIlB,iBAAA,CAAkBS,IAAA;EADpB;IAAAU,WAAA;IAAAC,UAAA,EAAAC;EAAA,IAAAH,EAA4D;EAE9D;IAAAI;EAAA,IAAuBrB,QAAA;EAAA,IAAAsB,EAAA;EAAA,IAAAb,CAAA,QAAAC,MAAA;IAEYY,EAAA,GAAAA,CAAA;MACjCZ,MAAA,CAAAa,IAAA;QACE,MAAAC,SAAA,GAAkBtB,aAAA,MAAmBD,qBAAA;QACrCW,iBAAA,CAAkBY,SAAA;MAAA,CACpB;MACAV,UAAA,KAAW;IAAA;IACbL,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAAa,EAAA;EAAA;IAAAA,EAAA,GAAAb,CAAA;EAAA;EANA,MAAAgB,cAAA,GAAuBH,EAMZ;EAAA,IAAAI,EAAA;EAAA,IAAAjB,CAAA,
|
|
1
|
+
{"version":3,"file":"useLexicalDocumentDrawer.js","names":["c","_c","useLexicalComposerContext","useDocumentDrawer","useModal","$getPreviousSelection","$getSelection","$setSelection","useCallback","useEffect","useState","useLexicalDocumentDrawer","args","$","editor","selectionState","setSelectionState","wasOpen","setWasOpen","DocumentDrawer","DocumentDrawerToggler","t0","closeDrawer","drawerSlug","documentDrawerSlug","modalState","t1","read","selection","storeSelection","t2","update","clone","discrete","skipTransforms","restoreSelection","t3","closeDocumentDrawer","t4","t5","thisModalState","isOpen","setTimeout","t6","props","_jsx","onClick","t7"],"sources":["../../../src/utilities/fieldsDrawer/useLexicalDocumentDrawer.tsx"],"sourcesContent":["'use client'\nimport type { UseDocumentDrawer } from '@payloadcms/ui'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useDocumentDrawer, useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useDocumentDrawer that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalDocumentDrawer = (\n args: Parameters<UseDocumentDrawer>[0],\n): {\n closeDocumentDrawer: () => void\n DocumentDrawer: ReturnType<UseDocumentDrawer>[0]\n documentDrawerSlug: string\n DocumentDrawerToggler: ReturnType<UseDocumentDrawer>[1]\n} => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const [\n DocumentDrawer,\n DocumentDrawerToggler,\n { closeDrawer: closeDrawer, drawerSlug: documentDrawerSlug },\n ] = useDocumentDrawer(args)\n const { modalState } = useModal()\n\n const storeSelection = useCallback(() => {\n editor.read(() => {\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n })\n setWasOpen(true)\n }, [editor])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeDocumentDrawer = () => {\n //restoreSelection() // Should already be stored by the useEffect below\n closeDrawer()\n }\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[documentDrawerSlug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n setTimeout(() => {\n restoreSelection()\n }, 1)\n }\n }, [modalState, documentDrawerSlug, restoreSelection, wasOpen])\n\n return {\n closeDocumentDrawer,\n DocumentDrawer,\n documentDrawerSlug,\n DocumentDrawerToggler: (props) => <DocumentDrawerToggler {...props} onClick={storeSelection} />,\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,iBAAiB,EAAEC,QAAQ,QAAQ;AAC5C,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,aAAa,QAAQ;AACpE,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAEjD;;;;;AAKA,OAAO,MAAMC,wBAAA,GAA2BC,IAAA;EAAA,MAAAC,CAAA,GAAAZ,EAAA;EAQtC,OAAAa,MAAA,IAAiBZ,yBAAA;EACjB,OAAAa,cAAA,EAAAC,iBAAA,IAA4CN,QAAA,KAA+B;EAC3E,OAAAO,OAAA,EAAAC,UAAA,IAA8BR,QAAA,MAAkB;EAEhD,OAAAS,cAAA,EAAAC,qBAAA,EAAAC,EAAA,IAIIlB,iBAAA,CAAkBS,IAAA;EADpB;IAAAU,WAAA;IAAAC,UAAA,EAAAC;EAAA,IAAAH,EAA4D;EAE9D;IAAAI;EAAA,IAAuBrB,QAAA;EAAA,IAAAsB,EAAA;EAAA,IAAAb,CAAA,QAAAC,MAAA;IAEYY,EAAA,GAAAA,CAAA;MACjCZ,M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AAA,MAAW;QACXwB,UAAA;UACEP,gBAAA;QAAA,IACC;MAAA;IAAA;IAEJI,EAAA,IAACd,UAAA,EAAYD,kBAAA,EAAoBW,gBAAA,EAAkBlB,OAAA;IAAQJ,CAAA,MAAAW,kBAAA;IAAAX,CAAA,MAAAY,UAAA;IAAAZ,CAAA,MAAAsB,gBAAA;IAAAtB,CAAA,OAAAI,OAAA;IAAAJ,CAAA,OAAAyB,EAAA;IAAAzB,CAAA,OAAA0B,EAAA;EAAA;IAAAD,EAAA,GAAAzB,CAAA;IAAA0B,EAAA,GAAA1B,CAAA;EAAA;EAb9DJ,SAAA,CAAU6B,EAaV,EAAGC,EAA2D;EAAA,IAAAI,EAAA;EAAA,IAAA9B,CAAA,SAAAO,qBAAA,IAAAP,CAAA,SAAAgB,cAAA;IAMrCc,EAAA,GAAAC,KAAA,IAAWC,IAAA,CAACzB,qBAAA;MAAA,GAA0BwB,KAAK;MAAAE,OAAA,EAAWjB;IAAA,C;;;;;;;;;IAJxEkB,EAAA;MAAAV,mBAAA;MAAAlB,cAAA;MAAAK,kBAAA;MAAAJ,qBAAA,EAIkBuB;;IACzB9B,CAAA,OAAAM,cAAA;IAAAN,CAAA,OAAAwB,mBAAA;IAAAxB,CAAA,OAAAW,kBAAA;IAAAX,CAAA,OAAA8B,EAAA;IAAA9B,CAAA,OAAAkC,EAAA;EAAA;IAAAA,EAAA,GAAAlC,CAAA;EAAA;EAAA,OALOkC,EAKP;AAAA,CACF","ignoreList":[]}
|
|
@@ -35,7 +35,7 @@ export const useLexicalDrawer = (slug, restoreLate) => {
|
|
|
35
35
|
}
|
|
36
36
|
const storeSelection = t0;
|
|
37
37
|
let t1;
|
|
38
|
-
if ($[2] !==
|
|
38
|
+
if ($[2] !== editor || $[3] !== selectionState) {
|
|
39
39
|
t1 = () => {
|
|
40
40
|
if (selectionState) {
|
|
41
41
|
editor.update(() => {
|
|
@@ -46,8 +46,8 @@ export const useLexicalDrawer = (slug, restoreLate) => {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
$[2] =
|
|
50
|
-
$[3] =
|
|
49
|
+
$[2] = editor;
|
|
50
|
+
$[3] = selectionState;
|
|
51
51
|
$[4] = t1;
|
|
52
52
|
} else {
|
|
53
53
|
t1 = $[4];
|
|
@@ -67,7 +67,7 @@ export const useLexicalDrawer = (slug, restoreLate) => {
|
|
|
67
67
|
const closeDrawer = t2;
|
|
68
68
|
const isModalOpen = modalState?.[slug]?.isOpen;
|
|
69
69
|
let t3;
|
|
70
|
-
if ($[8] !== isModalOpen || $[9] !==
|
|
70
|
+
if ($[8] !== isModalOpen || $[9] !== restoreSelection || $[10] !== slug || $[11] !== storeSelection || $[12] !== toggleBaseModal) {
|
|
71
71
|
t3 = () => {
|
|
72
72
|
if (!isModalOpen) {
|
|
73
73
|
storeSelection();
|
|
@@ -78,10 +78,10 @@ export const useLexicalDrawer = (slug, restoreLate) => {
|
|
|
78
78
|
toggleBaseModal(slug);
|
|
79
79
|
};
|
|
80
80
|
$[8] = isModalOpen;
|
|
81
|
-
$[9] =
|
|
82
|
-
$[10] =
|
|
83
|
-
$[11] =
|
|
84
|
-
$[12] =
|
|
81
|
+
$[9] = restoreSelection;
|
|
82
|
+
$[10] = slug;
|
|
83
|
+
$[11] = storeSelection;
|
|
84
|
+
$[12] = toggleBaseModal;
|
|
85
85
|
$[13] = t3;
|
|
86
86
|
} else {
|
|
87
87
|
t3 = $[13];
|
|
@@ -89,7 +89,7 @@ export const useLexicalDrawer = (slug, restoreLate) => {
|
|
|
89
89
|
const toggleDrawer = t3;
|
|
90
90
|
let t4;
|
|
91
91
|
let t5;
|
|
92
|
-
if ($[14] !==
|
|
92
|
+
if ($[14] !== modalState || $[15] !== restoreLate || $[16] !== restoreSelection || $[17] !== slug || $[18] !== wasOpen) {
|
|
93
93
|
t4 = () => {
|
|
94
94
|
if (!wasOpen) {
|
|
95
95
|
return;
|
|
@@ -107,11 +107,11 @@ export const useLexicalDrawer = (slug, restoreLate) => {
|
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
t5 = [modalState, slug, restoreSelection, wasOpen, restoreLate];
|
|
110
|
-
$[14] =
|
|
111
|
-
$[15] =
|
|
112
|
-
$[16] =
|
|
113
|
-
$[17] =
|
|
114
|
-
$[18] =
|
|
110
|
+
$[14] = modalState;
|
|
111
|
+
$[15] = restoreLate;
|
|
112
|
+
$[16] = restoreSelection;
|
|
113
|
+
$[17] = slug;
|
|
114
|
+
$[18] = wasOpen;
|
|
115
115
|
$[19] = t4;
|
|
116
116
|
$[20] = t5;
|
|
117
117
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLexicalDrawer.js","names":["c","_c","useLexicalComposerContext","useModal","$getPreviousSelection","$getSelection","$setSelection","useCallback","useEffect","useState","useLexicalDrawer","slug","restoreLate","$","editor","selectionState","setSelectionState","wasOpen","setWasOpen","closeModal","closeBaseModal","modalState","toggleModal","toggleBaseModal","t0","read","selection","storeSelection","t1","update","clone","discrete","skipTransforms","restoreSelection","t2","closeDrawer","isModalOpen","isOpen","t3","toggleDrawer","t4","t5","thisModalState","setTimeout","t6"],"sources":["../../../src/utilities/fieldsDrawer/useLexicalDrawer.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useModal that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalDrawer = (slug: string, restoreLate?: boolean) => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const { closeModal: closeBaseModal, modalState, toggleModal: toggleBaseModal } = useModal()\n\n const storeSelection = useCallback(() => {\n editor.read(() => {\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n })\n }, [editor])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeDrawer = useCallback(() => {\n //restoreSelection() // Should already be stored by the useEffect below\n closeBaseModal(slug)\n }, [closeBaseModal, slug])\n const isModalOpen = modalState?.[slug]?.isOpen\n\n const toggleDrawer = useCallback(() => {\n if (!isModalOpen) {\n storeSelection()\n } else {\n restoreSelection()\n }\n setWasOpen(true)\n toggleBaseModal(slug)\n }, [slug, storeSelection, toggleBaseModal, restoreSelection, isModalOpen])\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[slug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n\n if (restoreLate) {\n // restoreLate is used for upload extra field drawers. For some reason, the selection is not restored if we call restoreSelection immediately.\n setTimeout(() => {\n restoreSelection()\n }, 0)\n } else {\n restoreSelection()\n }\n }\n }, [modalState, slug, restoreSelection, wasOpen, restoreLate])\n\n return {\n closeDrawer,\n toggleDrawer,\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,QAAQ,QAAQ;AACzB,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,aAAa,QAAQ;AACpE,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAEjD;;;;;AAKA,OAAO,MAAMC,gBAAA,GAAmBA,CAAAC,IAAA,EAAAC,WAAA;EAAA,MAAAC,CAAA,GAAAZ,EAAA;EAC9B,OAAAa,MAAA,IAAiBZ,yBAAA;EACjB,OAAAa,cAAA,EAAAC,iBAAA,IAA4CP,QAAA,KAA+B;EAC3E,OAAAQ,OAAA,EAAAC,UAAA,IAA8BT,QAAA,MAAkB;EAEhD;IAAAU,UAAA,EAAAC,cAAA;IAAAC,UAAA;IAAAC,WAAA,EAAAC;EAAA,IAAiFpB,QAAA;EAAA,IAAAqB,EAAA;EAAA,IAAAX,CAAA,QAAAC,MAAA;IAE9CU,EAAA,GAAAA,CAAA;MACjCV,MAAA,CAAAW,IAAA;QACE,MAAAC,SAAA,GAAkBrB,aAAA,MAAmBD,qBAAA;QACrCY,iBAAA,CAAkBU,SAAA;MAAA,CACpB;IAAA;IACFb,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAAW,EAAA;EAAA;IAAAA,EAAA,GAAAX,CAAA;EAAA;EALA,MAAAc,cAAA,GAAuBH,EAKZ;EAAA,IAAAI,EAAA;EAAA,IAAAf,CAAA,
|
|
1
|
+
{"version":3,"file":"useLexicalDrawer.js","names":["c","_c","useLexicalComposerContext","useModal","$getPreviousSelection","$getSelection","$setSelection","useCallback","useEffect","useState","useLexicalDrawer","slug","restoreLate","$","editor","selectionState","setSelectionState","wasOpen","setWasOpen","closeModal","closeBaseModal","modalState","toggleModal","toggleBaseModal","t0","read","selection","storeSelection","t1","update","clone","discrete","skipTransforms","restoreSelection","t2","closeDrawer","isModalOpen","isOpen","t3","toggleDrawer","t4","t5","thisModalState","setTimeout","t6"],"sources":["../../../src/utilities/fieldsDrawer/useLexicalDrawer.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useModal that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalDrawer = (slug: string, restoreLate?: boolean) => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const { closeModal: closeBaseModal, modalState, toggleModal: toggleBaseModal } = useModal()\n\n const storeSelection = useCallback(() => {\n editor.read(() => {\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n })\n }, [editor])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeDrawer = useCallback(() => {\n //restoreSelection() // Should already be stored by the useEffect below\n closeBaseModal(slug)\n }, [closeBaseModal, slug])\n const isModalOpen = modalState?.[slug]?.isOpen\n\n const toggleDrawer = useCallback(() => {\n if (!isModalOpen) {\n storeSelection()\n } else {\n restoreSelection()\n }\n setWasOpen(true)\n toggleBaseModal(slug)\n }, [slug, storeSelection, toggleBaseModal, restoreSelection, isModalOpen])\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[slug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n\n if (restoreLate) {\n // restoreLate is used for upload extra field drawers. For some reason, the selection is not restored if we call restoreSelection immediately.\n setTimeout(() => {\n restoreSelection()\n }, 0)\n } else {\n restoreSelection()\n }\n }\n }, [modalState, slug, restoreSelection, wasOpen, restoreLate])\n\n return {\n closeDrawer,\n toggleDrawer,\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,QAAQ,QAAQ;AACzB,SAASC,qBAAqB,EAAE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,gBAAA;UAAA,IACC;QAAA;UAEHA,gBAAA;QAAA;MAAA;IAAA;IAGHQ,EAAA,IAACpB,UAAA,EAAYV,IAAA,EAAMsB,gBAAA,EAAkBhB,OAAA,EAASL,WAAA;IAAYC,CAAA,OAAAQ,UAAA;IAAAR,CAAA,OAAAD,WAAA;IAAAC,CAAA,OAAAoB,gBAAA;IAAApB,CAAA,OAAAF,IAAA;IAAAE,CAAA,OAAAI,OAAA;IAAAJ,CAAA,OAAA2B,EAAA;IAAA3B,CAAA,OAAA4B,EAAA;EAAA;IAAAD,EAAA,GAAA3B,CAAA;IAAA4B,EAAA,GAAA5B,CAAA;EAAA;EAnB7DL,SAAA,CAAUgC,EAmBV,EAAGC,EAA0D;EAAA,IAAAG,EAAA;EAAA,IAAA/B,CAAA,SAAAsB,WAAA,IAAAtB,CAAA,SAAA0B,YAAA;IAEtDK,EAAA;MAAAT,WAAA;MAAAI;IAAA;IAGP1B,CAAA,OAAAsB,WAAA;IAAAtB,CAAA,OAAA0B,YAAA;IAAA1B,CAAA,OAAA+B,EAAA;EAAA;IAAAA,EAAA,GAAA/B,CAAA;EAAA;EAAA,OAHO+B,EAGP;AAAA,CACF","ignoreList":[]}
|
|
@@ -38,7 +38,7 @@ export const useLexicalListDrawer = args => {
|
|
|
38
38
|
}
|
|
39
39
|
const $storeSelection = t1;
|
|
40
40
|
let t2;
|
|
41
|
-
if ($[1] !==
|
|
41
|
+
if ($[1] !== editor || $[2] !== selectionState) {
|
|
42
42
|
t2 = () => {
|
|
43
43
|
if (selectionState) {
|
|
44
44
|
editor.update(() => {
|
|
@@ -49,8 +49,8 @@ export const useLexicalListDrawer = args => {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
$[1] =
|
|
53
|
-
$[2] =
|
|
52
|
+
$[1] = editor;
|
|
53
|
+
$[2] = selectionState;
|
|
54
54
|
$[3] = t2;
|
|
55
55
|
} else {
|
|
56
56
|
t2 = $[3];
|
|
@@ -69,7 +69,7 @@ export const useLexicalListDrawer = args => {
|
|
|
69
69
|
const closeListDrawer = t3;
|
|
70
70
|
let t4;
|
|
71
71
|
let t5;
|
|
72
|
-
if ($[6] !==
|
|
72
|
+
if ($[6] !== listDrawerSlug || $[7] !== modalState || $[8] !== restoreSelection || $[9] !== wasOpen) {
|
|
73
73
|
t4 = () => {
|
|
74
74
|
if (!wasOpen) {
|
|
75
75
|
return;
|
|
@@ -83,10 +83,10 @@ export const useLexicalListDrawer = args => {
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
t5 = [modalState, listDrawerSlug, restoreSelection, wasOpen];
|
|
86
|
-
$[6] =
|
|
86
|
+
$[6] = listDrawerSlug;
|
|
87
87
|
$[7] = modalState;
|
|
88
|
-
$[8] =
|
|
89
|
-
$[9] =
|
|
88
|
+
$[8] = restoreSelection;
|
|
89
|
+
$[9] = wasOpen;
|
|
90
90
|
$[10] = t4;
|
|
91
91
|
$[11] = t5;
|
|
92
92
|
} else {
|
|
@@ -120,7 +120,7 @@ export const useLexicalListDrawer = args => {
|
|
|
120
120
|
t7 = $[15];
|
|
121
121
|
}
|
|
122
122
|
let t8;
|
|
123
|
-
if ($[16] !==
|
|
123
|
+
if ($[16] !== BaseListDrawer || $[17] !== closeListDrawer || $[18] !== isDrawerOpen || $[19] !== listDrawerSlug || $[20] !== t6 || $[21] !== t7) {
|
|
124
124
|
t8 = {
|
|
125
125
|
closeListDrawer,
|
|
126
126
|
isListDrawerOpen: isDrawerOpen,
|
|
@@ -129,9 +129,9 @@ export const useLexicalListDrawer = args => {
|
|
|
129
129
|
ListDrawerToggler: t6,
|
|
130
130
|
openListDrawer: t7
|
|
131
131
|
};
|
|
132
|
-
$[16] =
|
|
133
|
-
$[17] =
|
|
134
|
-
$[18] =
|
|
132
|
+
$[16] = BaseListDrawer;
|
|
133
|
+
$[17] = closeListDrawer;
|
|
134
|
+
$[18] = isDrawerOpen;
|
|
135
135
|
$[19] = listDrawerSlug;
|
|
136
136
|
$[20] = t6;
|
|
137
137
|
$[21] = t7;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLexicalListDrawer.js","names":["c","_c","useLexicalComposerContext","useListDrawer","useModal","$getPreviousSelection","$getSelection","$setSelection","useCallback","useEffect","useState","useLexicalListDrawer","args","$","editor","selectionState","setSelectionState","wasOpen","setWasOpen","BaseListDrawer","BaseListDrawerToggler","t0","closeDrawer","baseCloseDrawer","drawerSlug","listDrawerSlug","isDrawerOpen","openDrawer","baseOpenDrawer","modalState","t1","Symbol","for","selection","$storeSelection","t2","update","clone","discrete","skipTransforms","restoreSelection","t3","closeListDrawer","t4","t5","thisModalState","isOpen","setTimeout","t6","props","_jsx","onClick","t7","t8","isListDrawerOpen","ListDrawer","ListDrawerToggler"],"sources":["../../../src/utilities/fieldsDrawer/useLexicalListDrawer.tsx"],"sourcesContent":["'use client'\nimport type { UseListDrawer } from '@payloadcms/ui'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useListDrawer, useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useListDrawer that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalListDrawer = (\n args: Parameters<UseListDrawer>[0],\n): {\n closeListDrawer: () => void\n isListDrawerOpen: boolean\n ListDrawer: ReturnType<UseListDrawer>[0]\n listDrawerSlug: string\n ListDrawerToggler: ReturnType<UseListDrawer>[1]\n openListDrawer: (selection?: BaseSelection) => void\n} => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const [\n BaseListDrawer,\n BaseListDrawerToggler,\n {\n closeDrawer: baseCloseDrawer,\n drawerSlug: listDrawerSlug,\n isDrawerOpen,\n openDrawer: baseOpenDrawer,\n },\n ] = useListDrawer(args)\n const { modalState } = useModal()\n\n const $storeSelection = useCallback(() => {\n // editor.read() causes an error here when creating a new upload node from the slash menu. It seems like we can omit it here though, as all\n // invocations of that functions are wrapped in editor.read() or editor.update() somewhere in the call stack.\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n }, [])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeListDrawer = () => {\n //restoreSelection() // Should already be stored by the useEffect below\n baseCloseDrawer()\n }\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[listDrawerSlug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n setTimeout(() => {\n restoreSelection()\n }, 1)\n }\n }, [modalState, listDrawerSlug, restoreSelection, wasOpen])\n\n return {\n closeListDrawer,\n isListDrawerOpen: isDrawerOpen,\n ListDrawer: BaseListDrawer,\n listDrawerSlug,\n ListDrawerToggler: (props) => (\n <BaseListDrawerToggler\n {...props}\n onClick={() => {\n $storeSelection()\n }}\n />\n ),\n openListDrawer: () => {\n $storeSelection()\n baseOpenDrawer()\n setWasOpen(true)\n },\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,aAAa,EAAEC,QAAQ,QAAQ;AACxC,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,aAAa,QAAQ;AACpE,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAEjD;;;;;AAKA,OAAO,MAAMC,oBAAA,GAAuBC,IAAA;EAAA,MAAAC,CAAA,GAAAZ,EAAA;EAUlC,OAAAa,MAAA,IAAiBZ,yBAAA;EACjB,OAAAa,cAAA,EAAAC,iBAAA,IAA4CN,QAAA,KAA+B;EAC3E,OAAAO,OAAA,EAAAC,UAAA,IAA8BR,QAAA,MAAkB;EAEhD,OAAAS,cAAA,EAAAC,qBAAA,EAAAC,EAAA,IASIlB,aAAA,CAAcS,IAAA;EANhB;IAAAU,WAAA,EAAAC,eAAA;IAAAC,UAAA,EAAAC,cAAA;IAAAC,YAAA;IAAAC,UAAA,EAAAC;EAAA,IAAAP,EAKC;EAEH;IAAAQ;EAAA,IAAuBzB,QAAA;EAAA,IAAA0B,EAAA;EAAA,IAAAjB,CAAA,QAAAkB,MAAA,CAAAC,GAAA;IAEaF,EAAA,GAAAA,CAAA;MAGlC,MAAAG,SAAA,GAAkB3B,aAAA,MAAmBD,qBAAA;MACrCW,iBAAA,CAAkBiB,SAAA;IAAA;IACpBpB,CAAA,MAAAiB,EAAA;EAAA;IAAAA,EAAA,GAAAjB,CAAA;EAAA;EALA,MAAAqB,eAAA,GAAwBJ,EAKnB;EAAA,IAAAK,EAAA;EAAA,IAAAtB,CAAA,
|
|
1
|
+
{"version":3,"file":"useLexicalListDrawer.js","names":["c","_c","useLexicalComposerContext","useListDrawer","useModal","$getPreviousSelection","$getSelection","$setSelection","useCallback","useEffect","useState","useLexicalListDrawer","args","$","editor","selectionState","setSelectionState","wasOpen","setWasOpen","BaseListDrawer","BaseListDrawerToggler","t0","closeDrawer","baseCloseDrawer","drawerSlug","listDrawerSlug","isDrawerOpen","openDrawer","baseOpenDrawer","modalState","t1","Symbol","for","selection","$storeSelection","t2","update","clone","discrete","skipTransforms","restoreSelection","t3","closeListDrawer","t4","t5","thisModalState","isOpen","setTimeout","t6","props","_jsx","onClick","t7","t8","isListDrawerOpen","ListDrawer","ListDrawerToggler"],"sources":["../../../src/utilities/fieldsDrawer/useLexicalListDrawer.tsx"],"sourcesContent":["'use client'\nimport type { UseListDrawer } from '@payloadcms/ui'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useListDrawer, useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useListDrawer that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalListDrawer = (\n args: Parameters<UseListDrawer>[0],\n): {\n closeListDrawer: () => void\n isListDrawerOpen: boolean\n ListDrawer: ReturnType<UseListDrawer>[0]\n listDrawerSlug: string\n ListDrawerToggler: ReturnType<UseListDrawer>[1]\n openListDrawer: (selection?: BaseSelection) => void\n} => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const [\n BaseListDrawer,\n BaseListDrawerToggler,\n {\n closeDrawer: baseCloseDrawer,\n drawerSlug: listDrawerSlug,\n isDrawerOpen,\n openDrawer: baseOpenDrawer,\n },\n ] = useListDrawer(args)\n const { modalState } = useModal()\n\n const $storeSelection = useCallback(() => {\n // editor.read() causes an error here when creating a new upload node from the slash menu. It seems like we can omit it here though, as all\n // invocations of that functions are wrapped in editor.read() or editor.update() somewhere in the call stack.\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n }, [])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeListDrawer = () => {\n //restoreSelection() // Should already be stored by the useEffect below\n baseCloseDrawer()\n }\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[listDrawerSlug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n setTimeout(() => {\n restoreSelection()\n }, 1)\n }\n }, [modalState, listDrawerSlug, restoreSelection, wasOpen])\n\n return {\n closeListDrawer,\n isListDrawerOpen: isDrawerOpen,\n ListDrawer: BaseListDrawer,\n listDrawerSlug,\n ListDrawerToggler: (props) => (\n <BaseListDrawerToggler\n {...props}\n onClick={() => {\n $storeSelection()\n }}\n />\n ),\n openListDrawer: () => {\n $storeSelection()\n baseOpenDrawer()\n setWasOpen(true)\n },\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,aAAa,EAAEC,QAAQ,QAAQ;AACxC,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,aAAa,QAAQ;AACpE,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAEjD;;;;;AAKA,OAAO,MAAMC,oBAAA,GAAuBC,IAAA;EAAA,MAAAC,CAAA,GAAAZ,EAAA;EAUlC,OAAAa,MAAA,IAAiBZ,yBAAA;EACjB,OAAAa,cAAA,EAAAC,iBAAA,IAA4CN,QAAA,KAA+B;EAC3E,OAAAO,OAAA,EAAAC,UAAA,IAA8BR,QAAA,MAAkB;EAEhD,OAAAS,cAAA,EAAAC,qBAAA,EAAAC,EAAA,IASIlB,aAAA,CAAcS,IAAA;EANhB;IAAAU,WAAA,EAAAC,eAAA;IAAAC,UAAA,EAAAC,cAAA;IAAAC,YAAA;IAAAC,UAAA,EAAAC;EAAA,IAAAP,EAKC;EAEH;IAAAQ;EAAA,IAAuBzB,QAAA;EAAA,IAAA0B,EAAA;EAAA,IAAAjB,CAAA,QAAAkB,MAAA,CAAAC,GAAA;IAEaF,EAAA,GAAAA,CAAA;MAGlC,MAAAG,SAAA,GAAkB3B,aAAA,MAAmBD,qBAA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