@payloadcms/richtext-lexical 3.41.0-internal.8617025 → 3.41.0-internal.c12584b

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.
Files changed (33) hide show
  1. package/dist/exports/client/Field-6GAC5Y2D.js +2 -0
  2. package/dist/exports/client/Field-6GAC5Y2D.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/{chunk-DOZWITPU.js → chunk-LUNX5J6B.js} +2 -2
  5. package/dist/exports/client/{chunk-DOZWITPU.js.map → chunk-LUNX5J6B.js.map} +1 -1
  6. package/dist/exports/client/index.d.ts +1 -0
  7. package/dist/exports/client/index.d.ts.map +1 -1
  8. package/dist/exports/client/index.js +10 -10
  9. package/dist/exports/client/index.js.map +4 -4
  10. package/dist/features/blockquote/server/i18n.js +1 -1
  11. package/dist/features/blockquote/server/i18n.js.map +1 -1
  12. package/dist/features/blocks/client/plugin/index.js +1 -1
  13. package/dist/features/blocks/server/i18n.js +1 -1
  14. package/dist/features/blocks/server/i18n.js.map +1 -1
  15. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +1 -2
  16. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  17. package/dist/field/bundled.css +1 -1
  18. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  19. package/dist/lexical/LexicalEditor.js +2 -1
  20. package/dist/lexical/LexicalEditor.js.map +1 -1
  21. package/dist/lexical/plugins/SelectAllPlugin/index.d.ts +7 -0
  22. package/dist/lexical/plugins/SelectAllPlugin/index.d.ts.map +1 -0
  23. package/dist/lexical/plugins/SelectAllPlugin/index.js +26 -0
  24. package/dist/lexical/plugins/SelectAllPlugin/index.js.map +1 -0
  25. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -4
  26. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  27. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  28. package/dist/utilities/generateImportMap.js +1 -3
  29. package/dist/utilities/generateImportMap.js.map +1 -1
  30. package/package.json +18 -15
  31. package/dist/exports/client/Field-DGC4DDYL.js +0 -2
  32. package/dist/exports/client/Field-DGC4DDYL.js.map +0 -7
  33. package/dist/scss/custom.css +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalEditor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAIhE,OAAO,sBAAsB,CAAA;AAW7B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC;IACE,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC1D,oBAAoB,EAAE,OAAO,CAAA;CAC9B,GAAG,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,CAAC,CA4J5D,CAAA"}
1
+ {"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalEditor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAIhE,OAAO,sBAAsB,CAAA;AAY7B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC;IACE,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC1D,oBAAoB,EAAE,OAAO,CAAA;CAC9B,GAAG,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,CAAC,CA6J5D,CAAA"}
@@ -18,6 +18,7 @@ import { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/ind
18
18
  import { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js';
19
19
  import { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js';
20
20
  import { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js';
21
+ import { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js';
21
22
  import { SlashMenuPlugin } from './plugins/SlashMenu/index.js';
22
23
  import { TextPlugin } from './plugins/TextPlugin/index.js';
23
24
  import { LexicalContentEditable } from './ui/ContentEditable.js';
@@ -150,7 +151,7 @@ export const LexicalEditor = props => {
150
151
  ErrorBoundary: LexicalErrorBoundary
151
152
  }), _jsx(NormalizeSelectionPlugin, {}), _jsx(InsertParagraphAtEndPlugin, {}), _jsx(DecoratorPlugin, {}), _jsx(TextPlugin, {
152
153
  features: editorConfig.features
153
- }), _jsx(OnChangePlugin, {
154
+ }), _jsx(SelectAllPlugin, {}), _jsx(OnChangePlugin, {
154
155
  ignoreSelectionChange: true,
155
156
  onChange: t4
156
157
  }), t5, editor.isEditable() && _jsxs(React.Fragment, {
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalEditor.js","names":["c","_c","useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NormalizeSelectionPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","editorConfigContext","editor","floatingAnchorElem","setFloatingAnchorElem","t0","Symbol","for","_floatingAnchorElem","onRef","t1","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","t4","editorState","editor_0","tags","has","size","t5","features","plugins","_jsxs","Fragment","children","isEditable","_jsx","anchorElem","map","plugin_1","plugin","position","desktopOnly","clientProps","key","_temp","className","ref","_temp2","contentEditable","ignoreSelectionChange","markdownTransformers","length","_temp3","_temp4","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n <InsertParagraphAtEndPlugin />\n <DecoratorPlugin />\n <TextPlugin features={editorConfig.features} />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EA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","HistoryPlugin","OnChangePlugin","RichTextPlugin","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","editorConfigContext","editor","floatingAnchorElem","setFloatingAnchorElem","t0","Symbol","for","_floatingAnchorElem","onRef","t1","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","t4","editorState","editor_0","tags","has","size","t5","features","plugins","_jsxs","Fragment","children","isEditable","_jsx","anchorElem","map","plugin_1","plugin","position","desktopOnly","clientProps","key","_temp","className","ref","_temp2","contentEditable","ignoreSelectionChange","markdownTransformers","length","_temp3","_temp4","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n <InsertParagraphAtEndPlugin />\n <DecoratorPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ;AAClE,YAAYC,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC,QAAQ,QAAQ;AAIpC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,YAAY,QAAQ;AAE7B,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,aAAA,GAKTC,KAAA;EAAA,MAAAC,CAAA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IAAA,OAEpBL,IAAA,CAAAxD,YAAA;MAAA+D,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AAzIxE,SAAAU,OAAAI,QAAA;EAAA,IA8IUlB,QAAA,CAAAC,QAAA,KAAoB;IAAA,OAEpBL,IAAA,CAAAxD,YAAA;MAAA+D,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AAhJxE,SAAAW,OAAAI,QAAA;EAAA,IAsJQnB,QAAA,CAAAC,QAAA,KAAoB;IAAA,OACfL,IAAA,CAAAxD,YAAA;MAAA+D,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Allows to select inputs with `ctrl+a` or `cmd+a`.
3
+ * Required because Lexical preventDefault the event.
4
+ * see: https://github.com/payloadcms/payload/issues/6871
5
+ */
6
+ export declare function SelectAllPlugin(): null;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/SelectAllPlugin/index.tsx"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,eAAe,SAsB9B"}
@@ -0,0 +1,26 @@
1
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
2
+ import { $getSelection, COMMAND_PRIORITY_LOW, SELECT_ALL_COMMAND } from 'lexical';
3
+ import { useEffect } from 'react';
4
+ /**
5
+ * Allows to select inputs with `ctrl+a` or `cmd+a`.
6
+ * Required because Lexical preventDefault the event.
7
+ * see: https://github.com/payloadcms/payload/issues/6871
8
+ */
9
+ export function SelectAllPlugin() {
10
+ const [editor] = useLexicalComposerContext();
11
+ useEffect(() => {
12
+ return editor.registerCommand(SELECT_ALL_COMMAND, () => {
13
+ const selection = $getSelection();
14
+ if (selection) {
15
+ return false;
16
+ }
17
+ const activeElement = document.activeElement;
18
+ if (activeElement instanceof HTMLInputElement) {
19
+ activeElement.select();
20
+ }
21
+ return true;
22
+ }, COMMAND_PRIORITY_LOW);
23
+ }, [editor]);
24
+ return null;
25
+ }
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["useLexicalComposerContext","$getSelection","COMMAND_PRIORITY_LOW","SELECT_ALL_COMMAND","useEffect","SelectAllPlugin","editor","registerCommand","selection","activeElement","document","HTMLInputElement","select"],"sources":["../../../../src/lexical/plugins/SelectAllPlugin/index.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $getSelection, COMMAND_PRIORITY_LOW, SELECT_ALL_COMMAND } from 'lexical'\nimport { useEffect } from 'react'\n\n/**\n * Allows to select inputs with `ctrl+a` or `cmd+a`.\n * Required because Lexical preventDefault the event.\n * see: https://github.com/payloadcms/payload/issues/6871\n */\nexport function SelectAllPlugin() {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n return editor.registerCommand(\n SELECT_ALL_COMMAND,\n () => {\n const selection = $getSelection()\n if (selection) {\n return false\n }\n const activeElement = document.activeElement\n if (activeElement instanceof HTMLInputElement) {\n activeElement.select()\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n }, [editor])\n\n return null\n}\n"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,aAAa,EAAEC,oBAAoB,EAAEC,kBAAkB,QAAQ;AACxE,SAASC,SAAS,QAAQ;AAE1B;;;;;AAKA,OAAO,SAASC,gBAAA;EACd,MAAM,CAACC,MAAA,CAAO,GAAGN,yBAAA;EAEjBI,SAAA,CAAU;IACR,OAAOE,MAAA,CAAOC,eAAe,CAC3BJ,kBAAA,EACA;MACE,MAAMK,SAAA,GAAYP,aAAA;MAClB,IAAIO,SAAA,EAAW;QACb,OAAO;MACT;MACA,MAAMC,aAAA,GAAgBC,QAAA,CAASD,aAAa;MAC5C,IAAIA,aAAA,YAAyBE,gBAAA,EAAkB;QAC7CF,aAAA,CAAcG,MAAM;MACtB;MACA,OAAO;IACT,GACAV,oBAAA;EAEJ,GAAG,CAACI,MAAA,CAAO;EAEX,OAAO;AACT","ignoreList":[]}
@@ -108,10 +108,8 @@ export function useDynamicPositioning(resolution, targetElementRef, onReposition
108
108
  if (targetElement != null && resolution != null) {
109
109
  const rootElement = editor.getRootElement();
110
110
  const rootScrollParent = rootElement != null ? getScrollParent(rootElement, false) : document.body;
111
- let ticking;
112
- ticking = false;
113
- let previousIsInView;
114
- previousIsInView = isTriggerVisibleInNearestScrollContainer(targetElement, rootScrollParent);
111
+ let ticking = false;
112
+ let previousIsInView = isTriggerVisibleInNearestScrollContainer(targetElement, rootScrollParent);
115
113
  const handleScroll = function () {
116
114
  if (!ticking) {
117
115
  window.requestAnimationFrame(function () {
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalMenu.js","names":["c","_c","useLexicalComposerContext","mergeRegister","$getSelection","$isRangeSelection","$setSelection","COMMAND_PRIORITY_LOW","createCommand","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_ENTER_COMMAND","KEY_ESCAPE_COMMAND","KEY_TAB_COMMAND","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","CAN_USE_DOM","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","parent1","parentElement","test","overflow","overflowY","overflowX","isTriggerVisibleInNearestScrollContainer","targetElement","containerElement","tRect","cRect","bottom","useDynamicPositioning","resolution","targetElementRef","onReposition","onVisibilityChange","$","editor","t0","current","rootElement","getRootElement","rootScrollParent","ticking","previousIsInView","handleScroll","requestAnimationFrame","isInView","resizeObserver","ResizeObserver","addEventListener","capture","passive","observe","disconnect","removeEventListener","t1","SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND","LexicalMenu","anchorElementRef","close","groups","menuRenderFn","shouldSplitNodeWithQuery","selectedItemKey","setSelectedItemKey","updateSelectedItem","item","rootElem","setAttribute","key","setSelectedItemKeyToFirstMatchingItem","allItems","flatMap","group","items","firstMatchingItem","selectItemAndCleanUp","selectedItem","update","textNodeContainingQuery","remove","setTimeout","read","clone","onSelect","queryString","removeAttribute","registerCommand","ref","payload","event","selectedIndex","findIndex","newSelectedIndex","newSelectedItem","dispatchCommand","index","preventDefault","stopImmediatePropagation","find","listItemProps","setContainerDivAttributes","containerDiv","className","display","useMenuAnchorRef","anchorElem","setResolution","Symbol","for","createElement","parent","undefined","menuEle","firstChild","width","getRect","left","rawTop","scrollY","scrollX","menuRect","menuHeight","menuWidth","rootElementRect","right","wouldGoOffBottomOfScreen","wouldGoOffTopOfScreen","isConnected","append","positionMenu","t2","t3","rootElement_0","containerDiv_0","t4"],"sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection, LexicalCommand, LexicalEditor, TextNode } from 'lexical'\nimport type { JSX, ReactPortal, RefObject } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $setSelection,\n COMMAND_PRIORITY_LOW,\n createCommand,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_ENTER_COMMAND,\n KEY_ESCAPE_COMMAND,\n KEY_TAB_COMMAND,\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\nimport { CAN_USE_DOM } from '../../../utils/canUseDOM.js'\n\nexport type MenuResolution = {\n getRect: () => DOMRect\n match?: MenuTextMatch\n}\n\nconst baseClass = 'slash-menu-popup'\n\nexport type MenuRenderFn = (\n anchorElementRef: RefObject<HTMLElement | null>,\n itemProps: {\n groups: Array<SlashMenuGroupInternal>\n selectedItemKey: null | string\n selectItemAndCleanUp: (selectedItem: SlashMenuItem) => void\n setSelectedItemKey: (itemKey: string) => void\n },\n matchingString: null | string,\n) => JSX.Element | null | ReactPortal\n\nconst scrollIntoViewIfNeeded = (target: HTMLElement) => {\n const typeaheadContainerNode = document.getElementById('slash-menu')\n if (!typeaheadContainerNode) {\n return\n }\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 | undefined {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) || !selection.isCollapsed()) {\n return\n }\n const anchor = selection.anchor\n if (anchor.type !== 'text') {\n return\n }\n const anchorNode = anchor.getNode()\n if (!anchorNode.isSimpleText()) {\n return\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\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 targetElementRef: RefObject<HTMLElement | null>,\n onReposition: () => void,\n onVisibilityChange?: (isInView: boolean) => void,\n) {\n const [editor] = useLexicalComposerContext()\n useEffect(() => {\n const targetElement = targetElementRef.current\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.disconnect()\n window.removeEventListener('resize', onReposition)\n document.removeEventListener('scroll', handleScroll, true)\n }\n }\n }, [editor, onVisibilityChange, onReposition, resolution, targetElementRef])\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 resolution,\n shouldSplitNodeWithQuery = false,\n}: {\n anchorElementRef: RefObject<HTMLElement | null>\n close: () => void\n editor: LexicalEditor\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\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 close()\n\n editor.update(() => {\n const textNodeContainingQuery =\n resolution.match != null && shouldSplitNodeWithQuery\n ? $splitNodeContainingQuery(resolution.match)\n : null\n\n if (textNodeContainingQuery) {\n textNodeContainingQuery.remove()\n }\n })\n\n setTimeout(() => {\n // Needed in Firefox. See https://github.com/payloadcms/payload/issues/10724\n let selection: BaseSelection | undefined\n editor.read(() => {\n selection = $getSelection()?.clone()\n })\n editor.update(() => {\n if (selection) {\n $setSelection(selection)\n }\n })\n\n selectedItem.onSelect({\n editor,\n queryString: resolution.match ? resolution.match.matchingString : '',\n })\n }, 0)\n },\n [editor, shouldSplitNodeWithQuery, resolution.match, 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 if (!newSelectedItem) {\n return false\n }\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 if (!newSelectedItem) {\n return false\n }\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 selectedItemKey,\n selectItemAndCleanUp,\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\nfunction setContainerDivAttributes(containerDiv: HTMLElement, className?: string) {\n if (className != null) {\n containerDiv.className = className\n }\n containerDiv.setAttribute('aria-label', 'Slash menu')\n containerDiv.setAttribute('role', 'listbox')\n containerDiv.style.display = 'block'\n containerDiv.style.position = 'absolute'\n}\n\nexport function useMenuAnchorRef(\n anchorElem: HTMLElement,\n resolution: MenuResolution | null,\n setResolution: (r: MenuResolution | null) => void,\n className?: string,\n): RefObject<HTMLElement | null> {\n const [editor] = useLexicalComposerContext()\n const anchorElementRef = useRef<HTMLElement | null>(\n CAN_USE_DOM ? document.createElement('div') : null,\n )\n const positionMenu = useCallback(() => {\n if (anchorElementRef.current === null || parent === undefined) {\n return\n }\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 setContainerDivAttributes(containerDiv, className)\n anchorElem.append(containerDiv)\n }\n containerDiv.setAttribute('id', 'slash-menu')\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 containerDiv.removeAttribute('id')\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, positionMenu, onVisibilityChange)\n\n return anchorElementRef\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,aAAa,QAAQ;AAC9B,SACEC,aAAa,EACbC,iBAAiB,EACjBC,aAAa,EACbC,oBAAoB,EACpBC,aAAa,EACbC,sBAAsB,EACtBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAe,QACV;AACP,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAKnF,SAASC,WAAW,QAAQ;AAO5B,MAAMC,SAAA,GAAY;AAalB,MAAMC,sBAAA,GAA0BC,MAAA;EAC9B,MAAMC,sBAAA,GAAyBC,QAAA,CAASC,cAAc,CAAC;EACvD,IAAI,CAACF,sBAAA,EAAwB;IAC3B;EACF;EAEA,MAAMG,aAAA,GAAgBH,sBAAA,CAAuBI,qBAAqB;EAElE,IAAID,aAAA,CAAcE,GAAG,GAAGF,aAAA,CAAcG,MAAM,GAAGC,MAAA,CAAOC,WAAW,EAAE;IACjER,sBAAA,CAAuBS,cAAc,CAAC;MACpCC,KAAA,EAAO;IACT;EACF;EAEA,IAAIP,aAAA,CAAcE,GAAG,GAAG,GAAG;IACzBL,sBAAA,CAAuBS,cAAc,CAAC;MACpCC,KAAA,EAAO;IACT;EACF;EAEAX,MAAA,CAAOU,cAAc,CAAC;IAAEC,KAAA,EAAO;EAAU;AAC3C;AAEA;;;;AAIA,SAASC,mBAAmBC,YAAoB,EAAEC,SAAiB,EAAEC,MAAc;EACjF,IAAIC,aAAA,GAAgBD,MAAA;EACpB,KAAK,IAAIE,CAAA,GAAID,aAAA,EAAeC,CAAA,IAAKH,SAAA,CAAUI,MAAM,EAAED,CAAA,IAAK;IACtD,IAAI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BwE,YAAA,EAAchG,kBAAA;EAAA,OAE3DwB,gBAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"LexicalMenu.js","names":["c","_c","useLexicalComposerContext","mergeRegister","$getSelection","$isRangeSelection","$setSelection","COMMAND_PRIORITY_LOW","createCommand","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_ENTER_COMMAND","KEY_ESCAPE_COMMAND","KEY_TAB_COMMAND","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","CAN_USE_DOM","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","parent1","parentElement","test","overflow","overflowY","overflowX","isTriggerVisibleInNearestScrollContainer","targetElement","containerElement","tRect","cRect","bottom","useDynamicPositioning","resolution","targetElementRef","onReposition","onVisibilityChange","$","editor","t0","current","rootElement","getRootElement","rootScrollParent","ticking","previousIsInView","handleScroll","requestAnimationFrame","isInView","resizeObserver","ResizeObserver","addEventListener","capture","passive","observe","disconnect","removeEventListener","t1","SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND","LexicalMenu","anchorElementRef","close","groups","menuRenderFn","shouldSplitNodeWithQuery","selectedItemKey","setSelectedItemKey","updateSelectedItem","item","rootElem","setAttribute","key","setSelectedItemKeyToFirstMatchingItem","allItems","flatMap","group","items","firstMatchingItem","selectItemAndCleanUp","selectedItem","update","textNodeContainingQuery","remove","setTimeout","read","clone","onSelect","queryString","removeAttribute","registerCommand","ref","payload","event","selectedIndex","findIndex","newSelectedIndex","newSelectedItem","dispatchCommand","index","preventDefault","stopImmediatePropagation","find","listItemProps","setContainerDivAttributes","containerDiv","className","display","useMenuAnchorRef","anchorElem","setResolution","Symbol","for","createElement","parent","undefined","menuEle","firstChild","width","getRect","left","rawTop","scrollY","scrollX","menuRect","menuHeight","menuWidth","rootElementRect","right","wouldGoOffBottomOfScreen","wouldGoOffTopOfScreen","isConnected","append","positionMenu","t2","t3","rootElement_0","containerDiv_0","t4"],"sources":["../../../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection, LexicalCommand, LexicalEditor, TextNode } from 'lexical'\nimport type { JSX, ReactPortal, RefObject } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $setSelection,\n COMMAND_PRIORITY_LOW,\n createCommand,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_ENTER_COMMAND,\n KEY_ESCAPE_COMMAND,\n KEY_TAB_COMMAND,\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\nimport { CAN_USE_DOM } from '../../../utils/canUseDOM.js'\n\nexport type MenuResolution = {\n getRect: () => DOMRect\n match?: MenuTextMatch\n}\n\nconst baseClass = 'slash-menu-popup'\n\nexport type MenuRenderFn = (\n anchorElementRef: RefObject<HTMLElement | null>,\n itemProps: {\n groups: Array<SlashMenuGroupInternal>\n selectedItemKey: null | string\n selectItemAndCleanUp: (selectedItem: SlashMenuItem) => void\n setSelectedItemKey: (itemKey: string) => void\n },\n matchingString: null | string,\n) => JSX.Element | null | ReactPortal\n\nconst scrollIntoViewIfNeeded = (target: HTMLElement) => {\n const typeaheadContainerNode = document.getElementById('slash-menu')\n if (!typeaheadContainerNode) {\n return\n }\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 | undefined {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) || !selection.isCollapsed()) {\n return\n }\n const anchor = selection.anchor\n if (anchor.type !== 'text') {\n return\n }\n const anchorNode = anchor.getNode()\n if (!anchorNode.isSimpleText()) {\n return\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\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 targetElementRef: RefObject<HTMLElement | null>,\n onReposition: () => void,\n onVisibilityChange?: (isInView: boolean) => void,\n) {\n const [editor] = useLexicalComposerContext()\n useEffect(() => {\n const targetElement = targetElementRef.current\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.disconnect()\n window.removeEventListener('resize', onReposition)\n document.removeEventListener('scroll', handleScroll, true)\n }\n }\n }, [editor, onVisibilityChange, onReposition, resolution, targetElementRef])\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 resolution,\n shouldSplitNodeWithQuery = false,\n}: {\n anchorElementRef: RefObject<HTMLElement | null>\n close: () => void\n editor: LexicalEditor\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\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 close()\n\n editor.update(() => {\n const textNodeContainingQuery =\n resolution.match != null && shouldSplitNodeWithQuery\n ? $splitNodeContainingQuery(resolution.match)\n : null\n\n if (textNodeContainingQuery) {\n textNodeContainingQuery.remove()\n }\n })\n\n setTimeout(() => {\n // Needed in Firefox. See https://github.com/payloadcms/payload/issues/10724\n let selection: BaseSelection | undefined\n editor.read(() => {\n selection = $getSelection()?.clone()\n })\n editor.update(() => {\n if (selection) {\n $setSelection(selection)\n }\n })\n\n selectedItem.onSelect({\n editor,\n queryString: resolution.match ? resolution.match.matchingString : '',\n })\n }, 0)\n },\n [editor, shouldSplitNodeWithQuery, resolution.match, 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 if (!newSelectedItem) {\n return false\n }\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 if (!newSelectedItem) {\n return false\n }\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 selectedItemKey,\n selectItemAndCleanUp,\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\nfunction setContainerDivAttributes(containerDiv: HTMLElement, className?: string) {\n if (className != null) {\n containerDiv.className = className\n }\n containerDiv.setAttribute('aria-label', 'Slash menu')\n containerDiv.setAttribute('role', 'listbox')\n containerDiv.style.display = 'block'\n containerDiv.style.position = 'absolute'\n}\n\nexport function useMenuAnchorRef(\n anchorElem: HTMLElement,\n resolution: MenuResolution | null,\n setResolution: (r: MenuResolution | null) => void,\n className?: string,\n): RefObject<HTMLElement | null> {\n const [editor] = useLexicalComposerContext()\n const anchorElementRef = useRef<HTMLElement | null>(\n CAN_USE_DOM ? document.createElement('div') : null,\n )\n const positionMenu = useCallback(() => {\n if (anchorElementRef.current === null || parent === undefined) {\n return\n }\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 setContainerDivAttributes(containerDiv, className)\n anchorElem.append(containerDiv)\n }\n containerDiv.setAttribute('id', 'slash-menu')\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 containerDiv.removeAttribute('id')\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, positionMenu, onVisibilityChange)\n\n return anchorElementRef\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,aAAa,QAAQ;AAC9B,SACEC,aAAa,EACbC,iBAAiB,EACjBC,aAAa,EACbC,oBAAoB,EACpBC,aAAa,EACbC,sBAAsB,EACtBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAe,QACV;AACP,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAKnF,SAASC,WAAW,QAAQ;AAO5B,MAAMC,SAAA,GAAY;AAalB,MAAMC,sBAAA,GAA0BC,MAAA;EAC9B,MAAMC,sBAAA,GAAyBC,QAAA,CAAS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A+F,YAAA;IAAA/F,CAAA,MAAAJ,UAAA;IAAAI,CAAA,MAAAgG,EAAA;IAAAhG,CAAA,OAAAiG,EAAA;EAAA;IAAAD,EAAA,GAAAhG,CAAA;IAAAiG,EAAA,GAAAjG,CAAA;EAAA;EAhBrC1E,SAAA,CAAU0K,EAgBV,EAAGC,EAAkC;EAAA,IAAAG,EAAA;EAAA,IAAApG,CAAA,SAAAJ,UAAA,IAAAI,CAAA,SAAAwE,aAAA;IAGnC4B,EAAA,GAAAzF,QAAA;MAAA,IACMf,UAAA,SAAe;QAAA,KACZe,QAAA;UACH6D,aAAA,KAAc;QAAA;MAAA;IAAA;IAGpBxE,CAAA,OAAAJ,UAAA;IAAAI,CAAA,OAAAwE,aAAA;IAAAxE,CAAA,OAAAoG,EAAA;EAAA;IAAAA,EAAA,GAAApG,CAAA;EAAA;EAPF,MAAAD,kBAAA,GAA2BqG,EAQE;EAG7BzG,qBAAA,CAAsBC,UAAA,EAAY2B,gBAAA,EAAkBwE,YAAA,EAAchG,kBAAA;EAAA,OAE3DwB,gBAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"generateImportMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateImportMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAE1E,eAAO,MAAM,oBAAoB,SACxB;IAAE,kBAAkB,EAAE,wBAAwB,CAAA;CAAE,KAAG,eAAe,CAAC,mBAAmB,CA2D5F,CAAA"}
1
+ {"version":3,"file":"generateImportMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateImportMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,eAAe,EAAE,MAAM,SAAS,CAAA;AAIhE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAE1E,eAAO,MAAM,oBAAoB,SACxB;IAAE,kBAAkB,EAAE,wBAAwB,CAAA;CAAE,KAAG,eAAe,CAAC,mBAAmB,CA0D5F,CAAA"}
@@ -1,7 +1,5 @@
1
1
  import { genImportMapIterateFields } from 'payload';
2
- export const getGenerateImportMap = args =>
3
- // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
4
- ({
2
+ export const getGenerateImportMap = args => ({
5
3
  addToImportMap,
6
4
  baseDir,
7
5
  config,
@@ -1 +1 @@
1
- {"version":3,"file":"generateImportMap.js","names":["genImportMapIterateFields","getGenerateImportMap","args","addToImportMap","baseDir","config","importMap","imports","resolvedFeature","resolvedFeatureMap","values","componentImports","Array","isArray","length","forEach","component","Object","ClientComponent","ClientFeature","nodes","node","getSubFields","subFields","fields"],"sources":["../../src/utilities/generateImportMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { genImportMapIterateFields } from 'payload'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\n\nexport const getGenerateImportMap =\n (args: { resolvedFeatureMap: ResolvedServerFeatureMap }): RichTextAdapter['generateImportMap'] =>\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n ({ addToImportMap, baseDir, config, importMap, imports }) => {\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell')\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField')\n addToImportMap('@payloadcms/richtext-lexical/rsc#LexicalDiffComponent')\n\n // iterate just through args.resolvedFeatureMap.values()\n for (const resolvedFeature of args.resolvedFeatureMap.values()) {\n if ('componentImports' in resolvedFeature) {\n if (typeof resolvedFeature.componentImports === 'function') {\n resolvedFeature.componentImports({\n addToImportMap,\n baseDir,\n config,\n importMap,\n imports,\n })\n } else if (\n Array.isArray(resolvedFeature.componentImports) &&\n resolvedFeature.componentImports?.length\n ) {\n resolvedFeature.componentImports.forEach((component) => {\n addToImportMap(component)\n })\n } else if (typeof resolvedFeature.componentImports === 'object') {\n for (const component of Object.values(resolvedFeature.componentImports)) {\n addToImportMap(component)\n }\n }\n }\n\n const ClientComponent = resolvedFeature.ClientFeature\n if (ClientComponent) {\n addToImportMap(ClientComponent)\n }\n\n /*\n Now run for all possible sub-fields\n */\n if (resolvedFeature.nodes?.length) {\n for (const node of resolvedFeature.nodes) {\n if (typeof node?.getSubFields !== 'function') {\n continue\n }\n const subFields = node.getSubFields({})\n if (subFields?.length) {\n genImportMapIterateFields({\n addToImportMap,\n baseDir,\n config,\n fields: subFields,\n importMap,\n imports,\n })\n }\n }\n }\n }\n }\n"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ;AAI1C,OAAO,MAAMC,oBAAA,GACVC,IAAA;AACD;AACA,CAAC;EAAEC,cAAc;EAAEC,OAAO;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAO,CAAE;EACtDJ,cAAA,CAAe;EACfA,cAAA,CAAe;EACfA,cAAA,CAAe;EAEf;EACA,KAAK,MAAMK,eAAA,IAAmBN,IAAA,CAAKO,kBAAkB,CAACC,MAAM,IAAI;IAC9D,IAAI,sBAAsBF,eAAA,EAAiB;MACzC,IAAI,OAAOA,eAAA,CAAgBG,gBAAgB,KAAK,YAAY;QAC1DH,eAAA,CAAgBG,gBAAgB,CAAC;UAC/BR,cAAA;UACAC,OAAA;UACAC,MAAA;UACAC,SAAA;UACAC;QACF;MACF,OAAO,IACLK,KAAA,CAAMC,OAAO,CAACL,eAAA,CAAgBG,gBAAgB,KAC9CH,eAAA,CAAgBG,gBAAgB,EAAEG,MAAA,EAClC;QACAN,eAAA,CAAgBG,gBAAgB,CAACI,OAAO,CAAEC,SAAA;UACxCb,cAAA,CAAea,SAAA;QACjB;MACF,OAAO,IAAI,OAAOR,eAAA,CAAgBG,gBAAgB,KAAK,UAAU;QAC/D,KAAK,MAAMK,SAAA,IAAaC,MAAA,CAAOP,MAAM,CAACF,eAAA,CAAgBG,gBAAgB,GAAG;UACvER,cAAA,CAAea,SAAA;QACjB;MACF;IACF;IAEA,MAAME,eAAA,GAAkBV,eAAA,CAAgBW,aAAa;IACrD,IAAID,eAAA,EAAiB;MACnBf,cAAA,CAAee,eAAA;IACjB;IAEA;;;IAGA,IAAIV,eAAA,CAAgBY,KAAK,EAAEN,MAAA,EAAQ;MACjC,KAAK,MAAMO,IAAA,IAAQb,eAAA,CAAgBY,KAAK,EAAE;QACxC,IAAI,OAAOC,IAAA,EAAMC,YAAA,KAAiB,YAAY;UAC5C;QACF;QACA,MAAMC,SAAA,GAAYF,IAAA,CAAKC,YAAY,CAAC,CAAC;QACrC,IAAIC,SAAA,EAAWT,MAAA,EAAQ;UACrBd,yBAAA,CAA0B;YACxBG,cAAA;YACAC,OAAA;YACAC,MAAA;YACAmB,MAAA,EAAQD,SAAA;YACRjB,SAAA;YACAC;UACF;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"generateImportMap.js","names":["genImportMapIterateFields","getGenerateImportMap","args","addToImportMap","baseDir","config","importMap","imports","resolvedFeature","resolvedFeatureMap","values","componentImports","Array","isArray","length","forEach","component","Object","ClientComponent","ClientFeature","nodes","node","getSubFields","subFields","fields"],"sources":["../../src/utilities/generateImportMap.tsx"],"sourcesContent":["import type { PayloadComponent, RichTextAdapter } from 'payload'\n\nimport { genImportMapIterateFields } from 'payload'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\n\nexport const getGenerateImportMap =\n (args: { resolvedFeatureMap: ResolvedServerFeatureMap }): RichTextAdapter['generateImportMap'] =>\n ({ addToImportMap, baseDir, config, importMap, imports }) => {\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell')\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField')\n addToImportMap('@payloadcms/richtext-lexical/rsc#LexicalDiffComponent')\n\n // iterate just through args.resolvedFeatureMap.values()\n for (const resolvedFeature of args.resolvedFeatureMap.values()) {\n if ('componentImports' in resolvedFeature) {\n if (typeof resolvedFeature.componentImports === 'function') {\n resolvedFeature.componentImports({\n addToImportMap,\n baseDir,\n config,\n importMap,\n imports,\n })\n } else if (\n Array.isArray(resolvedFeature.componentImports) &&\n resolvedFeature.componentImports?.length\n ) {\n resolvedFeature.componentImports.forEach((component) => {\n addToImportMap(component)\n })\n } else if (typeof resolvedFeature.componentImports === 'object') {\n for (const component of Object.values(resolvedFeature.componentImports)) {\n addToImportMap(component as PayloadComponent)\n }\n }\n }\n\n const ClientComponent = resolvedFeature.ClientFeature\n if (ClientComponent) {\n addToImportMap(ClientComponent)\n }\n\n /*\n Now run for all possible sub-fields\n */\n if (resolvedFeature.nodes?.length) {\n for (const node of resolvedFeature.nodes) {\n if (typeof node?.getSubFields !== 'function') {\n continue\n }\n const subFields = node.getSubFields({})\n if (subFields?.length) {\n genImportMapIterateFields({\n addToImportMap,\n baseDir,\n config,\n fields: subFields,\n importMap,\n imports,\n })\n }\n }\n }\n }\n }\n"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ;AAI1C,OAAO,MAAMC,oBAAA,GACVC,IAAA,IACD,CAAC;EAAEC,cAAc;EAAEC,OAAO;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAO,CAAE;EACtDJ,cAAA,CAAe;EACfA,cAAA,CAAe;EACfA,cAAA,CAAe;EAEf;EACA,KAAK,MAAMK,eAAA,IAAmBN,IAAA,CAAKO,kBAAkB,CAACC,MAAM,IAAI;IAC9D,IAAI,sBAAsBF,eAAA,EAAiB;MACzC,IAAI,OAAOA,eAAA,CAAgBG,gBAAgB,KAAK,YAAY;QAC1DH,eAAA,CAAgBG,gBAAgB,CAAC;UAC/BR,cAAA;UACAC,OAAA;UACAC,MAAA;UACAC,SAAA;UACAC;QACF;MACF,OAAO,IACLK,KAAA,CAAMC,OAAO,CAACL,eAAA,CAAgBG,gBAAgB,KAC9CH,eAAA,CAAgBG,gBAAgB,EAAEG,MAAA,EAClC;QACAN,eAAA,CAAgBG,gBAAgB,CAACI,OAAO,CAAEC,SAAA;UACxCb,cAAA,CAAea,SAAA;QACjB;MACF,OAAO,IAAI,OAAOR,eAAA,CAAgBG,gBAAgB,KAAK,UAAU;QAC/D,KAAK,MAAMK,SAAA,IAAaC,MAAA,CAAOP,MAAM,CAACF,eAAA,CAAgBG,gBAAgB,GAAG;UACvER,cAAA,CAAea,SAAA;QACjB;MACF;IACF;IAEA,MAAME,eAAA,GAAkBV,eAAA,CAAgBW,aAAa;IACrD,IAAID,eAAA,EAAiB;MACnBf,cAAA,CAAee,eAAA;IACjB;IAEA;;;IAGA,IAAIV,eAAA,CAAgBY,KAAK,EAAEN,MAAA,EAAQ;MACjC,KAAK,MAAMO,IAAA,IAAQb,eAAA,CAAgBY,KAAK,EAAE;QACxC,IAAI,OAAOC,IAAA,EAAMC,YAAA,KAAiB,YAAY;UAC5C;QACF;QACA,MAAMC,SAAA,GAAYF,IAAA,CAAKC,YAAY,CAAC,CAAC;QACrC,IAAIC,SAAA,EAAWT,MAAA,EAAQ;UACrBd,yBAAA,CAA0B;YACxBG,cAAA;YACAC,OAAA;YACAC,MAAA;YACAmB,MAAA,EAAQD,SAAA;YACRjB,SAAA;YACAC;UACF;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.41.0-internal.8617025",
3
+ "version": "3.41.0-internal.c12584b",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -17,7 +17,10 @@
17
17
  "url": "https://payloadcms.com"
18
18
  }
19
19
  ],
20
- "sideEffects": false,
20
+ "sideEffects": [
21
+ "*.scss",
22
+ "*.css"
23
+ ],
21
24
  "type": "module",
22
25
  "exports": {
23
26
  ".": {
@@ -365,36 +368,36 @@
365
368
  "react-error-boundary": "4.1.2",
366
369
  "ts-essentials": "10.0.3",
367
370
  "uuid": "10.0.0",
368
- "@payloadcms/translations": "3.41.0-internal.8617025",
369
- "@payloadcms/ui": "3.41.0-internal.8617025"
371
+ "@payloadcms/translations": "3.41.0-internal.c12584b",
372
+ "@payloadcms/ui": "3.41.0-internal.c12584b"
370
373
  },
371
374
  "devDependencies": {
372
- "@babel/cli": "7.26.4",
373
- "@babel/core": "7.26.7",
374
- "@babel/preset-env": "7.26.7",
375
- "@babel/preset-react": "7.26.3",
376
- "@babel/preset-typescript": "7.26.0",
375
+ "@babel/cli": "7.27.2",
376
+ "@babel/core": "7.27.3",
377
+ "@babel/preset-env": "7.27.2",
378
+ "@babel/preset-react": "7.27.1",
379
+ "@babel/preset-typescript": "7.27.1",
377
380
  "@lexical/eslint-plugin": "0.28.0",
378
381
  "@types/escape-html": "1.0.4",
379
382
  "@types/json-schema": "7.0.15",
380
383
  "@types/node": "22.5.4",
381
384
  "@types/react": "19.1.0",
382
385
  "@types/react-dom": "19.1.2",
383
- "babel-plugin-react-compiler": "19.0.0-beta-e993439-20250405",
386
+ "babel-plugin-react-compiler": "19.1.0-rc.2",
384
387
  "babel-plugin-transform-remove-imports": "^1.8.0",
385
- "esbuild": "0.24.2",
388
+ "esbuild": "0.25.5",
386
389
  "esbuild-sass-plugin": "3.3.1",
387
- "swc-plugin-transform-remove-imports": "3.1.0",
390
+ "swc-plugin-transform-remove-imports": "4.0.4",
388
391
  "@payloadcms/eslint-config": "3.28.0",
389
- "payload": "3.41.0-internal.8617025"
392
+ "payload": "3.41.0-internal.c12584b"
390
393
  },
391
394
  "peerDependencies": {
392
395
  "@faceless-ui/modal": "3.0.0-beta.2",
393
396
  "@faceless-ui/scroll-info": "2.0.0",
394
397
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
395
398
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
396
- "@payloadcms/next": "3.41.0-internal.8617025",
397
- "payload": "3.41.0-internal.8617025"
399
+ "@payloadcms/next": "3.41.0-internal.c12584b",
400
+ "payload": "3.41.0-internal.c12584b"
398
401
  },
399
402
  "engines": {
400
403
  "node": "^18.20.2 || >=20.9.0"
@@ -1,2 +0,0 @@
1
- "use client";import{b as Re,e as _,g as we,h as Te,i as ve,j as De,k as Me}from"./chunk-DOZWITPU.js";import{a as ke,b as k}from"./chunk-BZZVLW4U.js";import{jsx as O,jsxs as ge}from"react/jsx-runtime";import{FieldDescription as fn,FieldError as mn,FieldLabel as pn,RenderCustomComponent as yt,useEditDepth as gn,useEffectEvent as hn,useField as yn}from"@payloadcms/ui";import{mergeFieldStyles as xn}from"@payloadcms/ui/shared";import xt,{useCallback as Et,useEffect as bt,useMemo as En,useRef as bn,useState as Ct}from"react";import{ErrorBoundary as Cn}from"react-error-boundary";import"./bundled.css";import{jsx as F}from"react/jsx-runtime";import{LexicalComposer as cn}from"@lexical/react/LexicalComposer.js";import{useEditDepth as dn}from"@payloadcms/ui";import*as pt from"react";import{useMemo as un}from"react";import{c as Go}from"react/compiler-runtime";import{jsx as b,jsxs as te}from"react/jsx-runtime";import{useLexicalComposerContext as Uo}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as qo}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as Jo}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Qo}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as Xo}from"@lexical/react/LexicalRichTextPlugin.js";import{BLUR_COMMAND as Zo,COMMAND_PRIORITY_LOW as ft,FOCUS_COMMAND as en}from"lexical";import*as J from"react";import{useEffect as tn,useState as on}from"react";import{jsx as Le}from"react/jsx-runtime";import"react";var K=({anchorElem:t,clientProps:e,plugin:o})=>o.position==="floatingAnchorElem"&&t?o.Component&&Le(o.Component,{anchorElem:t,clientProps:e}):o.Component&&Le(o.Component,{clientProps:e});import{c as kt}from"react/compiler-runtime";import{useLexicalComposerContext as Rt}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as ne,mergeRegister as wt}from"@lexical/utils";import{$createNodeSelection as Tt,$getEditor as X,$getNearestNodeFromDOMNode as vt,$getSelection as re,$isDecoratorNode as H,$isElementNode as xe,$isLineBreakNode as Dt,$isNodeSelection as ie,$isRangeSelection as Be,$isRootOrShadowRoot as Mt,$isTextNode as Lt,$setSelection as Ie,CLICK_COMMAND as Bt,COMMAND_PRIORITY_LOW as Y,KEY_ARROW_DOWN_COMMAND as It,KEY_ARROW_UP_COMMAND as At,KEY_BACKSPACE_COMMAND as _t,KEY_DELETE_COMMAND as Ft,SELECTION_CHANGE_COMMAND as Ot}from"lexical";import{useEffect as $t}from"react";function Ae(){let t=kt(3),[e]=Rt(),o=Vt,r,n;return t[0]!==e?(r=()=>wt(e.registerCommand(Bt,Yt,Y),e.registerCommand(Ft,o,Y),e.registerCommand(_t,o,Y),e.registerCommand(Ot,Wt,Y),e.registerCommand(At,jt,Y),e.registerCommand(It,Kt,Y)),n=[e],t[0]=e,t[1]=r,t[2]=n):(r=t[1],n=t[2]),$t(r,n),null}function Kt(t){let e=re();if(ie(e)){t.preventDefault();let i=e.getNodes()[0]?.getNextSibling();if(H(i)){let y=X().getElementByKey(i.getKey());return y&&Z({element:y,node:i}),!0}if(!xe(i))return!0;let s=i.getFirstDescendant()??i;return s&&(ne(s,se)?.selectEnd(),t.preventDefault()),!0}if(!Be(e))return!1;let r=(e.isBackward()?e.anchor:e.focus).getNode(),n=ne(r,Ht),c=n?.getNextSibling();if(!n||c!==_e(n))return!1;if(H(c)){let i=X().getElementByKey(c.getKey());if(i)return Z({element:i,node:c}),t.preventDefault(),!0}return!1}function Ht(t){return _e(t)!==null}function jt(t){let e=re();if(ie(e)){let i=e.getNodes()[0]?.getPreviousSibling();if(H(i)){let y=X().getElementByKey(i.getKey());return y?(Z({element:y,node:i}),t.preventDefault(),!0):!1}if(!xe(i))return!1;let s=i.getLastDescendant()??i;return s?(ne(s,se)?.selectStart(),t.preventDefault(),!0):!1}if(!Be(e))return!1;let r=(e.isBackward()?e.anchor:e.focus).getNode(),n=ne(r,zt),c=n?.getPreviousSibling();if(!n||c!==Fe(n))return!1;if(H(c)){let i=X().getElementByKey(c.getKey());if(i)return Z({element:i,node:c}),t.preventDefault(),!0}return!1}function zt(t){return Fe(t)!==null}function Wt(){let t=qt();return document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),t?(t.element?.classList.add("decorator-selected"),!0):!1}function Yt(t){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let e=Ut(t);if(!e)return!0;let{target:o}=t;return!(o instanceof HTMLElement)||o.isContentEditable||o.closest('button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role="button"]')?Ie(null):Z(e),!0}function Vt(t){let e=re();return ie(e)?(t.preventDefault(),e.getNodes().forEach(Gt),!0):!1}function Gt(t){t.remove()}function Ut(t){if(!(t.target instanceof HTMLElement))return;let e=t.target.closest('[data-lexical-decorator="true"]');if(!(e instanceof HTMLElement))return;let o=vt(e);return H(o)?{element:e,node:o}:void 0}function qt(){let t=re();if(!ie(t))return;let e=t.getNodes();if(e.length!==1)return;let o=e[0];return H(o)?{decorator:o,element:X().getElementByKey(o.getKey())}:void 0}function Z({element:t,node:e}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=Tt();o.add(e.getKey()),Ie(o),t.scrollIntoView({behavior:"smooth",block:"nearest"}),t.classList.add("decorator-selected")}function se(t){if(H(t)&&!t.isInline())return!0;if(!xe(t)||Mt(t))return!1;let e=t.getFirstChild(),o=e===null||Dt(e)||Lt(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&o}function _e(t){let e=t.getNextSibling();for(;e!==null;){if(se(e))return e;e=e.getNextSibling()}return null}function Fe(t){let e=t.getPreviousSibling();for(;e!==null;){if(se(e))return e;e=e.getPreviousSibling()}return null}import{jsx as Ee}from"react/jsx-runtime";import{useLexicalComposerContext as to}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as oo,isHTMLElement as no}from"lexical";import*as He from"react";import{useCallback as ro,useEffect as Ke,useRef as io,useState as so}from"react";import{createPortal as lo}from"react-dom";var V=(t,e,o,r,n=50,c=25)=>{let i=0;if(t&&!t.contains(r)){let{bottom:s,left:d,right:y,top:g}=t.getBoundingClientRect(),a=g+window.scrollY,l=s+window.scrollY;if(o<a-c||o>l+c||e<d-n||e>y+n)return-1;(e<d||e>y)&&(i=e<d?e-d:e-y)}return i};import{$getNodeByKey as ae}from"lexical";function G(t){let e=t.getBoundingClientRect(),o=getComputedStyle(t).getPropertyValue("transform");if(!o||o==="none")return e;let r=o.split(",").pop();return e.y=e.y-Number(r?.replace(")","")),e}function le(t){let e=(d,y)=>d?parseFloat(window.getComputedStyle(d)[y]):0,{marginBottom:o,marginTop:r}=window.getComputedStyle(t),n=e(t.previousElementSibling,"marginBottom"),c=e(t.nextElementSibling,"marginTop"),i=Math.max(parseFloat(r),n);return{marginBottom:Math.max(parseFloat(o),c),marginTop:i}}import{$getRoot as Jt}from"lexical";function j(t){return t.getEditorState().read(()=>Jt().getChildrenKeys())}var Qt=1,Xt=-1,Oe=0,B={props:null,result:null};function Zt(t,e,o=20){let r=t.x-e.x,n=t.y-e.y;return r*r+n*n<=o*o}function U(t){let{anchorElem:e,cache_threshold:o=20,editor:r,fuzzy:n=!1,horizontalOffset:c=0,point:{x:i,y:s},startIndex:d=0,useEdgeAsDefault:y=!1}=t;if(o>0&&B.props&&B.result&&B.props.fuzzy===t.fuzzy&&B.props.horizontalOffset===t.horizontalOffset&&B.props.useEdgeAsDefault===t.useEdgeAsDefault&&Zt(B.props.point,t.point,o))return B.result;let g=e.getBoundingClientRect(),a=j(r),l={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return r.getEditorState().read(()=>{if(y){let f=r.getElementByKey(a[0]),h=r.getElementByKey(a[a.length-1]);if(f&&h){let[u,m]=[G(f),G(h)];if(s<u.top?(l.blockElem=f,l.distance=u.top-s,l.blockNode=ae(a[0]),l.foundAtIndex=0):s>m.bottom&&(l.distance=s-m.bottom,l.blockNode=ae(a[a.length-1]),l.blockElem=h,l.foundAtIndex=a.length-1),l?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let p=d,x=Oe;for(;p>=0&&p<a.length;){let f=a[p],h=r.getElementByKey(f);if(h===null)break;let u=new _(i+c,s),m=De.fromDOMRect(G(h)),{marginBottom:E,marginTop:w}=le(h),S=m.generateNewRect({bottom:m.bottom+E,left:g.left,right:g.right,top:m.top-w}),{distance:C,isOnBottomSide:R,isOnTopSide:N}=S.distanceFromPoint(u);if(C===0){l.blockElem=h,l.blockNode=ae(f),l.foundAtIndex=p,l.distance=C,l.blockNode&&l.blockNode.getType()==="paragraph"&&l.blockNode.getTextContent()===""&&(!n&&!t.returnEmptyParagraphs&&(l.blockElem=null,l.blockNode=null),l.isFoundNodeEmptyParagraph=!0);break}else n&&C<l.distance&&(l.blockElem=h,l.blockNode=ae(f),l.distance=C,l.foundAtIndex=p);x===Oe&&(N?x=Xt:R?x=Qt:x=1/0),p+=x}}),B.props=t,B.result={blockElem:l.blockElem,blockNode:l.blockNode,foundAtIndex:l.foundAtIndex,isFoundNodeEmptyParagraph:l.isFoundNodeEmptyParagraph},{blockElem:l.blockElem,blockNode:l.blockNode,foundAtIndex:l.foundAtIndex,isFoundNodeEmptyParagraph:l.isFoundNodeEmptyParagraph}}function ce(t,e){return!!t.closest(`.${e}`)}var eo=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function $e(t){if(!t||eo.includes(t.tagName)||t.offsetHeight===0||t.offsetWidth===0)return!1;let e=window.getComputedStyle(t);return!(e.display==="table-cell"||e.position==="absolute"||e.visibility==="hidden"||e.opacity==="0")}function de(t,e,o,r=0){if(!t){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let n=t.getBoundingClientRect(),c=window.getComputedStyle(t),i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),d;if(["lexical-block","lexical-upload","lexical-relationship"].some(a=>t.firstElementChild?.classList.contains(a)))d=n.top+8-s.top;else{let a=$e(t)?parseInt(c.lineHeight,10):0;d=n.top+(a-i.height)/2-s.top}let g=r;e.style.opacity="1",e.style.transform=`translate(${g}px, ${d}px)`}var ao="add-block-menu",ue=1/0;function co(t){return t===0?1/0:ue>=0&&ue<t?ue:Math.floor(t/2)}function uo(t,e,o){let r=e.parentElement,{editorConfig:n}=k(),c=n?.admin?.hideGutter?-24:12,i=io(null),[s,d]=so(null);Ke(()=>{function g(a){let l=a.target;if(!no(l))return;let p=V(r,a.pageX,a.pageY,l);if(p===-1){d(null);return}if(ce(l,ao))return;let x=j(t),{blockElem:f,blockNode:h,foundAtIndex:u}=U({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-p,point:new _(a.x,a.y),returnEmptyParagraphs:!0,startIndex:co(x.length),useEdgeAsDefault:!1});ue=u,f&&h&&(s?.node!==h||s?.elem!==f)&&d({elem:f,node:h})}return document?.addEventListener("mousemove",g),()=>{document?.removeEventListener("mousemove",g)}},[r,e,t,s]),Ke(()=>{i.current&&s?.node&&de(s?.elem,i.current,e,c)},[e,s,c]);let y=ro(g=>{let a=s;a?.node&&(t.update(()=>{let l=!0;if((a?.node.getType()!=="paragraph"||a.node.getTextContent()!=="")&&(l=!1),!l){let p=oo();a?.node.insertAfter(p),setTimeout(()=>{a={elem:t.getElementByKey(p.getKey()),node:p},d(a)},0)}}),setTimeout(()=>{t.update(()=>{t.focus(),a?.node&&"select"in a.node&&typeof a.node.select=="function"&&a.node.select()})},1),setTimeout(()=>{t.dispatchCommand(Te,{node:a?.node})},2),g.stopPropagation(),g.preventDefault())},[t,s]);return lo(Ee(He.Fragment,{children:Ee("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:g=>{y(g)},ref:i,type:"button",children:Ee("div",{className:o?"icon":""})})}),e)}function je(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[r]=to();return uo(r,o,r._editable)}import{jsx as fe,jsxs as mo}from"react/jsx-runtime";import{useLexicalComposerContext as po}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as Ye}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as Ve,$getNodeByKey as go,isHTMLElement as be}from"lexical";import*as Qe from"react";import{useEffect as Ce,useRef as me,useState as Ge}from"react";import{createPortal as ho}from"react-dom";var ze=0,fo=-24;var z=0;function We(t,e,o,r,n,c,i,s,d,y=!1){let{height:g,top:a}=r.getBoundingClientRect(),{top:l,width:p}=i.getBoundingClientRect(),{marginBottom:x,marginTop:f}=le(r),h=a,u=c>=a+g/2+window.scrollY,m=!1;if(n?.elem)if(r!==n?.elem)(u&&n?.elem&&n?.elem===r.nextElementSibling||!u&&n?.elem&&n?.elem===r.previousElementSibling)&&(z++,z<200&&(m=!0));else{z++;let C=n?.boundingBox?.y,R=r.getBoundingClientRect().y;(u===n?.isBelow&&C===R||z<200)&&(m=!1)}if(m)return{isBelow:u,willStayInSamePosition:m};y?h+=g/2:u?h+=g+x/2:h-=f/2;let E=0;y||(u?E=-ze:E=ze);let w=h-l+E,S=fo-e;return o.style.width=`calc(${p}px - ${t})`,o.style.opacity=".8",o.style.transform=`translate(${S}px, calc(${w}px - 2px))`,n?.elem&&(n.elem.style.opacity="",n?.elem===r?u?n.elem.style.marginTop="":n.elem.style.marginBottom="":(n.elem.style.marginBottom="",n.elem.style.marginTop="")),z=0,{isBelow:u,willStayInSamePosition:m}}var yo="draggable-block-menu",Ue="application/x-lexical-drag-block",ee=1/0;function qe(t){return t===0?1/0:ee>=0&&ee<t?ee:Math.floor(t/2)}function xo(t,e){let{transform:o}=e.style;t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=o})}function Je(t,e){t&&(t.style.opacity="0"),e&&(e.style.opacity="",e.style.marginBottom="",e.style.marginTop="")}function Eo(t,e,o){let r=e.parentElement,n=me(null),c=me(null),i=me(null),s=me(!1),[d,y]=Ge(null),[g,a]=Ge(null),{editorConfig:l}=k(),p=l?.admin?.hideGutter?-44:-8;Ce(()=>{function h(u){let m=u.target;if(!be(m))return;let E=V(r,u.pageX,u.pageY,m);if(E===-1){y(null);return}if(ce(m,yo))return;let w=j(t),{blockElem:S,foundAtIndex:C,isFoundNodeEmptyParagraph:R}=U({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-E,point:new _(u.x,u.y),startIndex:qe(w.length),useEdgeAsDefault:!1,verbose:!1});ee=C,!(!S&&!R)&&d!==S&&y(S)}return document?.addEventListener("mousemove",h),()=>{document?.removeEventListener("mousemove",h)}},[r,e,t,d]),Ce(()=>{n.current&&de(d,n.current,e,p)},[e,d,p]),Ce(()=>{function h(m){if(!s.current)return!1;let[E]=Ye(m);if(E)return!1;let{pageY:w,target:S}=m;if(!be(S))return!1;let C=V(r,m.pageX,m.pageY,S,100,50),R=j(t),{blockElem:N,foundAtIndex:L,isFoundNodeEmptyParagraph:A}=U({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-C,point:new _(m.x,m.y),startIndex:qe(R.length),useEdgeAsDefault:!0,verbose:!0});ee=L;let v=c.current;if(N===null||v===null)return!1;if(d!==N){let{isBelow:D,willStayInSamePosition:Q}=We(l?.admin?.hideGutter?"0px":"3rem",p+(l?.admin?.hideGutter?n?.current?.getBoundingClientRect()?.width??0:-(n?.current?.getBoundingClientRect()?.width??0)),v,N,g,w,e,m,i,A);m.preventDefault(),Q||a({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:D})}else g?.elem&&(Je(v,g.elem),a({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:!1}));return!0}function u(m){if(!s.current)return!1;let[E]=Ye(m);if(E)return!1;let{dataTransfer:w,pageY:S,target:C}=m,R=w?.getData(Ue)||"";return t.update(()=>{let N=go(R);if(!N||!be(C))return!1;let L=V(r,m.pageX,m.pageY,C,100,50),{blockElem:A,isFoundNodeEmptyParagraph:v}=U({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-L,point:new _(m.x,m.y),useEdgeAsDefault:!0});if(!A)return!1;let D=Ve(A);if(!D)return!1;if(D===N)return!0;let{height:Q,top:he}=G(A),W=S>=he+Q/2+window.scrollY;v?(D.insertBefore(N),D.remove()):W?D.insertAfter(N):D.insertBefore(N),d!==null&&y(null),document.querySelectorAll(".lexical-block-highlighter").forEach(T=>{T.remove()});let oe=t.getElementByKey(N.getKey());setTimeout(()=>{let T=oe?.getBoundingClientRect();if(!T)return;let P=document.createElement("div");P.className="lexical-block-highlighter",P.style.backgroundColor="var(--theme-elevation-1000",P.style.transition="opacity 0.5s ease-in-out",P.style.zIndex="1",P.style.pointerEvents="none",P.style.boxSizing="border-box",P.style.borderRadius="4px",P.style.position="absolute",document.body.appendChild(P),P.style.opacity="0.1",P.style.height=`${T.height+8}px`,P.style.width=`${T.width+8}px`,P.style.top=`${T.top+window.scrollY-4}px`,P.style.left=`${T.left-4}px`,setTimeout(()=>{P.style.opacity="0",setTimeout(()=>{P.remove()},500)},1e3)},120)}),!0}return document.addEventListener("dragover",h),document.addEventListener("drop",u),()=>{document.removeEventListener("dragover",h),document.removeEventListener("drop",u)}},[r,p,e,t,g,d,l?.admin?.hideGutter]);function x(h){let u=h.dataTransfer;if(!u||!d)return;xo(u,d);let m="";t.update(()=>{let E=Ve(d);E&&(m=E.getKey())}),s.current=!0,u.setData(Ue,m)}function f(){s.current=!1,g?.elem&&Je(c.current,g?.elem)}return ho(mo(Qe.Fragment,{children:[fe("div",{className:"icon draggable-block-menu",draggable:!0,onDragEnd:f,onDragStart:x,ref:n,children:fe("div",{className:o?"icon":""})}),fe("div",{className:"draggable-block-target-line",ref:c}),fe("div",{className:"debug-highlight",ref:i})]}),e)}function Xe(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[r]=po();return Eo(r,o,r._editable)}import{c as bo}from"react/compiler-runtime";import{jsx as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as Co}from"@lexical/react/LexicalComposerContext";import{$createParagraphNode as No,$getRoot as Po}from"lexical";import"react";var Ze="insert-paragraph-at-end",et=()=>{let t=bo(4),[e]=Co(),{editorConfig:o}=k();if(o?.admin?.hideInsertParagraphAtEnd)return null;let r;t[0]!==e?(r=()=>{e.update(So)},t[0]=e,t[1]=r):r=t[1];let n=r,c;return t[2]!==n?(c=Ne("div",{"aria-label":"Insert Paragraph",className:Ze,onClick:n,role:"button",tabIndex:0,children:Ne("div",{className:`${Ze}-inside`,children:Ne("span",{children:"+"})})}),t[2]=n,t[3]=c):c=t[3],c};function So(){let t=No();Po().append(t),t.select()}import{c as ko}from"react/compiler-runtime";import{useLexicalComposerContext as Ro}from"@lexical/react/LexicalComposerContext";import*as tt from"react";var ot=()=>{let t=ko(4),{editorConfig:e}=k(),[o]=Ro(),r,n;return t[0]!==o||t[1]!==e.features.markdownTransformers?(r=()=>Re(o,e.features.markdownTransformers??[]),n=[o,e.features.markdownTransformers],t[0]=o,t[1]=e.features.markdownTransformers,t[2]=r,t[3]=n):(r=t[2],n=t[3]),tt.useEffect(r,n),null};import{useLexicalComposerContext as wo}from"@lexical/react/LexicalComposerContext";import{$getSelection as To,$isRangeSelection as vo,RootNode as Do}from"lexical";import{useEffect as Mo}from"react";function nt(){let[t]=wo();return Mo(()=>t.registerNodeTransform(Do,e=>{let o=To();if(vo(o)){let r=o.anchor.getNode(),n=o.focus.getNode();(!r.isAttached()||!n.isAttached())&&(e.selectEnd(),console.warn("updateEditor: selection has been moved to the end of the editor because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node."))}return!1}),[t]),null}import{jsx as q,jsxs as it}from"react/jsx-runtime";import{useLexicalComposerContext as Bo}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as st}from"@payloadcms/ui";import{useCallback as Io,useMemo as Ao,useState as _o}from"react";import"react";import*as lt from"react-dom";import{c as Lo}from"react/compiler-runtime";import"react";function rt(t,e){let o=Lo(4),{maxLength:r,minLength:n}=e,c=r===void 0?75:r,i=n===void 0?1:n,s;return o[0]!==c||o[1]!==i||o[2]!==t?(s=d=>{let{query:y}=d,g="[^"+t+we+"\\s]",l=new RegExp("(^|\\s|\\()(["+t+"]((?:"+g+"){0,"+c+"}))$").exec(y);if(l!==null){let p=l[1],x=l[3];if(x.length>=i)return{leadOffset:l.index+p.length,matchingString:x,replaceableString:l[2]}}return null},o[0]=c,o[1]=i,o[2]=t,o[3]=s):s=o[3],s}var I="slash-menu-popup";function Fo({isSelected:t,item:e,onClick:o,onMouseEnter:r,ref:n}){let{fieldProps:{featureClientSchemaMap:c,schemaPath:i}}=k(),{i18n:s}=st(),d=`${I}__item ${I}__item-${e.key}`;t&&(d+=` ${I}__item--selected`);let y=e.key;return e.label&&(y=typeof e.label=="function"?e.label({featureClientSchemaMap:c,i18n:s,schemaPath:i}):e.label),y.length>25&&(y=y.substring(0,25)+"..."),it("button",{"aria-selected":t,className:d,id:I+"__item-"+e.key,onClick:o,onMouseEnter:r,ref:n,role:"option",tabIndex:-1,type:"button",children:[e?.Icon&&q(e.Icon,{}),q("span",{className:`${I}__item-text`,children:y})]},e.key)}function at({anchorElem:t=document.body}){let[e]=Bo(),[o,r]=_o(null),{editorConfig:n}=k(),{i18n:c}=st(),{fieldProps:{featureClientSchemaMap:i,schemaPath:s}}=k(),d=rt("/",{minLength:0}),y=Io(()=>{let a=[];for(let l of n.features.slashMenu.dynamicGroups)if(o){let p=l({editor:e,queryString:o});a=a.concat(p)}return a},[e,o,n?.features]),g=Ao(()=>{let a=[];for(let l of n?.features.slashMenu.groups??[])a.push(l);if(o){a=a.map(p=>{let x=p.items.filter(f=>{let h=f.key;return f.label&&(h=typeof f.label=="function"?f.label({featureClientSchemaMap:i,i18n:c,schemaPath:s}):f.label),new RegExp(o,"gi").exec(h)?!0:f.keywords!=null?f.keywords.some(u=>new RegExp(o,"gi").exec(u)):!1});return x.length?{...p,items:x}:null}),a=a.filter(p=>p!=null);let l=y();for(let p of l){let x=a.find(f=>f.key===p.key);x?a=a.filter(f=>f.key!==p.key):x={...p,items:[]},x?.items?.length&&(x.items=x.items.concat(x.items)),a.push(x)}}return a},[o,n?.features.slashMenu.groups,y,i,c,s]);return q(ve,{anchorElem:t,groups:g,menuRenderFn:(a,{selectedItemKey:l,selectItemAndCleanUp:p,setSelectedItemKey:x})=>a.current&&g.length?lt.createPortal(q("div",{className:I,children:g.map(f=>{let h=f.key;return f.label&&i&&(h=typeof f.label=="function"?f.label({featureClientSchemaMap:i,i18n:c,schemaPath:s}):f.label),it("div",{className:`${I}__group ${I}__group-${f.key}`,children:[q("div",{className:`${I}__group-title`,children:h}),f.items.map((u,m)=>q(Fo,{index:m,isSelected:l===u.key,item:u,onClick:()=>{x(u.key),p(u)},onMouseEnter:()=>{x(u.key)},ref:E=>{u.ref={current:E}}},u.key))]},f.key)})}),a.current):null,onQueryChange:r,triggerFn:d})}import{c as Oo}from"react/compiler-runtime";import{useLexicalComposerContext as $o}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as Ko,TextNode as Ho}from"lexical";import{useEffect as jo}from"react";function ct(t){let e=Oo(6),{features:o}=t,[r]=$o(),n;e[0]!==r||e[1]!==o.enabledFormats?(n=()=>{let i=zo(o.enabledFormats);if(i.length!==0)return r.registerNodeTransform(Ho,s=>{i.forEach(d=>{s.hasFormat(d)&&s.toggleFormat(d)})})},e[0]=r,e[1]=o.enabledFormats,e[2]=n):n=e[2];let c;return e[3]!==r||e[4]!==o?(c=[r,o],e[3]=r,e[4]=o,e[5]=c):c=e[5],jo(n,c),null}function zo(t){let e=Object.keys(Ko),o=new Set(t);return e.filter(r=>!o.has(r))}import{c as Wo}from"react/compiler-runtime";import{jsx as dt}from"react/jsx-runtime";import{ContentEditable as Yo}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as Vo}from"@payloadcms/ui";import"react";function ut(t){let e=Wo(7),{className:o,editorConfig:r}=t,{t:n}=Vo(),c;if(e[0]!==o||e[1]!==r?.admin?.placeholder||e[2]!==n){let i;e[4]!==r?.admin?.placeholder||e[5]!==n?(i=r?.admin?.placeholder??n("lexical:general:placeholder"),e[4]=r?.admin?.placeholder,e[5]=n,e[6]=i):i=e[6],c=dt(Yo,{"aria-placeholder":n("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:dt("p",{className:"editor-placeholder",children:i})}),e[0]=o,e[1]=r?.admin?.placeholder,e[2]=n,e[3]=c}else c=e[3];return c}var mt=t=>{let e=Go(19),{editorConfig:o,editorContainerRef:r,isSmallWidthViewport:n,onChange:c}=t,i=k(),[s]=Uo(),[d,y]=on(null),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=f=>{f!==null&&y(f)},e[0]=g):g=e[0];let a=g,l,p;e[1]!==s||e[2]!==i?(l=()=>{if(!i?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}i?.parentEditor?.uuid&&i.parentEditor?.registerChild(i.uuid,i);let f=()=>{i.focusEditor(i)},h=()=>{i.blurEditor(i)},u=s.registerCommand(en,()=>(f(),!0),ft),m=s.registerCommand(Zo,()=>(h(),!0),ft);return()=>{u(),m(),i.parentEditor?.unregisterChild?.(i.uuid)}},p=[s,i],e[1]=s,e[2]=i,e[3]=l,e[4]=p):(l=e[3],p=e[4]),tn(l,p);let x;if(e[5]!==s||e[6]!==o||e[7]!==r||e[8]!==d||e[9]!==n||e[10]!==c){let f;e[12]!==c?(f=(u,m,E)=>{(!E.has("focus")||E.size>1)&&c?.(u,m,E)},e[12]=c,e[13]=f):f=e[13];let h;e[14]!==s||e[15]!==o.features.plugins||e[16]!==d||e[17]!==n?(h=d&&te(J.Fragment,{children:[!n&&s.isEditable()&&te(J.Fragment,{children:[b(Xe,{anchorElem:d}),b(je,{anchorElem:d})]}),o.features.plugins?.map(u=>{if(u.position==="floatingAnchorElem"&&!(u.desktopOnly===!0&&n))return b(K,{anchorElem:d,clientProps:u.clientProps,plugin:u},u.key)}),s.isEditable()&&b(J.Fragment,{children:b(at,{anchorElem:d})})]}),e[14]=s,e[15]=o.features.plugins,e[16]=d,e[17]=n,e[18]=h):h=e[18],x=te(J.Fragment,{children:[o.features.plugins?.map(nn),te("div",{className:"editor-container",ref:r,children:[o.features.plugins?.map(rn),b(Xo,{contentEditable:b("div",{className:"editor-scroller",children:b("div",{className:"editor",ref:a,children:b(ut,{editorConfig:o})})}),ErrorBoundary:qo}),b(nt,{}),b(et,{}),b(Ae,{}),b(ct,{features:o.features}),b(Qo,{ignoreSelectionChange:!0,onChange:f}),h,s.isEditable()&&te(J.Fragment,{children:[b(Jo,{}),o?.features?.markdownTransformers?.length>0&&b(ot,{})]}),o.features.plugins?.map(sn),o.features.plugins?.map(ln)]}),o.features.plugins?.map(an)]}),e[5]=s,e[6]=o,e[7]=r,e[8]=d,e[9]=n,e[10]=c,e[11]=x}else x=e[11];return x};function nn(t){if(t.position==="aboveContainer")return b(K,{clientProps:t.clientProps,plugin:t},t.key)}function rn(t){if(t.position==="top")return b(K,{clientProps:t.clientProps,plugin:t},t.key)}function sn(t){if(t.position==="normal")return b(K,{clientProps:t.clientProps,plugin:t},t.key)}function ln(t){if(t.position==="bottom")return b(K,{clientProps:t.clientProps,plugin:t},t.key)}function an(t){if(t.position==="belowContainer")return b(K,{clientProps:t.clientProps,plugin:t},t.key)}var gt=({children:t,providers:e})=>{if(!e?.length)return t;let o=e[0];return e.length>1?F(o,{children:F(gt,{providers:e.slice(1),children:t})}):F(o,{children:t})},ht=t=>{let{composerKey:e,editorConfig:o,fieldProps:r,isSmallWidthViewport:n,onChange:c,readOnly:i,value:s}=t,d=k(),y=dn(),g=pt.useRef(null),a=un(()=>{if(s&&typeof s!="object")throw new Error("The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: "+JSON.stringify(s));if(s&&Array.isArray(s)&&!("root"in s))throw new Error("You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended");if(s&&"jsonContent"in s)throw new Error("You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical");return{editable:i!==!0,editorState:s!=null?JSON.stringify(s):void 0,namespace:o.lexical.namespace,nodes:Me({editorConfig:o}),onError:l=>{throw l},theme:o.lexical.theme}},[o]);return a?F(cn,{initialConfig:a,children:F(ke,{editorConfig:o,editorContainerRef:g,fieldProps:r,parentContext:d?.editDepth===y?d:void 0,children:F(gt,{providers:o.features.providers,children:F(mt,{editorConfig:o,editorContainerRef:g,isSmallWidthViewport:n,onChange:c})})})},e+a.editable):F("p",{children:"Loading..."})};var pe="rich-text-lexical",Nn=t=>{let{editorConfig:e,field:o,field:{admin:{className:r,description:n,readOnly:c}={},label:i,localized:s,required:d},path:y,readOnly:g,validate:a}=t,l=g||c,p=gn(),x=Et((M,$)=>typeof a=="function"?a(M,{...$,required:d}):!0,[a,d]),{customComponents:{AfterInput:f,BeforeInput:h,Description:u,Error:m,Label:E}={},disabled:w,initialValue:S,path:C,setValue:R,showError:N,value:L}=yn({potentiallyStalePath:y,validate:x}),A=l||w,[v,D]=Ct(!1),[Q,he]=Ct(),ye=xt.useRef(S),W=xt.useRef(L);bt(()=>{let M=()=>{let $=window.matchMedia("(max-width: 768px)").matches;$!==v&&D($)};return M(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}},[v]);let Pe=[pe,"field-type",r,N&&"error",A&&`${pe}--read-only`,e?.admin?.hideGutter!==!0&&!v?`${pe}--show-gutter`:null].filter(Boolean).join(" "),oe=`${C}.${p}`,T=bn(void 0),P=Et(M=>{let $=St=>{let Se=St.toJSON();W.current=Se,R(Se)};typeof window.requestIdleCallback=="function"?(typeof window.cancelIdleCallback=="function"&&T.current&&cancelIdleCallback(T.current),T.current=requestIdleCallback(()=>$(M),{timeout:500})):$(M)},[R]),Nt=En(()=>xn(o),[o]),Pt=hn(M=>{W.current!==L&&JSON.stringify(W.current)!==JSON.stringify(L)&&(ye.current=M,W.current=L,he(new Date))});return bt(()=>{Object.is(S,ye.current)||Pt(S)},[S]),ge("div",{className:Pe,style:Nt,children:[O(yt,{CustomComponent:m,Fallback:O(mn,{path:C,showError:N})}),E||O(pn,{label:i,localized:s,path:C,required:d}),ge("div",{className:`${pe}__wrap`,children:[ge(Cn,{fallbackRender:Pn,onReset:()=>{},children:[h,O(ht,{composerKey:oe,editorConfig:e,fieldProps:t,isSmallWidthViewport:v,onChange:P,readOnly:A,value:L},JSON.stringify({path:C,rerenderProviderKey:Q})),f]}),u,O(yt,{CustomComponent:u,Fallback:O(fn,{description:n,path:C})})]})]},oe)};function Pn({error:t}){return ge("div",{className:"errorBoundary",role:"alert",children:[O("p",{children:"Something went wrong:"}),O("pre",{style:{color:"red"},children:t.message})]})}var Xi=Nn;export{Xi as RichText};
2
- //# sourceMappingURL=Field-DGC4DDYL.js.map