@payloadcms/richtext-lexical 3.0.0-beta.60 → 3.0.0-beta.61
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-5TCNFYE2.js → Field-4A7IEODI.js} +2 -2
- package/dist/exports/client/{Field-5TCNFYE2.js.map → Field-4A7IEODI.js.map} +1 -1
- package/dist/exports/client/{RelationshipComponent-AFXEJMZQ.js → RelationshipComponent-EJB6LBDR.js} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-YL52LJO3.js → chunk-LGMNC5KQ.js} +2 -2
- package/dist/exports/client/{chunk-YL52LJO3.js.map → chunk-LGMNC5KQ.js.map} +1 -1
- package/dist/exports/client/{chunk-CUMDYP5E.js → chunk-M6Q5FGTK.js} +2 -2
- package/dist/exports/client/{chunk-CUMDYP5E.js.map → chunk-M6Q5FGTK.js.map} +2 -2
- package/dist/exports/client/{chunk-3K3B6PJM.js → chunk-QZIAQPM7.js} +1 -1
- package/dist/exports/client/{chunk-3K3B6PJM.js.map → chunk-QZIAQPM7.js.map} +1 -1
- package/dist/exports/client/{chunk-JIP5PWU3.js → chunk-SVDDFJRT.js} +1 -1
- package/dist/exports/client/{chunk-JIP5PWU3.js.map → chunk-SVDDFJRT.js.map} +2 -2
- package/dist/exports/client/{component-RV346GAA.js → component-X4T7AVHY.js} +2 -2
- package/dist/exports/client/{component-LE2NQ25I.js → component-Z5R2PHH3.js} +2 -2
- package/dist/exports/client/index.js +3 -3
- package/dist/exports/client/index.js.map +2 -2
- package/dist/features/converters/html/converter/types.d.ts +2 -2
- package/dist/features/converters/html/converter/types.d.ts.map +1 -1
- package/dist/features/converters/html/converter/types.js.map +1 -1
- package/dist/features/link/feature.server.d.ts +2 -2
- package/dist/features/link/feature.server.d.ts.map +1 -1
- package/dist/features/link/feature.server.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.js +0 -1
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/validate.d.ts.map +1 -1
- package/dist/features/link/validate.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/types.d.ts +2 -2
- package/dist/features/migrations/lexicalPluginToLexical/converter/types.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/types.js.map +1 -1
- package/dist/features/relationship/feature.client.d.ts +4 -4
- package/dist/features/relationship/feature.server.d.ts +2 -2
- package/dist/features/relationship/feature.server.d.ts.map +1 -1
- package/dist/features/relationship/feature.server.js.map +1 -1
- package/dist/features/relationship/nodes/RelationshipNode.d.ts +2 -2
- package/dist/features/relationship/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +0 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/typesClient.d.ts +4 -4
- package/dist/features/typesClient.d.ts.map +1 -1
- package/dist/features/typesClient.js.map +1 -1
- package/dist/features/typesServer.d.ts +6 -6
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/feature.server.js.map +1 -1
- package/dist/features/upload/nodes/UploadNode.d.ts +2 -2
- package/dist/features/upload/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/nodes/UploadNode.js +0 -1
- package/dist/features/upload/nodes/UploadNode.js.map +1 -1
- package/dist/field/Field.d.ts +2 -2
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js.map +1 -1
- package/dist/field/index.js +8 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.d.ts +2 -2
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/LexicalProvider.d.ts +2 -2
- package/dist/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts +4 -4
- package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +0 -2
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +5 -5
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/nodeTypes.d.ts +1 -1
- package/dist/nodeTypes.d.ts.map +1 -1
- package/dist/nodeTypes.js.map +1 -1
- package/dist/populateGraphQL/populate.d.ts +2 -2
- package/dist/populateGraphQL/populate.d.ts.map +1 -1
- package/dist/populateGraphQL/populate.js.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +2 -2
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/createServerFeature.d.ts +2 -2
- package/dist/utilities/createServerFeature.d.ts.map +1 -1
- package/dist/utilities/createServerFeature.js.map +1 -1
- package/package.json +18 -17
- /package/dist/exports/client/{RelationshipComponent-AFXEJMZQ.js.map → RelationshipComponent-EJB6LBDR.js.map} +0 -0
- /package/dist/exports/client/{component-RV346GAA.js.map → component-X4T7AVHY.js.map} +0 -0
- /package/dist/exports/client/{component-LE2NQ25I.js.map → component-Z5R2PHH3.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand, LexicalEditor, TextNode } from 'lexical'\nimport type { JSX, MutableRefObject, ReactPortal } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_ENTER_COMMAND,\n KEY_ESCAPE_COMMAND,\n KEY_TAB_COMMAND,\n createCommand,\n} from 'lexical'\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport type { MenuTextMatch } from '../useMenuTriggerMatch.js'\nimport type { SlashMenuGroupInternal, SlashMenuItem, SlashMenuItemInternal } from './types.js'\n\nexport type MenuResolution = {\n getRect: () => DOMRect\n match?: MenuTextMatch\n}\n\nconst baseClass = 'slash-menu-popup'\n\nexport type MenuRenderFn = (\n anchorElementRef: MutableRefObject<HTMLElement | null>,\n itemProps: {\n groups: Array<SlashMenuGroupInternal>\n selectItemAndCleanUp: (selectedItem: SlashMenuItem) => void\n selectedItemKey: null | string\n setSelectedItemKey: (itemKey: string) => void\n },\n matchingString: null | string,\n) => JSX.Element | ReactPortal | null\n\nconst scrollIntoViewIfNeeded = (target: HTMLElement) => {\n const typeaheadContainerNode = document.getElementById('slash-menu')\n if (!typeaheadContainerNode) return\n\n const typeaheadRect = typeaheadContainerNode.getBoundingClientRect()\n\n if (typeaheadRect.top + typeaheadRect.height > window.innerHeight) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n if (typeaheadRect.top < 0) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n target.scrollIntoView({ block: 'nearest' })\n}\n\n/**\n * Walk backwards along user input and forward through entity title to try\n * and replace more of the user's text with entity.\n */\nfunction getFullMatchOffset(documentText: string, entryText: string, offset: number) {\n let triggerOffset = offset\n for (let i = triggerOffset; i <= entryText.length; i++) {\n if (documentText.substring(documentText.length - i) === entryText.substring(0, i)) {\n triggerOffset = i\n }\n }\n return triggerOffset\n}\n\n/**\n * Split Lexical TextNode and return a new TextNode only containing matched text.\n * Common use cases include: removing the node, replacing with a new node.\n */\nfunction $splitNodeContainingQuery(match: MenuTextMatch): TextNode | null {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) || !selection.isCollapsed()) {\n return null\n }\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 selectionOffset = anchor.offset\n const textContent = anchorNode.getTextContent().slice(0, selectionOffset)\n // eslint-disable-next-line react/destructuring-assignment\n const characterOffset = match.replaceableString.length\n // eslint-disable-next-line react/destructuring-assignment\n const queryOffset = getFullMatchOffset(textContent, match.matchingString, characterOffset)\n const startOffset = selectionOffset - queryOffset\n if (startOffset < 0) {\n return null\n }\n let newNode\n if (startOffset === 0) {\n ;[newNode] = anchorNode.splitText(selectionOffset)\n } else {\n ;[, newNode] = anchorNode.splitText(startOffset, selectionOffset)\n }\n\n return newNode\n}\n\n// Got from https://stackoverflow.com/a/42543908/2013580\nexport function getScrollParent(\n element: HTMLElement,\n includeHidden: boolean,\n): HTMLBodyElement | HTMLElement {\n let style = getComputedStyle(element)\n const excludeStaticParent = style.position === 'absolute'\n const overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/\n if (style.position === 'fixed') {\n return document.body\n }\n for (let parent: HTMLElement | null = element; (parent = parent.parentElement); ) {\n style = getComputedStyle(parent)\n if (excludeStaticParent && style.position === 'static') {\n continue\n }\n if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) {\n return parent\n }\n }\n return document.body\n}\n\nfunction isTriggerVisibleInNearestScrollContainer(\n targetElement: HTMLElement,\n containerElement: HTMLElement,\n): boolean {\n const tRect = targetElement.getBoundingClientRect()\n const cRect = containerElement.getBoundingClientRect()\n return tRect.top > cRect.top && tRect.top < cRect.bottom\n}\n\n// Reposition the menu on scroll, window resize, and element resize.\nexport function useDynamicPositioning(\n resolution: MenuResolution | null,\n targetElement: HTMLElement | null,\n onReposition: () => void,\n onVisibilityChange?: (isInView: boolean) => void,\n) {\n const [editor] = useLexicalComposerContext()\n useEffect(() => {\n if (targetElement != null && resolution != null) {\n const rootElement = editor.getRootElement()\n const rootScrollParent =\n rootElement != null ? getScrollParent(rootElement, false) : document.body\n let ticking = false\n let previousIsInView = isTriggerVisibleInNearestScrollContainer(\n targetElement,\n rootScrollParent,\n )\n const handleScroll = function () {\n if (!ticking) {\n window.requestAnimationFrame(function () {\n onReposition()\n ticking = false\n })\n ticking = true\n }\n const isInView = isTriggerVisibleInNearestScrollContainer(targetElement, rootScrollParent)\n if (isInView !== previousIsInView) {\n previousIsInView = isInView\n if (onVisibilityChange != null) {\n onVisibilityChange(isInView)\n }\n }\n }\n const resizeObserver = new ResizeObserver(onReposition)\n window.addEventListener('resize', onReposition)\n document.addEventListener('scroll', handleScroll, {\n capture: true,\n passive: true,\n })\n resizeObserver.observe(targetElement)\n return () => {\n resizeObserver.unobserve(targetElement)\n window.removeEventListener('resize', onReposition)\n document.removeEventListener('scroll', handleScroll, true)\n }\n }\n }, [targetElement, editor, onVisibilityChange, onReposition, resolution])\n}\n\nexport const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND: LexicalCommand<{\n index: number\n item: SlashMenuItemInternal\n}> = createCommand('SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND')\n\nexport function LexicalMenu({\n anchorElementRef,\n close,\n editor,\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n groups,\n menuRenderFn,\n onSelectItem,\n resolution,\n shouldSplitNodeWithQuery = false,\n}: {\n anchorElementRef: MutableRefObject<HTMLElement>\n close: () => void\n editor: LexicalEditor\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\n onSelectItem: (\n item: SlashMenuItem,\n textNodeContainingQuery: TextNode | null,\n closeMenu: () => void,\n matchingString: string,\n ) => void\n resolution: MenuResolution\n shouldSplitNodeWithQuery?: boolean\n}): JSX.Element | null {\n const [selectedItemKey, setSelectedItemKey] = useState<null | string>(null)\n\n const matchingString = (resolution.match && resolution.match.matchingString) || ''\n\n const updateSelectedItem = useCallback(\n (item: SlashMenuItem) => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.setAttribute('aria-activedescendant', `${baseClass}__item-${item.key}`)\n setSelectedItemKey(item.key)\n }\n },\n [editor],\n )\n\n const setSelectedItemKeyToFirstMatchingItem = useCallback(() => {\n // set selected item to the first of the matching ones\n if (groups !== null && matchingString != null) {\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n const allItems = groups.flatMap((group) => group.items)\n\n if (allItems.length) {\n const firstMatchingItem = allItems[0]\n updateSelectedItem(firstMatchingItem)\n }\n }\n }, [groups, updateSelectedItem, matchingString])\n\n useEffect(() => {\n setSelectedItemKeyToFirstMatchingItem()\n }, [matchingString, setSelectedItemKeyToFirstMatchingItem])\n\n const selectItemAndCleanUp = useCallback(\n (selectedItem: SlashMenuItem) => {\n editor.update(() => {\n const textNodeContainingQuery =\n resolution.match != null && shouldSplitNodeWithQuery\n ? $splitNodeContainingQuery(resolution.match)\n : null\n\n onSelectItem(\n selectedItem,\n textNodeContainingQuery,\n close,\n resolution.match ? resolution.match.matchingString : '',\n )\n })\n },\n [editor, shouldSplitNodeWithQuery, resolution.match, onSelectItem, close],\n )\n\n useEffect(() => {\n return () => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.removeAttribute('aria-activedescendant')\n }\n }\n }, [editor])\n\n useLayoutEffect(() => {\n if (groups === null) {\n setSelectedItemKey(null)\n } else if (selectedItemKey === null) {\n setSelectedItemKeyToFirstMatchingItem()\n }\n }, [groups, selectedItemKey, updateSelectedItem, setSelectedItemKeyToFirstMatchingItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND,\n ({ item }) => {\n if (item.ref && item.ref.current != null) {\n scrollIntoViewIfNeeded(item.ref.current)\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, updateSelectedItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_DOWN_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== allItems.length - 1 ? selectedIndex + 1 : 0\n\n const newSelectedItem = allItems[newSelectedIndex]\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n editor.dispatchCommand(SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND, {\n index: newSelectedIndex,\n item: newSelectedItem,\n })\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_UP_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== 0 ? selectedIndex - 1 : allItems.length - 1\n\n const newSelectedItem = allItems[newSelectedIndex]\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n scrollIntoViewIfNeeded(newSelectedItem.ref.current)\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ESCAPE_COMMAND,\n (payload) => {\n const event = payload\n event.preventDefault()\n event.stopImmediatePropagation()\n close()\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (payload) => {\n const event = payload\n\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n event.preventDefault()\n event.stopImmediatePropagation()\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ENTER_COMMAND,\n (event: KeyboardEvent | null) => {\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n if (event !== null) {\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [selectItemAndCleanUp, close, editor, groups, selectedItemKey, updateSelectedItem])\n\n const listItemProps = useMemo(\n () => ({\n groups,\n selectItemAndCleanUp,\n selectedItemKey,\n setSelectedItemKey,\n }),\n [selectItemAndCleanUp, selectedItemKey, groups],\n )\n\n return menuRenderFn(\n anchorElementRef,\n listItemProps,\n resolution.match ? resolution.match.matchingString : '',\n )\n}\n\nexport function useMenuAnchorRef(\n anchorElem: HTMLElement,\n resolution: MenuResolution | null,\n setResolution: (r: MenuResolution | null) => void,\n className?: string,\n): MutableRefObject<HTMLElement> {\n const [editor] = useLexicalComposerContext()\n const anchorElementRef = useRef<HTMLElement>(document.createElement('div'))\n const positionMenu = useCallback(() => {\n const rootElement = editor.getRootElement()\n const containerDiv = anchorElementRef.current\n\n const VERTICAL_OFFSET = 32\n\n const menuEle = containerDiv.firstChild as Element\n if (rootElement !== null && resolution !== null) {\n const { height, width } = resolution.getRect()\n let { left, top } = resolution.getRect()\n\n const rawTop = top\n top -= anchorElem.getBoundingClientRect().top + window.scrollY\n left -= anchorElem.getBoundingClientRect().left + window.scrollX\n containerDiv.style.left = `${left + window.scrollX}px`\n containerDiv.style.height = `${height}px`\n containerDiv.style.width = `${width}px`\n if (menuEle !== null) {\n const menuRect = menuEle.getBoundingClientRect()\n const menuHeight = menuRect.height\n const menuWidth = menuRect.width\n\n const rootElementRect = rootElement.getBoundingClientRect()\n\n if (left + menuWidth > rootElementRect.right) {\n containerDiv.style.left = `${rootElementRect.right - menuWidth + window.scrollX}px`\n }\n\n const wouldGoOffBottomOfScreen = rawTop + menuHeight + VERTICAL_OFFSET > window.innerHeight\n //const wouldGoOffBottomOfContainer = top + menuHeight > rootElementRect.bottom\n const wouldGoOffTopOfScreen = rawTop < 0\n\n // Position slash menu above the cursor instead of below (default) if it would otherwise go off the bottom of the screen.\n if (wouldGoOffBottomOfScreen && !wouldGoOffTopOfScreen) {\n const margin = 24\n containerDiv.style.top = `${\n top + VERTICAL_OFFSET - menuHeight + window.scrollY - (height + margin)\n }px`\n } else {\n containerDiv.style.top = `${top + window.scrollY + VERTICAL_OFFSET}px`\n }\n }\n\n if (!containerDiv.isConnected) {\n if (className != null) {\n containerDiv.className = className\n }\n containerDiv.setAttribute('aria-label', 'Slash menu')\n containerDiv.setAttribute('id', 'slash-menu')\n containerDiv.setAttribute('role', 'listbox')\n containerDiv.style.display = 'block'\n containerDiv.style.position = 'absolute'\n anchorElem.append(containerDiv)\n }\n anchorElementRef.current = containerDiv\n rootElement.setAttribute('aria-controls', 'slash-menu')\n }\n }, [editor, resolution, className, anchorElem])\n\n useEffect(() => {\n const rootElement = editor.getRootElement()\n if (resolution !== null) {\n positionMenu()\n return () => {\n if (rootElement !== null) {\n rootElement.removeAttribute('aria-controls')\n }\n\n const containerDiv = anchorElementRef.current\n if (containerDiv !== null && containerDiv.isConnected) {\n containerDiv.remove()\n }\n }\n }\n }, [editor, positionMenu, resolution])\n\n const onVisibilityChange = useCallback(\n (isInView: boolean) => {\n if (resolution !== null) {\n if (!isInView) {\n setResolution(null)\n }\n }\n },\n [resolution, setResolution],\n )\n\n useDynamicPositioning(resolution, anchorElementRef.current, positionMenu, onVisibilityChange)\n\n return anchorElementRef\n}\n"],"names":["useLexicalComposerContext","mergeRegister","$getSelection","$isRangeSelection","COMMAND_PRIORITY_LOW","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_ENTER_COMMAND","KEY_ESCAPE_COMMAND","KEY_TAB_COMMAND","createCommand","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","baseClass","scrollIntoViewIfNeeded","target","typeaheadContainerNode","document","getElementById","typeaheadRect","getBoundingClientRect","top","height","window","innerHeight","scrollIntoView","block","getFullMatchOffset","documentText","entryText","offset","triggerOffset","i","length","substring","$splitNodeContainingQuery","match","selection","isCollapsed","anchor","type","anchorNode","getNode","isSimpleText","selectionOffset","textContent","getTextContent","slice","characterOffset","replaceableString","queryOffset","matchingString","startOffset","newNode","splitText","getScrollParent","element","includeHidden","style","getComputedStyle","excludeStaticParent","position","overflowRegex","body","parent","parentElement","test","overflow","overflowY","overflowX","isTriggerVisibleInNearestScrollContainer","targetElement","containerElement","tRect","cRect","bottom","useDynamicPositioning","resolution","onReposition","onVisibilityChange","editor","rootElement","getRootElement","rootScrollParent","ticking","previousIsInView","handleScroll","requestAnimationFrame","isInView","resizeObserver","ResizeObserver","addEventListener","capture","passive","observe","unobserve","removeEventListener","SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND","LexicalMenu","anchorElementRef","close","groups","menuRenderFn","onSelectItem","shouldSplitNodeWithQuery","selectedItemKey","setSelectedItemKey","updateSelectedItem","item","rootElem","setAttribute","key","setSelectedItemKeyToFirstMatchingItem","allItems","flatMap","group","items","firstMatchingItem","selectItemAndCleanUp","selectedItem","update","textNodeContainingQuery","removeAttribute","registerCommand","ref","current","payload","event","selectedIndex","findIndex","newSelectedIndex","newSelectedItem","dispatchCommand","index","preventDefault","stopImmediatePropagation","find","listItemProps","useMenuAnchorRef","anchorElem","setResolution","className","createElement","positionMenu","containerDiv","VERTICAL_OFFSET","menuEle","firstChild","width","getRect","left","rawTop","scrollY","scrollX","menuRect","menuHeight","menuWidth","rootElementRect","right","wouldGoOffBottomOfScreen","wouldGoOffTopOfScreen","margin","isConnected","display","append","remove"],"mappings":"AAAA;AAIA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SACEC,aAAa,EACbC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,EACtBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAe,EACfC,aAAa,QACR,UAAS;AAChB,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAU1F,MAAMC,YAAY;AAalB,MAAMC,yBAAyB,CAACC;IAC9B,MAAMC,yBAAyBC,SAASC,cAAc,CAAC;IACvD,IAAI,CAACF,wBAAwB;IAE7B,MAAMG,gBAAgBH,uBAAuBI,qBAAqB;IAElE,IAAID,cAAcE,GAAG,GAAGF,cAAcG,MAAM,GAAGC,OAAOC,WAAW,EAAE;QACjER,uBAAuBS,cAAc,CAAC;YACpCC,OAAO;QACT;IACF;IAEA,IAAIP,cAAcE,GAAG,GAAG,GAAG;QACzBL,uBAAuBS,cAAc,CAAC;YACpCC,OAAO;QACT;IACF;IAEAX,OAAOU,cAAc,CAAC;QAAEC,OAAO;IAAU;AAC3C;AAEA;;;CAGC,GACD,SAASC,mBAAmBC,YAAoB,EAAEC,SAAiB,EAAEC,MAA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,MAAM;YACvB,IAAI,CAACW,UAAU;gBACboD,cAAc;YAChB;QACF;IACF,GACA;QAAC/D;QAAY+D;KAAc;IAG7BhE,sBAAsBC,YAAYsB,iBAAiB0B,OAAO,EAAEkB,cAAchE;IAE1E,OAAOoB;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand, LexicalEditor, TextNode } from 'lexical'\nimport type { JSX, MutableRefObject, ReactPortal } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_ENTER_COMMAND,\n KEY_ESCAPE_COMMAND,\n KEY_TAB_COMMAND,\n createCommand,\n} from 'lexical'\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport type { MenuTextMatch } from '../useMenuTriggerMatch.js'\nimport type { SlashMenuGroupInternal, SlashMenuItem, SlashMenuItemInternal } from './types.js'\n\nexport type MenuResolution = {\n getRect: () => DOMRect\n match?: MenuTextMatch\n}\n\nconst baseClass = 'slash-menu-popup'\n\nexport type MenuRenderFn = (\n anchorElementRef: MutableRefObject<HTMLElement | null>,\n itemProps: {\n groups: Array<SlashMenuGroupInternal>\n selectItemAndCleanUp: (selectedItem: SlashMenuItem) => void\n selectedItemKey: null | string\n setSelectedItemKey: (itemKey: string) => void\n },\n matchingString: null | string,\n) => JSX.Element | ReactPortal | null\n\nconst scrollIntoViewIfNeeded = (target: HTMLElement) => {\n const typeaheadContainerNode = document.getElementById('slash-menu')\n if (!typeaheadContainerNode) return\n\n const typeaheadRect = typeaheadContainerNode.getBoundingClientRect()\n\n if (typeaheadRect.top + typeaheadRect.height > window.innerHeight) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n if (typeaheadRect.top < 0) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n target.scrollIntoView({ block: 'nearest' })\n}\n\n/**\n * Walk backwards along user input and forward through entity title to try\n * and replace more of the user's text with entity.\n */\nfunction getFullMatchOffset(documentText: string, entryText: string, offset: number) {\n let triggerOffset = offset\n for (let i = triggerOffset; i <= entryText.length; i++) {\n if (documentText.substring(documentText.length - i) === entryText.substring(0, i)) {\n triggerOffset = i\n }\n }\n return triggerOffset\n}\n\n/**\n * Split Lexical TextNode and return a new TextNode only containing matched text.\n * Common use cases include: removing the node, replacing with a new node.\n */\nfunction $splitNodeContainingQuery(match: MenuTextMatch): TextNode | null {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) || !selection.isCollapsed()) {\n return null\n }\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 selectionOffset = anchor.offset\n const textContent = anchorNode.getTextContent().slice(0, selectionOffset)\n const characterOffset = match.replaceableString.length\n const queryOffset = getFullMatchOffset(textContent, match.matchingString, characterOffset)\n const startOffset = selectionOffset - queryOffset\n if (startOffset < 0) {\n return null\n }\n let newNode\n if (startOffset === 0) {\n ;[newNode] = anchorNode.splitText(selectionOffset)\n } else {\n ;[, newNode] = anchorNode.splitText(startOffset, selectionOffset)\n }\n\n return newNode\n}\n\n// Got from https://stackoverflow.com/a/42543908/2013580\nexport function getScrollParent(\n element: HTMLElement,\n includeHidden: boolean,\n): HTMLBodyElement | HTMLElement {\n let style = getComputedStyle(element)\n const excludeStaticParent = style.position === 'absolute'\n const overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/\n if (style.position === 'fixed') {\n return document.body\n }\n for (let parent: HTMLElement | null = element; (parent = parent.parentElement); ) {\n style = getComputedStyle(parent)\n if (excludeStaticParent && style.position === 'static') {\n continue\n }\n if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) {\n return parent\n }\n }\n return document.body\n}\n\nfunction isTriggerVisibleInNearestScrollContainer(\n targetElement: HTMLElement,\n containerElement: HTMLElement,\n): boolean {\n const tRect = targetElement.getBoundingClientRect()\n const cRect = containerElement.getBoundingClientRect()\n return tRect.top > cRect.top && tRect.top < cRect.bottom\n}\n\n// Reposition the menu on scroll, window resize, and element resize.\nexport function useDynamicPositioning(\n resolution: MenuResolution | null,\n targetElement: HTMLElement | null,\n onReposition: () => void,\n onVisibilityChange?: (isInView: boolean) => void,\n) {\n const [editor] = useLexicalComposerContext()\n useEffect(() => {\n if (targetElement != null && resolution != null) {\n const rootElement = editor.getRootElement()\n const rootScrollParent =\n rootElement != null ? getScrollParent(rootElement, false) : document.body\n let ticking = false\n let previousIsInView = isTriggerVisibleInNearestScrollContainer(\n targetElement,\n rootScrollParent,\n )\n const handleScroll = function () {\n if (!ticking) {\n window.requestAnimationFrame(function () {\n onReposition()\n ticking = false\n })\n ticking = true\n }\n const isInView = isTriggerVisibleInNearestScrollContainer(targetElement, rootScrollParent)\n if (isInView !== previousIsInView) {\n previousIsInView = isInView\n if (onVisibilityChange != null) {\n onVisibilityChange(isInView)\n }\n }\n }\n const resizeObserver = new ResizeObserver(onReposition)\n window.addEventListener('resize', onReposition)\n document.addEventListener('scroll', handleScroll, {\n capture: true,\n passive: true,\n })\n resizeObserver.observe(targetElement)\n return () => {\n resizeObserver.unobserve(targetElement)\n window.removeEventListener('resize', onReposition)\n document.removeEventListener('scroll', handleScroll, true)\n }\n }\n }, [targetElement, editor, onVisibilityChange, onReposition, resolution])\n}\n\nexport const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND: LexicalCommand<{\n index: number\n item: SlashMenuItemInternal\n}> = createCommand('SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND')\n\nexport function LexicalMenu({\n anchorElementRef,\n close,\n editor,\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n groups,\n menuRenderFn,\n onSelectItem,\n resolution,\n shouldSplitNodeWithQuery = false,\n}: {\n anchorElementRef: MutableRefObject<HTMLElement>\n close: () => void\n editor: LexicalEditor\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\n onSelectItem: (\n item: SlashMenuItem,\n textNodeContainingQuery: TextNode | null,\n closeMenu: () => void,\n matchingString: string,\n ) => void\n resolution: MenuResolution\n shouldSplitNodeWithQuery?: boolean\n}): JSX.Element | null {\n const [selectedItemKey, setSelectedItemKey] = useState<null | string>(null)\n\n const matchingString = (resolution.match && resolution.match.matchingString) || ''\n\n const updateSelectedItem = useCallback(\n (item: SlashMenuItem) => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.setAttribute('aria-activedescendant', `${baseClass}__item-${item.key}`)\n setSelectedItemKey(item.key)\n }\n },\n [editor],\n )\n\n const setSelectedItemKeyToFirstMatchingItem = useCallback(() => {\n // set selected item to the first of the matching ones\n if (groups !== null && matchingString != null) {\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n const allItems = groups.flatMap((group) => group.items)\n\n if (allItems.length) {\n const firstMatchingItem = allItems[0]\n updateSelectedItem(firstMatchingItem)\n }\n }\n }, [groups, updateSelectedItem, matchingString])\n\n useEffect(() => {\n setSelectedItemKeyToFirstMatchingItem()\n }, [matchingString, setSelectedItemKeyToFirstMatchingItem])\n\n const selectItemAndCleanUp = useCallback(\n (selectedItem: SlashMenuItem) => {\n editor.update(() => {\n const textNodeContainingQuery =\n resolution.match != null && shouldSplitNodeWithQuery\n ? $splitNodeContainingQuery(resolution.match)\n : null\n\n onSelectItem(\n selectedItem,\n textNodeContainingQuery,\n close,\n resolution.match ? resolution.match.matchingString : '',\n )\n })\n },\n [editor, shouldSplitNodeWithQuery, resolution.match, onSelectItem, close],\n )\n\n useEffect(() => {\n return () => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.removeAttribute('aria-activedescendant')\n }\n }\n }, [editor])\n\n useLayoutEffect(() => {\n if (groups === null) {\n setSelectedItemKey(null)\n } else if (selectedItemKey === null) {\n setSelectedItemKeyToFirstMatchingItem()\n }\n }, [groups, selectedItemKey, updateSelectedItem, setSelectedItemKeyToFirstMatchingItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND,\n ({ item }) => {\n if (item.ref && item.ref.current != null) {\n scrollIntoViewIfNeeded(item.ref.current)\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, updateSelectedItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_DOWN_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== allItems.length - 1 ? selectedIndex + 1 : 0\n\n const newSelectedItem = allItems[newSelectedIndex]\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n editor.dispatchCommand(SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND, {\n index: newSelectedIndex,\n item: newSelectedItem,\n })\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_UP_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== 0 ? selectedIndex - 1 : allItems.length - 1\n\n const newSelectedItem = allItems[newSelectedIndex]\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n scrollIntoViewIfNeeded(newSelectedItem.ref.current)\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ESCAPE_COMMAND,\n (payload) => {\n const event = payload\n event.preventDefault()\n event.stopImmediatePropagation()\n close()\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (payload) => {\n const event = payload\n\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n event.preventDefault()\n event.stopImmediatePropagation()\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ENTER_COMMAND,\n (event: KeyboardEvent | null) => {\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n if (event !== null) {\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [selectItemAndCleanUp, close, editor, groups, selectedItemKey, updateSelectedItem])\n\n const listItemProps = useMemo(\n () => ({\n groups,\n selectItemAndCleanUp,\n selectedItemKey,\n setSelectedItemKey,\n }),\n [selectItemAndCleanUp, selectedItemKey, groups],\n )\n\n return menuRenderFn(\n anchorElementRef,\n listItemProps,\n resolution.match ? resolution.match.matchingString : '',\n )\n}\n\nexport function useMenuAnchorRef(\n anchorElem: HTMLElement,\n resolution: MenuResolution | null,\n setResolution: (r: MenuResolution | null) => void,\n className?: string,\n): MutableRefObject<HTMLElement> {\n const [editor] = useLexicalComposerContext()\n const anchorElementRef = useRef<HTMLElement>(document.createElement('div'))\n const positionMenu = useCallback(() => {\n const rootElement = editor.getRootElement()\n const containerDiv = anchorElementRef.current\n\n const VERTICAL_OFFSET = 32\n\n const menuEle = containerDiv.firstChild as Element\n if (rootElement !== null && resolution !== null) {\n const { height, width } = resolution.getRect()\n let { left, top } = resolution.getRect()\n\n const rawTop = top\n top -= anchorElem.getBoundingClientRect().top + window.scrollY\n left -= anchorElem.getBoundingClientRect().left + window.scrollX\n containerDiv.style.left = `${left + window.scrollX}px`\n containerDiv.style.height = `${height}px`\n containerDiv.style.width = `${width}px`\n if (menuEle !== null) {\n const menuRect = menuEle.getBoundingClientRect()\n const menuHeight = menuRect.height\n const menuWidth = menuRect.width\n\n const rootElementRect = rootElement.getBoundingClientRect()\n\n if (left + menuWidth > rootElementRect.right) {\n containerDiv.style.left = `${rootElementRect.right - menuWidth + window.scrollX}px`\n }\n\n const wouldGoOffBottomOfScreen = rawTop + menuHeight + VERTICAL_OFFSET > window.innerHeight\n //const wouldGoOffBottomOfContainer = top + menuHeight > rootElementRect.bottom\n const wouldGoOffTopOfScreen = rawTop < 0\n\n // Position slash menu above the cursor instead of below (default) if it would otherwise go off the bottom of the screen.\n if (wouldGoOffBottomOfScreen && !wouldGoOffTopOfScreen) {\n const margin = 24\n containerDiv.style.top = `${\n top + VERTICAL_OFFSET - menuHeight + window.scrollY - (height + margin)\n }px`\n } else {\n containerDiv.style.top = `${top + window.scrollY + VERTICAL_OFFSET}px`\n }\n }\n\n if (!containerDiv.isConnected) {\n if (className != null) {\n containerDiv.className = className\n }\n containerDiv.setAttribute('aria-label', 'Slash menu')\n containerDiv.setAttribute('id', 'slash-menu')\n containerDiv.setAttribute('role', 'listbox')\n containerDiv.style.display = 'block'\n containerDiv.style.position = 'absolute'\n anchorElem.append(containerDiv)\n }\n anchorElementRef.current = containerDiv\n rootElement.setAttribute('aria-controls', 'slash-menu')\n }\n }, [editor, resolution, className, anchorElem])\n\n useEffect(() => {\n const rootElement = editor.getRootElement()\n if (resolution !== null) {\n positionMenu()\n return () => {\n if (rootElement !== null) {\n rootElement.removeAttribute('aria-controls')\n }\n\n const containerDiv = anchorElementRef.current\n if (containerDiv !== null && containerDiv.isConnected) {\n containerDiv.remove()\n }\n }\n }\n }, [editor, positionMenu, resolution])\n\n const onVisibilityChange = useCallback(\n (isInView: boolean) => {\n if (resolution !== null) {\n if (!isInView) {\n setResolution(null)\n }\n }\n },\n [resolution, setResolution],\n )\n\n useDynamicPositioning(resolution, anchorElementRef.current, positionMenu, onVisibilityChange)\n\n return anchorElementRef\n}\n"],"names":["useLexicalComposerContext","mergeRegister","$getSelection","$isRangeSelection","COMMAND_PRIORITY_LOW","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_ENTER_COMMAND","KEY_ESCAPE_COMMAND","KEY_TAB_COMMAND","createCommand","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","baseClass","scrollIntoViewIfNeeded","target","typeaheadContainerNode","document","getElementById","typeaheadRect","getBoundingClientRect","top","height","window","innerHeight","scrollIntoView","block","getFullMatchOffset","documentText","entryText","offset","triggerOffset","i","length","substring","$splitNodeContainingQuery","match","selection","isCollapsed","anchor","type","anchorNode","getNode","isSimpleText","selectionOffset","textContent","getTextContent","slice","characterOffset","replaceableString","queryOffset","matchingString","startOffset","newNode","splitText","getScrollParent","element","includeHidden","style","getComputedStyle","excludeStaticParent","position","overflowRegex","body","parent","parentElement","test","overflow","overflowY","overflowX","isTriggerVisibleInNearestScrollContainer","targetElement","containerElement","tRect","cRect","bottom","useDynamicPositioning","resolution","onReposition","onVisibilityChange","editor","rootElement","getRootElement","rootScrollParent","ticking","previousIsInView","handleScroll","requestAnimationFrame","isInView","resizeObserver","ResizeObserver","addEventListener","capture","passive","observe","unobserve","removeEventListener","SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND","LexicalMenu","anchorElementRef","close","groups","menuRenderFn","onSelectItem","shouldSplitNodeWithQuery","selectedItemKey","setSelectedItemKey","updateSelectedItem","item","rootElem","setAttribute","key","setSelectedItemKeyToFirstMatchingItem","allItems","flatMap","group","items","firstMatchingItem","selectItemAndCleanUp","selectedItem","update","textNodeContainingQuery","removeAttribute","registerCommand","ref","current","payload","event","selectedIndex","findIndex","newSelectedIndex","newSelectedItem","dispatchCommand","index","preventDefault","stopImmediatePropagation","find","listItemProps","useMenuAnchorRef","anchorElem","setResolution","className","createElement","positionMenu","containerDiv","VERTICAL_OFFSET","menuEle","firstChild","width","getRect","left","rawTop","scrollY","scrollX","menuRect","menuHeight","menuWidth","rootElementRect","right","wouldGoOffBottomOfScreen","wouldGoOffTopOfScreen","margin","isConnected","display","append","remove"],"mappings":"AAAA;AAIA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SACEC,aAAa,EACbC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,EACtBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAe,EACfC,aAAa,QACR,UAAS;AAChB,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAU1F,MAAMC,YAAY;AAalB,MAAMC,yBAAyB,CAACC;IAC9B,MAAMC,yBAAyBC,SAASC,cAAc,CAAC;IACvD,IAAI,CAACF,wBAAwB;IAE7B,MAAMG,gBAAgBH,uBAAuBI,qBAAqB;IAElE,IAAID,cAAcE,GAAG,GAAGF,cAAcG,MAAM,GAAGC,OAAOC,WAAW,EAAE;QACjER,uBAAuBS,cAAc,CAAC;YACpCC,OAAO;QACT;IACF;IAEA,IAAIP,cAAcE,GAAG,GAAG,GAAG;QACzBL,uBAAuBS,cAAc,CAAC;YACpCC,OAAO;QACT;IACF;IAEAX,OAAOU,cAAc,CAAC;QAAEC,OAAO;IAAU;AAC3C;AAEA;;;CAGC,GACD,SAASC,mBAAmBC,YAAoB,EAAEC,SAAiB,EAAEC,MAAc;IACjF,IAAIC,gBAAgBD;IACpB,IAAK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AC/D;QAAY+D;KAAc;IAG7BhE,sBAAsBC,YAAYsB,iBAAiB0B,OAAO,EAAEkB,cAAchE;IAE1E,OAAOoB;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { I18nClient } from '@payloadcms/translations';
|
|
2
|
-
import type { LexicalEditor } from 'lexical';
|
|
2
|
+
import type { LexicalEditor, Spread } from 'lexical';
|
|
3
3
|
import type { MutableRefObject } from 'react';
|
|
4
4
|
import type React from 'react';
|
|
5
5
|
export type SlashMenuItem = {
|
|
@@ -37,10 +37,10 @@ export type SlashMenuGroup = {
|
|
|
37
37
|
i18n: I18nClient<{}, string>;
|
|
38
38
|
}) => string) | string;
|
|
39
39
|
};
|
|
40
|
-
export type SlashMenuItemInternal =
|
|
40
|
+
export type SlashMenuItemInternal = {
|
|
41
41
|
ref: MutableRefObject<HTMLButtonElement | null>;
|
|
42
|
-
};
|
|
43
|
-
export type SlashMenuGroupInternal =
|
|
42
|
+
} & SlashMenuItem;
|
|
43
|
+
export type SlashMenuGroupInternal = Spread<{
|
|
44
44
|
items: Array<SlashMenuItemInternal>;
|
|
45
|
-
}
|
|
45
|
+
}, SlashMenuGroup>;
|
|
46
46
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAA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c,CACf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { LexicalEditor } from 'lexical'\nimport type { MutableRefObject } from 'react'\nimport type React from 'react'\n\nexport type SlashMenuItem = {\n /** The icon which is rendered in your slash menu item. */\n Icon: React.FC\n /** Each slash menu item needs to have a unique key. The key will be matched when typing, displayed if no `label` property is set, and used for classNames. */\n key: string\n /**\n * Keywords are used to match the item for different texts typed after the '/'.\n * E.g. you might want to show a horizontal rule item if you type both /hr, /separator, /horizontal etc.\n * In addition to the keywords, the label and key will be used to find the right slash menu item.\n */\n keywords?: Array<string>\n /** The label will be displayed in your slash menu item. In order to make use of i18n, this can be a function. */\n label?: (({ i18n }: { i18n: I18nClient<{}, string> }) => string) | string\n /** A function which is called when the slash menu item is selected. */\n onSelect: ({ editor, queryString }: { editor: LexicalEditor; queryString: string }) => void\n}\n\nexport type SlashMenuGroup = {\n /**\n * An array of `SlashMenuItem`'s which will be displayed in the slash menu.\n */\n items: Array<SlashMenuItem>\n /**\n * Used for class names and, if label is not provided, for display. Slash menus with the same key will have their items merged together.\n */\n key: string\n /** The label will be displayed before your Slash Menu group. In order to make use of i18n, this can be a function. */\n label?: (({ i18n }: { i18n: I18nClient<{}, string> }) => string) | string\n}\n\nexport type SlashMenuItemInternal =
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { LexicalEditor, Spread } from 'lexical'\nimport type { MutableRefObject } from 'react'\nimport type React from 'react'\n\nexport type SlashMenuItem = {\n /** The icon which is rendered in your slash menu item. */\n Icon: React.FC\n /** Each slash menu item needs to have a unique key. The key will be matched when typing, displayed if no `label` property is set, and used for classNames. */\n key: string\n /**\n * Keywords are used to match the item for different texts typed after the '/'.\n * E.g. you might want to show a horizontal rule item if you type both /hr, /separator, /horizontal etc.\n * In addition to the keywords, the label and key will be used to find the right slash menu item.\n */\n keywords?: Array<string>\n /** The label will be displayed in your slash menu item. In order to make use of i18n, this can be a function. */\n label?: (({ i18n }: { i18n: I18nClient<{}, string> }) => string) | string\n /** A function which is called when the slash menu item is selected. */\n onSelect: ({ editor, queryString }: { editor: LexicalEditor; queryString: string }) => void\n}\n\nexport type SlashMenuGroup = {\n /**\n * An array of `SlashMenuItem`'s which will be displayed in the slash menu.\n */\n items: Array<SlashMenuItem>\n /**\n * Used for class names and, if label is not provided, for display. Slash menus with the same key will have their items merged together.\n */\n key: string\n /** The label will be displayed before your Slash Menu group. In order to make use of i18n, this can be a function. */\n label?: (({ i18n }: { i18n: I18nClient<{}, string> }) => string) | string\n}\n\nexport type SlashMenuItemInternal = {\n ref: MutableRefObject<HTMLButtonElement | null>\n} & SlashMenuItem\n\nexport type SlashMenuGroupInternal = Spread<\n {\n items: Array<SlashMenuItemInternal>\n },\n SlashMenuGroup\n>\n"],"names":[],"mappings":"AAuCA,WAKC"}
|
package/dist/nodeTypes.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { SerializedAutoLinkNode, SerializedLinkNode } from './features/link
|
|
|
7
7
|
import type { SerializedListItemNode, SerializedListNode } from './features/lists/plugin/index.js';
|
|
8
8
|
import type { SerializedRelationshipNode } from './features/relationship/nodes/RelationshipNode.js';
|
|
9
9
|
import type { SerializedUploadNode } from './features/upload/nodes/UploadNode.js';
|
|
10
|
-
export { SerializedAutoLinkNode, SerializedBlockNode, SerializedHeadingNode, SerializedHorizontalRuleNode, SerializedLinkNode, SerializedListItemNode, SerializedListNode, SerializedQuoteNode, SerializedRelationshipNode, SerializedUploadNode, };
|
|
10
|
+
export type { SerializedAutoLinkNode, SerializedBlockNode, SerializedHeadingNode, SerializedHorizontalRuleNode, SerializedLinkNode, SerializedListItemNode, SerializedListNode, SerializedQuoteNode, SerializedRelationshipNode, SerializedUploadNode, };
|
|
11
11
|
export type SerializedParagraphNode<T extends SerializedLexicalNode = SerializedLexicalNode> = Spread<{
|
|
12
12
|
textFormat: number;
|
|
13
13
|
type: 'paragraph';
|
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,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,EACN,YAAY,EACb,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAChF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AACjF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAA;AACzG,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,mDAAmD,CAAA;AACnG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAEjF,
|
|
1
|
+
{"version":3,"file":"nodeTypes.d.ts","sourceRoot":"","sources":["../src/nodeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,EACN,YAAY,EACb,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAChF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM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,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE7D,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IAClF,qBAAqB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;AAE1C,MAAM,MAAM,gBAAgB,GACxB,sBAAsB,GACtB,mBAAmB,GACnB,qBAAqB,GACrB,4BAA4B,GAC5B,kBAAkB,GAClB,sBAAsB,GACtB,kBAAkB,GAClB,uBAAuB,GACvB,mBAAmB,GACnB,0BAA0B,GAC1B,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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/nodeTypes.ts"],"sourcesContent":["import type {\n SerializedEditorState,\n SerializedElementNode,\n SerializedLexicalNode,\n Spread,\n TextModeType,\n} from 'lexical'\n\nimport type { SerializedQuoteNode } from './features/blockquote/feature.server.js'\nimport type { SerializedBlockNode } from './features/blocks/nodes/BlocksNode.js'\nimport type { SerializedHeadingNode } from './features/heading/feature.server.js'\nimport type { SerializedHorizontalRuleNode } from './features/horizontalRule/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/nodes/RelationshipNode.js'\nimport type { SerializedUploadNode } from './features/upload/nodes/UploadNode.js'\n\nexport {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\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 detail: number\n format: number\n mode: TextModeType\n style: string\n text: string\n type: 'text'\n },\n SerializedLexicalNode\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\n | SerializedHeadingNode\n | SerializedHorizontalRuleNode\n | SerializedLinkNode\n | SerializedListItemNode\n | SerializedListNode\n | SerializedParagraphNode\n | SerializedQuoteNode\n | SerializedRelationshipNode\n | SerializedTextNode\n | SerializedUploadNode\n\nexport type DefaultTypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> =\n TypedEditorState<DefaultNodeTypes | T>\n"],"names":[],"mappings":"AA0EA,WACwC"}
|
|
1
|
+
{"version":3,"sources":["../src/nodeTypes.ts"],"sourcesContent":["import type {\n SerializedEditorState,\n SerializedElementNode,\n SerializedLexicalNode,\n Spread,\n TextModeType,\n} from 'lexical'\n\nimport type { SerializedQuoteNode } from './features/blockquote/feature.server.js'\nimport type { SerializedBlockNode } from './features/blocks/nodes/BlocksNode.js'\nimport type { SerializedHeadingNode } from './features/heading/feature.server.js'\nimport type { SerializedHorizontalRuleNode } from './features/horizontalRule/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/nodes/RelationshipNode.js'\nimport type { SerializedUploadNode } from './features/upload/nodes/UploadNode.js'\n\nexport type {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\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 detail: number\n format: number\n mode: TextModeType\n style: string\n text: string\n type: 'text'\n },\n SerializedLexicalNode\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\n | SerializedHeadingNode\n | SerializedHorizontalRuleNode\n | SerializedLinkNode\n | SerializedListItemNode\n | SerializedListNode\n | SerializedParagraphNode\n | SerializedQuoteNode\n | SerializedRelationshipNode\n | SerializedTextNode\n | SerializedUploadNode\n\nexport type DefaultTypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> =\n TypedEditorState<DefaultNodeTypes | T>\n"],"names":[],"mappings":"AA0EA,WACwC"}
|
|
@@ -9,9 +9,9 @@ type Arguments = {
|
|
|
9
9
|
req: PayloadRequest;
|
|
10
10
|
showHiddenFields: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare const populate: ({ id, collectionSlug, currentDepth, data, depth, draft, key, overrideAccess, req, showHiddenFields, }:
|
|
12
|
+
export declare const populate: ({ id, collectionSlug, currentDepth, data, depth, draft, key, overrideAccess, req, showHiddenFields, }: {
|
|
13
13
|
collectionSlug: string;
|
|
14
14
|
id: number | string;
|
|
15
|
-
}) => Promise<void>;
|
|
15
|
+
} & Arguments) => Promise<void>;
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=populate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate.d.ts","sourceRoot":"","sources":["../../src/populateGraphQL/populate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,KAAK,SAAS,GAAG;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;IACd,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,cAAc,EAAE,OAAO,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,QAAQ,0GAWlB
|
|
1
|
+
{"version":3,"file":"populate.d.ts","sourceRoot":"","sources":["../../src/populateGraphQL/populate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,KAAK,SAAS,GAAG;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;IACd,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,cAAc,EAAE,OAAO,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,QAAQ,0GAWlB;IACD,cAAc,EAAE,MAAM,CAAA;IACtB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CACpB,GAAG,SAAS,KAAG,OAAO,CAAC,IAAI,CA6B3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/populateGraphQL/populate.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\n\nimport { createDataloaderCacheKey } from 'payload'\n\ntype Arguments = {\n currentDepth?: number\n data: unknown\n depth: number\n draft: boolean\n key: number | string\n overrideAccess: boolean\n req: PayloadRequest\n showHiddenFields: boolean\n}\n\nexport const populate = async ({\n id,\n collectionSlug,\n currentDepth,\n data,\n depth,\n draft,\n key,\n overrideAccess,\n req,\n showHiddenFields,\n}:
|
|
1
|
+
{"version":3,"sources":["../../src/populateGraphQL/populate.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\n\nimport { createDataloaderCacheKey } from 'payload'\n\ntype Arguments = {\n currentDepth?: number\n data: unknown\n depth: number\n draft: boolean\n key: number | string\n overrideAccess: boolean\n req: PayloadRequest\n showHiddenFields: boolean\n}\n\nexport const populate = async ({\n id,\n collectionSlug,\n currentDepth,\n data,\n depth,\n draft,\n key,\n overrideAccess,\n req,\n showHiddenFields,\n}: {\n collectionSlug: string\n id: number | string\n} & Arguments): Promise<void> => {\n const shouldPopulate = depth && currentDepth <= depth\n // usually depth is checked within recursivelyPopulateFieldsForGraphQL. But since this populate function can be called outside of that (in rest afterRead node hooks) we need to check here too\n if (!shouldPopulate) {\n return\n }\n\n const dataRef = data as Record<string, unknown>\n\n const doc = await req.payloadDataLoader.load(\n createDataloaderCacheKey({\n collectionSlug,\n currentDepth: currentDepth + 1,\n depth,\n docID: id as string,\n draft,\n fallbackLocale: req.fallbackLocale,\n locale: req.locale,\n overrideAccess,\n showHiddenFields,\n transactionID: req.transactionID,\n }),\n )\n\n if (doc) {\n dataRef[key] = doc\n } else {\n dataRef[key] = null\n }\n}\n"],"names":["createDataloaderCacheKey","populate","id","collectionSlug","currentDepth","data","depth","draft","key","overrideAccess","req","showHiddenFields","shouldPopulate","dataRef","doc","payloadDataLoader","load","docID","fallbackLocale","locale","transactionID"],"mappings":"AAEA,SAASA,wBAAwB,QAAQ,UAAS;AAalD,OAAO,MAAMC,WAAW,OAAO,EAC7BC,EAAE,EACFC,cAAc,EACdC,YAAY,EACZC,IAAI,EACJC,KAAK,EACLC,KAAK,EACLC,GAAG,EACHC,cAAc,EACdC,GAAG,EACHC,gBAAgB,EAIL;IACX,MAAMC,iBAAiBN,SAASF,gBAAgBE;IAChD,+LAA+L;IAC/L,IAAI,CAACM,gBAAgB;QACnB;IACF;IAEA,MAAMC,UAAUR;IAEhB,MAAMS,MAAM,MAAMJ,IAAIK,iBAAiB,CAACC,IAAI,CAC1ChB,yBAAyB;QACvBG;QACAC,cAAcA,eAAe;QAC7BE;QACAW,OAAOf;QACPK;QACAW,gBAAgBR,IAAIQ,cAAc;QAClCC,QAAQT,IAAIS,MAAM;QAClBV;QACAE;QACAS,eAAeV,IAAIU,aAAa;IAClC;IAGF,IAAIN,KAAK;QACPD,OAAO,CAACL,IAAI,GAAGM;IACjB,OAAO;QACLD,OAAO,CAACL,IAAI,GAAG;IACjB;AACF,EAAC"}
|
|
@@ -2,9 +2,9 @@ import type { SerializedEditorState } from 'lexical';
|
|
|
2
2
|
import type { RichTextAdapter } from 'payload';
|
|
3
3
|
import type { PopulationPromise } from '../features/typesServer.js';
|
|
4
4
|
import type { AdapterProps } from '../types.js';
|
|
5
|
-
export type Args =
|
|
5
|
+
export type Args = {
|
|
6
6
|
editorPopulationPromises: Map<string, Array<PopulationPromise>>;
|
|
7
|
-
};
|
|
7
|
+
} & Parameters<RichTextAdapter<SerializedEditorState, AdapterProps>['graphQLPopulationPromises']>[0];
|
|
8
8
|
/**
|
|
9
9
|
* Appends all new populationPromises to the populationPromises prop
|
|
10
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populateLexicalPopulationPromises.d.ts","sourceRoot":"","sources":["../../src/populateGraphQL/populateLexicalPopulationPromises.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI/C,MAAM,MAAM,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"populateLexicalPopulationPromises.d.ts","sourceRoot":"","sources":["../../src/populateGraphQL/populateLexicalPopulationPromises.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI/C,MAAM,MAAM,IAAI,GAAG;IACjB,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;CAChE,GAAG,UAAU,CAAC,eAAe,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEpG;;GAEG;AACH,eAAO,MAAM,iCAAiC,8LAe3C,IAAI,SAiCN,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/populateGraphQL/populateLexicalPopulationPromises.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextAdapter } from 'payload'\n\nimport type { PopulationPromise } from '../features/typesServer.js'\nimport type { AdapterProps } from '../types.js'\n\nimport { recurseNodes } from '../utilities/forEachNodeRecursively.js'\n\nexport type Args =
|
|
1
|
+
{"version":3,"sources":["../../src/populateGraphQL/populateLexicalPopulationPromises.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextAdapter } from 'payload'\n\nimport type { PopulationPromise } from '../features/typesServer.js'\nimport type { AdapterProps } from '../types.js'\n\nimport { recurseNodes } from '../utilities/forEachNodeRecursively.js'\n\nexport type Args = {\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n} & Parameters<RichTextAdapter<SerializedEditorState, AdapterProps>['graphQLPopulationPromises']>[0]\n\n/**\n * Appends all new populationPromises to the populationPromises prop\n */\nexport const populateLexicalPopulationPromises = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: Args) => {\n const shouldPopulate = depth && currentDepth <= depth\n\n if (!shouldPopulate) {\n return\n }\n\n recurseNodes({\n callback: (node) => {\n if (editorPopulationPromises?.has(node.type)) {\n for (const promise of editorPopulationPromises.get(node.type)) {\n promise({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n }\n },\n nodes: (siblingDoc[field?.name] as SerializedEditorState)?.root?.children ?? [],\n })\n}\n"],"names":["recurseNodes","populateLexicalPopulationPromises","context","currentDepth","depth","draft","editorPopulationPromises","field","fieldPromises","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","shouldPopulate","callback","node","has","type","promise","get","nodes","name","root","children"],"mappings":"AAMA,SAASA,YAAY,QAAQ,yCAAwC;AAMrE;;CAEC,GACD,OAAO,MAAMC,oCAAoC,CAAC,EAChDC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,KAAK,EACLC,wBAAwB,EACxBC,KAAK,EACLC,aAAa,EACbC,QAAQ,EACRC,cAAc,EACdC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACL;IACL,MAAMC,iBAAiBZ,SAASD,gBAAgBC;IAEhD,IAAI,CAACY,gBAAgB;QACnB;IACF;IAEAhB,aAAa;QACXiB,UAAU,CAACC;YACT,IAAIZ,0BAA0Ba,IAAID,KAAKE,IAAI,GAAG;gBAC5C,KAAK,MAAMC,WAAWf,yBAAyBgB,GAAG,CAACJ,KAAKE,IAAI,EAAG;oBAC7DC,QAAQ;wBACNnB;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAQ;wBACAP;wBACAC;wBACAC;wBACAC;wBACAC;oBACF;gBACF;YACF;QACF;QACAQ,OAAO,AAACR,UAAU,CAACR,OAAOiB,KAAK,EAA4BC,MAAMC,YAAY,EAAE;IACjF;AACF,EAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -40,10 +40,10 @@ export type LexicalEditorProps = {
|
|
|
40
40
|
}) => FeatureProviderServer<any, any, any>[]) | FeatureProviderServer<any, any, any>[];
|
|
41
41
|
lexical?: LexicalEditorConfig;
|
|
42
42
|
};
|
|
43
|
-
export type LexicalRichTextAdapter =
|
|
43
|
+
export type LexicalRichTextAdapter = {
|
|
44
44
|
editorConfig: SanitizedServerEditorConfig;
|
|
45
45
|
features: FeatureProviderServer<any, any, any>[];
|
|
46
|
-
}
|
|
46
|
+
} & RichTextAdapter<SerializedEditorState, AdapterProps, any>;
|
|
47
47
|
export type LexicalRichTextAdapterProvider =
|
|
48
48
|
/**
|
|
49
49
|
* This is being called during the payload sanitization process
|
|
@@ -52,12 +52,12 @@ export type LexicalRichTextAdapterProvider =
|
|
|
52
52
|
config: SanitizedConfig;
|
|
53
53
|
isRoot?: boolean;
|
|
54
54
|
}) => Promise<LexicalRichTextAdapter>;
|
|
55
|
-
export type FieldProps =
|
|
55
|
+
export type FieldProps = {
|
|
56
56
|
fieldTypes: FieldTypes;
|
|
57
57
|
indexPath: string;
|
|
58
58
|
path?: string;
|
|
59
59
|
permissions: FieldPermissions;
|
|
60
|
-
}
|
|
60
|
+
} & RichTextFieldProps<SerializedEditorState, AdapterProps, AdapterProps>;
|
|
61
61
|
export type AdapterProps = {
|
|
62
62
|
editorConfig: SanitizedServerEditorConfig;
|
|
63
63
|
};
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACzF,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EAChB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AAE5E,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,sBAAsB,CAAA;IAC9B,QAAQ,CAAC,EACL,CAAC,CAAC,EACA,eAAe,EACf,YAAY,GACb,EAAE;QACD;;;;;;;;;;WAUG;QACH,eAAe,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;QACvD;;;;;;;;;;;WAWG;QACH,YAAY,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;KACrD,KAAK,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAC7C,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EA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,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;CACjD,GAAG,eAAe,CAAC,qBAAqB,EAAE,YAAY,EAAE,GAAG,CAAC,CAAA;AAE7D,MAAM,MAAM,8BAA8B;AACxC;;GAEG;AACH,CAAC,EACC,MAAM,EACN,MAAM,GACP,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAA;AAEvC,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,UAAU,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,gBAAgB,CAAA;CAC9B,GAAG,kBAAkB,CAAC,qBAAqB,EAAE,YAAY,EAAE,YAAY,CAAC,CAAA;AAEzE,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,2BAA2B,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,aAAa,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd,CAAA"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'\nimport type {\n FieldPermissions,\n FieldTypes,\n RichTextAdapter,\n RichTextFieldProps,\n SanitizedConfig,\n} from 'payload'\nimport type React from 'react'\n\nimport type { FeatureProviderServer } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n}\n\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?:\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n lexical?: LexicalEditorConfig\n}\n\nexport type LexicalRichTextAdapter =
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'\nimport type {\n FieldPermissions,\n FieldTypes,\n RichTextAdapter,\n RichTextFieldProps,\n SanitizedConfig,\n} from 'payload'\nimport type React from 'react'\n\nimport type { FeatureProviderServer } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n}\n\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?:\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n lexical?: LexicalEditorConfig\n}\n\nexport type LexicalRichTextAdapter = {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any, any>[]\n} & RichTextAdapter<SerializedEditorState, AdapterProps, any>\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n }) => Promise<LexicalRichTextAdapter>\n\nexport type FieldProps = {\n fieldTypes: FieldTypes\n indexPath: string\n path?: string\n permissions: FieldPermissions\n} & RichTextFieldProps<SerializedEditorState, AdapterProps, AdapterProps>\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n ClientFeature: React.ReactNode\n key: string\n order: number\n}\n"],"names":[],"mappings":"AAqFA,WAIC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SanitizedConfig } from 'payload';
|
|
2
2
|
import type { FeatureProviderProviderServer, FeatureProviderServer, ResolvedServerFeatureMap, ServerFeature, ServerFeatureProviderMap } from '../features/typesServer.js';
|
|
3
3
|
import type { ServerEditorConfig } from '../lexical/config/types.js';
|
|
4
|
-
export type CreateServerFeatureArgs<UnSanitizedProps, SanitizedProps, ClientProps> =
|
|
4
|
+
export type CreateServerFeatureArgs<UnSanitizedProps, SanitizedProps, ClientProps> = {
|
|
5
5
|
feature: ((props: {
|
|
6
6
|
config: SanitizedConfig;
|
|
7
7
|
/** unSanitizedEditorConfig.features, but mapped */
|
|
@@ -11,6 +11,6 @@ export type CreateServerFeatureArgs<UnSanitizedProps, SanitizedProps, ClientProp
|
|
|
11
11
|
resolvedFeatures: ResolvedServerFeatureMap;
|
|
12
12
|
unSanitizedEditorConfig: ServerEditorConfig;
|
|
13
13
|
}) => Promise<ServerFeature<SanitizedProps, ClientProps>> | ServerFeature<SanitizedProps, ClientProps>) | Omit<ServerFeature<SanitizedProps, ClientProps>, 'sanitizedServerFeatureProps'>;
|
|
14
|
-
}
|
|
14
|
+
} & Pick<FeatureProviderServer<UnSanitizedProps, ClientProps>, 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'>;
|
|
15
15
|
export declare const createServerFeature: <UnSanitizedProps = undefined, SanitizedProps = UnSanitizedProps, ClientProps = undefined>(args: CreateServerFeatureArgs<UnSanitizedProps, SanitizedProps, ClientProps>) => FeatureProviderProviderServer<UnSanitizedProps, SanitizedProps, ClientProps>;
|
|
16
16
|
//# sourceMappingURL=createServerFeature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServerFeature.d.ts","sourceRoot":"","sources":["../../src/utilities/createServerFeature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,aAAa,EACb,wBAAwB,EACzB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,MAAM,MAAM,uBAAuB,CAAC,gBAAgB,EAAE,cAAc,EAAE,WAAW,IAAI
|
|
1
|
+
{"version":3,"file":"createServerFeature.d.ts","sourceRoot":"","sources":["../../src/utilities/createServerFeature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,aAAa,EACb,wBAAwB,EACzB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,MAAM,MAAM,uBAAuB,CAAC,gBAAgB,EAAE,cAAc,EAAE,WAAW,IAAI;IACnF,OAAO,EACH,CAAC,CAAC,KAAK,EAAE;QACP,MAAM,EAAE,eAAe,CAAA;QACvB,mDAAmD;QACnD,kBAAkB,EAAE,wBAAwB,CAAA;QAC5C,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,KAAK,EAAE,gBAAgB,CAAA;QAEvB,gBAAgB,EAAE,wBAAwB,CAAA;QAE1C,uBAAuB,EAAE,kBAAkB,CAAA;KAC5C,KACG,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC,GACnD,aAAa,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC,GAC/C,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,WAAW,CAAC,EAAE,6BAA6B,CAAC,CAAA;CACpF,GAAG,IAAI,CACN,qBAAqB,CAAC,gBAAgB,EAAE,WAAW,CAAC,EACpD,cAAc,GAAG,sBAAsB,GAAG,kBAAkB,GAAG,KAAK,CACrE,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,CAChC,gBAAgB,GAAG,SAAS,EAC5B,cAAc,GAAG,gBAAgB,EACjC,WAAW,GAAG,SAAS,EAEvB,IAAI,EAAE,uBAAuB,CAAC,gBAAgB,EAAE,cAAc,EAAE,WAAW,CAAC,KACzE,6BAA6B,CAAC,gBAAgB,EAAE,cAAc,EAAE,WAAW,CA8C/E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/createServerFeature.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n FeatureProviderProviderServer,\n FeatureProviderServer,\n ResolvedServerFeatureMap,\n ServerFeature,\n ServerFeatureProviderMap,\n} from '../features/typesServer.js'\nimport type { ServerEditorConfig } from '../lexical/config/types.js'\n\nexport type CreateServerFeatureArgs<UnSanitizedProps, SanitizedProps, ClientProps> =
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/createServerFeature.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n FeatureProviderProviderServer,\n FeatureProviderServer,\n ResolvedServerFeatureMap,\n ServerFeature,\n ServerFeatureProviderMap,\n} from '../features/typesServer.js'\nimport type { ServerEditorConfig } from '../lexical/config/types.js'\n\nexport type CreateServerFeatureArgs<UnSanitizedProps, SanitizedProps, ClientProps> = {\n feature:\n | ((props: {\n config: SanitizedConfig\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ServerFeatureProviderMap\n isRoot?: boolean\n props: UnSanitizedProps\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedServerFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ServerEditorConfig\n }) =>\n | Promise<ServerFeature<SanitizedProps, ClientProps>>\n | ServerFeature<SanitizedProps, ClientProps>)\n | Omit<ServerFeature<SanitizedProps, ClientProps>, 'sanitizedServerFeatureProps'>\n} & Pick<\n FeatureProviderServer<UnSanitizedProps, ClientProps>,\n 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'\n>\n\nexport const createServerFeature: <\n UnSanitizedProps = undefined,\n SanitizedProps = UnSanitizedProps,\n ClientProps = undefined,\n>(\n args: CreateServerFeatureArgs<UnSanitizedProps, SanitizedProps, ClientProps>,\n) => FeatureProviderProviderServer<UnSanitizedProps, SanitizedProps, ClientProps> = ({\n dependencies,\n dependenciesPriority,\n dependenciesSoft,\n feature,\n key,\n}) => {\n const featureProviderProviderServer: FeatureProviderProviderServer<any, any, any> = (props) => {\n const featureProviderServer: Partial<FeatureProviderServer<any, any, any>> = {\n dependencies,\n dependenciesPriority,\n dependenciesSoft,\n key,\n serverFeatureProps: props,\n }\n\n if (typeof feature === 'function') {\n featureProviderServer.feature = async ({\n config,\n featureProviderMap,\n isRoot,\n resolvedFeatures,\n unSanitizedEditorConfig,\n }) => {\n const toReturn = await feature({\n config,\n featureProviderMap,\n isRoot,\n props,\n resolvedFeatures,\n unSanitizedEditorConfig,\n })\n\n if (toReturn.sanitizedServerFeatureProps === null) {\n toReturn.sanitizedServerFeatureProps = props\n }\n return toReturn\n }\n } else {\n ;(feature as ServerFeature<any, any>).sanitizedServerFeatureProps = props\n featureProviderServer.feature = feature as ServerFeature<any, any>\n }\n return featureProviderServer as FeatureProviderServer<any, any, any>\n }\n\n return featureProviderProviderServer\n}\n"],"names":["createServerFeature","dependencies","dependenciesPriority","dependenciesSoft","feature","key","featureProviderProviderServer","props","featureProviderServer","serverFeatureProps","config","featureProviderMap","isRoot","resolvedFeatures","unSanitizedEditorConfig","toReturn","sanitizedServerFeatureProps"],"mappings":"AAgCA,OAAO,MAAMA,sBAMuE,CAAC,EACnFC,YAAY,EACZC,oBAAoB,EACpBC,gBAAgB,EAChBC,OAAO,EACPC,GAAG,EACJ;IACC,MAAMC,gCAA8E,CAACC;QACnF,MAAMC,wBAAuE;YAC3EP;YACAC;YACAC;YACAE;YACAI,oBAAoBF;QACtB;QAEA,IAAI,OAAOH,YAAY,YAAY;YACjCI,sBAAsBJ,OAAO,GAAG,OAAO,EACrCM,MAAM,EACNC,kBAAkB,EAClBC,MAAM,EACNC,gBAAgB,EAChBC,uBAAuB,EACxB;gBACC,MAAMC,WAAW,MAAMX,QAAQ;oBAC7BM;oBACAC;oBACAC;oBACAL;oBACAM;oBACAC;gBACF;gBAEA,IAAIC,SAASC,2BAA2B,KAAK,MAAM;oBACjDD,SAASC,2BAA2B,GAAGT;gBACzC;gBACA,OAAOQ;YACT;QACF,OAAO;YACHX,QAAoCY,2BAA2B,GAAGT;YACpEC,sBAAsBJ,OAAO,GAAGA;QAClC;QACA,OAAOI;IACT;IAEA,OAAOF;AACT,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.61",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -50,15 +50,16 @@
|
|
|
50
50
|
"@lexical/eslint-plugin": " 0.16.1",
|
|
51
51
|
"@types/json-schema": "7.0.15",
|
|
52
52
|
"@types/node": "20.12.5",
|
|
53
|
-
"@types/react": "npm:types-react@19.0.0-
|
|
54
|
-
"@types/react-dom": "npm:types-react-dom@19.0.0-
|
|
55
|
-
"esbuild": "
|
|
56
|
-
"esbuild-sass-plugin": "
|
|
53
|
+
"@types/react": "npm:types-react@19.0.0-rc.0",
|
|
54
|
+
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
|
|
55
|
+
"esbuild": "0.23.0",
|
|
56
|
+
"esbuild-sass-plugin": "3.3.1",
|
|
57
|
+
"swc-plugin-transform-remove-imports": "1.14.0",
|
|
57
58
|
"@payloadcms/eslint-config": "3.0.0-beta.59",
|
|
58
|
-
"@payloadcms/next": "3.0.0-beta.
|
|
59
|
-
"@payloadcms/
|
|
60
|
-
"
|
|
61
|
-
"
|
|
59
|
+
"@payloadcms/next": "3.0.0-beta.61",
|
|
60
|
+
"@payloadcms/ui": "3.0.0-beta.61",
|
|
61
|
+
"payload": "3.0.0-beta.61",
|
|
62
|
+
"@payloadcms/translations": "3.0.0-beta.61"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
65
|
"@faceless-ui/modal": "3.0.0-beta.2",
|
|
@@ -74,12 +75,12 @@
|
|
|
74
75
|
"@lexical/table": "0.16.1",
|
|
75
76
|
"@lexical/utils": "0.16.1",
|
|
76
77
|
"lexical": "0.16.1",
|
|
77
|
-
"react": "^19.0.0 || ^19.0.0-rc-
|
|
78
|
-
"react-dom": "^19.0.0 || ^19.0.0-rc-
|
|
79
|
-
"@payloadcms/next": "3.0.0-beta.
|
|
80
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
81
|
-
"
|
|
82
|
-
"
|
|
78
|
+
"react": "^19.0.0 || ^19.0.0-rc-6230622a1a-20240610",
|
|
79
|
+
"react-dom": "^19.0.0 || ^19.0.0-rc-6230622a1a-20240610",
|
|
80
|
+
"@payloadcms/next": "3.0.0-beta.61",
|
|
81
|
+
"@payloadcms/translations": "3.0.0-beta.61",
|
|
82
|
+
"@payloadcms/ui": "3.0.0-beta.61",
|
|
83
|
+
"payload": "3.0.0-beta.61"
|
|
83
84
|
},
|
|
84
85
|
"engines": {
|
|
85
86
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -88,8 +89,8 @@
|
|
|
88
89
|
"registry": "https://registry.npmjs.org/"
|
|
89
90
|
},
|
|
90
91
|
"overrides": {
|
|
91
|
-
"@types/react": "npm:types-react@19.0.0-
|
|
92
|
-
"@types/react-dom": "npm:types-react-dom@19.0.0-
|
|
92
|
+
"@types/react": "npm:types-react@19.0.0-rc.0",
|
|
93
|
+
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.0"
|
|
93
94
|
},
|
|
94
95
|
"scripts": {
|
|
95
96
|
"build": "rm -rf dist && rm -rf tsconfig.tsbuildinfo && pnpm copyfiles && pnpm build:types && pnpm build:swc && pnpm build:esbuild",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|