@payloadcms/richtext-lexical 3.0.0-beta.72 → 3.0.0-beta.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/Field-5GGTGCKC.js +2 -0
- package/dist/exports/client/Field-5GGTGCKC.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/index.js +7 -7
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blocks/validate.d.ts.map +1 -1
- package/dist/features/blocks/validate.js +2 -1
- package/dist/features/blocks/validate.js.map +1 -1
- package/dist/features/experimental_table/feature.client.d.ts.map +1 -1
- package/dist/features/experimental_table/feature.client.js +5 -0
- package/dist/features/experimental_table/feature.client.js.map +1 -1
- package/dist/features/experimental_table/feature.server.d.ts.map +1 -1
- package/dist/features/experimental_table/feature.server.js +70 -6
- package/dist/features/experimental_table/feature.server.js.map +1 -1
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.js +2 -0
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.d.ts +0 -1
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.js +13 -8
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.d.ts +12 -0
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.js +181 -0
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.js.map +1 -0
- package/dist/features/experimental_table/utils/debounce.d.ts +61 -0
- package/dist/features/experimental_table/utils/debounce.d.ts.map +1 -0
- package/dist/features/experimental_table/utils/debounce.js +202 -0
- package/dist/features/experimental_table/utils/debounce.js.map +1 -0
- package/dist/features/experimental_table/utils/useDebounce.d.ts +6 -0
- package/dist/features/experimental_table/utils/useDebounce.d.ts.map +1 -0
- package/dist/features/experimental_table/utils/useDebounce.js +18 -0
- package/dist/features/experimental_table/utils/useDebounce.js.map +1 -0
- package/dist/features/link/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/features/link/plugins/autoLink/index.js +19 -6
- package/dist/features/link/plugins/autoLink/index.js.map +1 -1
- package/dist/features/link/validate.d.ts.map +1 -1
- package/dist/features/link/validate.js +2 -1
- package/dist/features/link/validate.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.js +1 -0
- package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
- package/dist/features/typesServer.d.ts +2 -1
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/validate.d.ts.map +1 -1
- package/dist/features/upload/validate.js +1 -0
- package/dist/features/upload/validate.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +8 -7
- package/dist/field/Field.js.map +1 -1
- package/dist/field/index.js +8 -8
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +0 -6
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +8 -1
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical/ui/icons/Table/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Table/index.js +1 -0
- package/dist/lexical/ui/icons/Table/index.js.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.js +1 -1
- package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
- package/dist/populateGraphQL/defaultValue.d.ts.map +1 -1
- package/dist/populateGraphQL/defaultValue.js +1 -0
- package/dist/populateGraphQL/defaultValue.js.map +1 -1
- package/dist/utilities/generateComponentMap.d.ts.map +1 -1
- package/dist/utilities/generateComponentMap.js +3 -1
- package/dist/utilities/generateComponentMap.js.map +1 -1
- package/package.json +31 -31
- package/dist/exports/client/Field-YNHIDK3D.js +0 -2
- package/dist/exports/client/Field-YNHIDK3D.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalEditor.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAGhE,OAAO,sBAAsB,CAAA;AAQ7B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC;IACE,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;CACpD,GAAG,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,CAAC,CA0K5D,CAAA"}
|
|
@@ -6,7 +6,6 @@ import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js';
|
|
|
6
6
|
import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js';
|
|
7
7
|
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js';
|
|
8
8
|
import { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin.js';
|
|
9
|
-
import { useTranslation } from '@payloadcms/ui';
|
|
10
9
|
import { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical';
|
|
11
10
|
import * as React from 'react';
|
|
12
11
|
import { useEffect, useState } from 'react';
|
|
@@ -21,7 +20,6 @@ export const LexicalEditor = (props)=>{
|
|
|
21
20
|
const { editorConfig, editorContainerRef, onChange } = props;
|
|
22
21
|
const editorConfigContext = useEditorConfigContext();
|
|
23
22
|
const [editor] = useLexicalComposerContext();
|
|
24
|
-
const { t } = useTranslation();
|
|
25
23
|
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
26
24
|
const onRef = (_floatingAnchorElem)=>{
|
|
27
25
|
if (_floatingAnchorElem !== null) {
|
|
@@ -106,10 +104,6 @@ export const LexicalEditor = (props)=>{
|
|
|
106
104
|
ref: onRef,
|
|
107
105
|
children: /*#__PURE__*/ _jsx(LexicalContentEditable, {})
|
|
108
106
|
})
|
|
109
|
-
}),
|
|
110
|
-
placeholder: /*#__PURE__*/ _jsx("p", {
|
|
111
|
-
className: "editor-placeholder",
|
|
112
|
-
children: t('lexical:general:placeholder')
|
|
113
107
|
})
|
|
114
108
|
}),
|
|
115
109
|
/*#__PURE__*/ _jsx(OnChangePlugin, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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 { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin.js'\nimport { useTranslation } from '@payloadcms/ui'\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 { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement>\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const { t } = useTranslation<{}, string>()\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 const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\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 ErrorBoundary={LexicalErrorBoundary}\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable />\n </div>\n </div>\n }\n placeholder={<p className=\"editor-placeholder\">{t('lexical:general:placeholder')}</p>}\n />\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) onChange(editorState, editor, tags)\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\n <TabIndentationPlugin />\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"],"names":["useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","TabIndentationPlugin","useTranslation","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","EditorPlugin","useEditorConfigContext","MarkdownShortcutPlugin","SlashMenuPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","LexicalContentEditable","LexicalEditor","props","editorConfig","editorContainerRef","onChange","editorConfigContext","editor","t","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","isSmallWidthViewport","setIsSmallWidthViewport","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","Fragment","features","plugins","map","plugin","position","clientProps","key","div","className","ref","ErrorBoundary","contentEditable","placeholder","p","ignoreSelectionChange","editorState","tags","has","size","isEditable","anchorElem","desktopOnly","markdownTransformers","length"],"mappings":"AAAA;;AACA,SAASA,yBAA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AAOG,GAAG;wBAElE;oBACF;oBACCvC,aAAaiC,QAAQ,CAACC,OAAO,CAACC,GAAG,CAAC,CAACC;wBAClC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,KAAC9C;gCAAa+C,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;wBAElE;oBACF;;;YAEDvC,aAAaiC,QAAQ,CAACC,OAAO,CAACC,GAAG,CAAC,CAACC;gBAClC,IAAIA,OAAOC,QAAQ,KAAK,kBAAkB;oBACxC,qBAAO,KAAC9C;wBAAa+C,aAAaF,OAAOE,WAAW;wBAAmBF,QAAQA;uBAApBA,OAAOG,GAAG;gBACvE;YACF;;;AAGN,EAAC"}
|
|
1
|
+
{"version":3,"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 { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin.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 { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement>\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, 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 const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\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 ErrorBoundary={LexicalErrorBoundary}\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable />\n </div>\n </div>\n }\n />\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) onChange(editorState, editor, tags)\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\n <TabIndentationPlugin />\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"],"names":["useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","TabIndentationPlugin","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","EditorPlugin","useEditorConfigContext","MarkdownShortcutPlugin","SlashMenuPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","LexicalContentEditable","LexicalEditor","props","editorConfig","editorContainerRef","onChange","editorConfigContext","editor","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","isSmallWidthViewport","setIsSmallWidthViewport","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","Fragment","features","plugins","map","plugin","position","clientProps","key","div","className","ref","ErrorBoundary","contentEditable","ignoreSelectionChange","editorState","tags","has","size","isEditable","anchorElem","desktopOnly","markdownTransformers","length"],"mappings":"AAAA;;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,QAAQ,yCAAwC;AAC7E,SAASC,aAAa,QAAQ,yCAAwC;AACtE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,oBAAoB,QAAQ,gDAA+C;AACpF,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAA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aF,OAAOE,WAAW;wBAAmBF,QAAQA;uBAApBA,OAAOG,GAAG;gBACvE;YACF;;;AAGN,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentEditable.d.ts","sourceRoot":"","sources":["../../../src/lexical/ui/ContentEditable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ContentEditable.d.ts","sourceRoot":"","sources":["../../../src/lexical/ui/ContentEditable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAMhC,OAAO,wBAAwB,CAAA;AAE/B,wBAAgB,sBAAsB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,CAUzF"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ContentEditable } from '@lexical/react/LexicalContentEditable.js';
|
|
3
|
+
import { useTranslation } from '@payloadcms/ui';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
export function LexicalContentEditable({ className }) {
|
|
6
|
+
const { t } = useTranslation();
|
|
5
7
|
return /*#__PURE__*/ _jsx(ContentEditable, {
|
|
6
|
-
|
|
8
|
+
"aria-placeholder": t('lexical:general:placeholder'),
|
|
9
|
+
className: className ?? 'ContentEditable__root',
|
|
10
|
+
placeholder: /*#__PURE__*/ _jsx("p", {
|
|
11
|
+
className: "editor-placeholder",
|
|
12
|
+
children: t('lexical:general:placeholder')
|
|
13
|
+
})
|
|
7
14
|
});
|
|
8
15
|
}
|
|
9
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lexical/ui/ContentEditable.tsx"],"sourcesContent":["import type { JSX } from 'react'\n\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport * as React from 'react'\n\nimport './ContentEditable.scss'\n\nexport function LexicalContentEditable({ className }: { className?: string }): JSX.Element {\n return <ContentEditable
|
|
1
|
+
{"version":3,"sources":["../../../src/lexical/ui/ContentEditable.tsx"],"sourcesContent":["import type { JSX } from 'react'\n\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport { useTranslation } from '@payloadcms/ui'\nimport * as React from 'react'\n\nimport './ContentEditable.scss'\n\nexport function LexicalContentEditable({ className }: { className?: string }): JSX.Element {\n const { t } = useTranslation<{}, string>()\n\n return (\n <ContentEditable\n aria-placeholder={t('lexical:general:placeholder')}\n className={className ?? 'ContentEditable__root'}\n placeholder={<p className=\"editor-placeholder\">{t('lexical:general:placeholder')}</p>}\n />\n )\n}\n"],"names":["ContentEditable","useTranslation","React","LexicalContentEditable","className","t","aria-placeholder","placeholder","p"],"mappings":";AAEA,SAASA,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,YAAYC,WAAW,QAAO;AAI9B,OAAO,SAASC,uBAAuB,EAAEC,SAAS,EAA0B;IAC1E,MAAM,EAAEC,CAAC,EAAE,GAAGJ;IAEd,qBACE,KAACD;QACCM,oBAAkBD,EAAE;QACpBD,WAAWA,aAAa;QACxBG,2BAAa,KAACC;YAAEJ,WAAU;sBAAsBC,EAAE;;;AAGxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/Table/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/ui/icons/Table/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAkB7B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lexical/ui/icons/Table/index.tsx"],"sourcesContent":["import React from 'react'\n\nexport const TableIcon: React.FC = () => {\n return (\n <svg
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lexical/ui/icons/Table/index.tsx"],"sourcesContent":["import React from 'react'\n\nexport const TableIcon: React.FC = () => {\n return (\n <svg\n className=\"icon\"\n fill=\"none\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n width=\"20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clipRule=\"evenodd\"\n d=\"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n />\n </svg>\n )\n}\n"],"names":["React","TableIcon","svg","className","fill","height","viewBox","width","xmlns","path","clipRule","d","fillRule"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAEzB,OAAO,MAAMC,YAAsB;IACjC,qBACE,KAACC;QACCC,WAAU;QACVC,MAAK;QACLC,QAAO;QACPC,SAAQ;QACRC,OAAM;QACNC,OAAM;kBAEN,cAAA,KAACC;YACCC,UAAS;YACTC,GAAE;YACFP,MAAK;YACLQ,UAAS;;;AAIjB,EAAC"}
|
|
@@ -18,7 +18,7 @@ export const UploadIcon = ()=>/*#__PURE__*/ _jsxs("svg", {
|
|
|
18
18
|
}),
|
|
19
19
|
/*#__PURE__*/ _jsx("path", {
|
|
20
20
|
d: "M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",
|
|
21
|
-
stroke: "
|
|
21
|
+
stroke: "currentColor",
|
|
22
22
|
strokeLinecap: "round",
|
|
23
23
|
strokeLinejoin: "round"
|
|
24
24
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lexical/ui/icons/Upload/index.tsx"],"sourcesContent":["import React from 'react'\n\nexport const UploadIcon: React.FC = () => (\n <svg\n aria-hidden=\"true\"\n className=\"icon\"\n fill=\"none\"\n focusable=\"false\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n width=\"20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z\"\n stroke=\"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lexical/ui/icons/Upload/index.tsx"],"sourcesContent":["import React from 'react'\n\nexport const UploadIcon: React.FC = () => (\n <svg\n aria-hidden=\"true\"\n className=\"icon\"\n fill=\"none\"\n focusable=\"false\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n width=\"20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n)\n"],"names":["React","UploadIcon","svg","aria-hidden","className","fill","focusable","height","viewBox","width","xmlns","path","d","stroke","strokeLinecap","strokeLinejoin"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAEzB,OAAO,MAAMC,aAAuB,kBAClC,MAACC;QACCC,eAAY;QACZC,WAAU;QACVC,MAAK;QACLC,WAAU;QACVC,QAAO;QACPC,SAAQ;QACRC,OAAM;QACNC,OAAM;;0BAEN,KAACC;gBACCC,GAAE;gBACFC,QAAO;gBACPC,eAAc;gBACdC,gBAAe;;0BAEjB,KAACJ;gBACCC,GAAE;gBACFC,QAAO;gBACPC,eAAc;gBACdC,gBAAe;;0BAEjB,KAACJ;gBACCC,GAAE;gBACFC,QAAO;gBACPC,eAAc;gBACdC,gBAAe;;;OAGpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultValue.d.ts","sourceRoot":"","sources":["../../src/populateGraphQL/defaultValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAA+C,MAAM,SAAS,CAAA;AAEjG,eAAO,MAAM,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"defaultValue.d.ts","sourceRoot":"","sources":["../../src/populateGraphQL/defaultValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAA+C,MAAM,SAAS,CAAA;AAEjG,eAAO,MAAM,oBAAoB,EAAE,qBA8BlC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/populateGraphQL/defaultValue.ts"],"sourcesContent":["import type { SerializedEditorState, SerializedParagraphNode, SerializedTextNode } from 'lexical'\n\nexport const defaultRichTextValue: SerializedEditorState = {\n root: {\n type: 'root',\n children: [\n {\n type: 'paragraph',\n children: [\n {\n type: 'text',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text: '',\n version: 1,\n } as SerializedTextNode,\n ],\n direction: null,\n format: '',\n indent: 0,\n textFormat: 0,\n version: 1,\n } as SerializedParagraphNode,\n ],\n direction: null,\n format: '',\n indent: 0,\n version: 1,\n },\n}\n"],"names":["defaultRichTextValue","root","type","children","detail","format","mode","style","text","version","direction","indent","textFormat"],"mappings":"AAEA,OAAO,MAAMA,uBAA8C;IACzDC,MAAM;QACJC,MAAM;QACNC,UAAU;YACR;gBACED,MAAM;gBACNC,UAAU;oBACR;wBACED,MAAM;wBACNE,QAAQ;wBACRC,QAAQ;wBACRC,MAAM;wBACNC,OAAO;wBACPC,MAAM;wBACNC,SAAS;oBACX;iBACD;gBACDC,WAAW;gBACXL,QAAQ;gBACRM,QAAQ;gBACRC,YAAY;
|
|
1
|
+
{"version":3,"sources":["../../src/populateGraphQL/defaultValue.ts"],"sourcesContent":["import type { SerializedEditorState, SerializedParagraphNode, SerializedTextNode } from 'lexical'\n\nexport const defaultRichTextValue: SerializedEditorState = {\n root: {\n type: 'root',\n children: [\n {\n type: 'paragraph',\n children: [\n {\n type: 'text',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text: '',\n version: 1,\n } as SerializedTextNode,\n ],\n direction: null,\n format: '',\n indent: 0,\n textFormat: 0,\n textStyle: '',\n version: 1,\n } as SerializedParagraphNode,\n ],\n direction: null,\n format: '',\n indent: 0,\n version: 1,\n },\n}\n"],"names":["defaultRichTextValue","root","type","children","detail","format","mode","style","text","version","direction","indent","textFormat","textStyle"],"mappings":"AAEA,OAAO,MAAMA,uBAA8C;IACzDC,MAAM;QACJC,MAAM;QACNC,UAAU;YACR;gBACED,MAAM;gBACNC,UAAU;oBACR;wBACED,MAAM;wBACNE,QAAQ;wBACRC,QAAQ;wBACRC,MAAM;wBACNC,OAAO;wBACPC,MAAM;wBACNC,SAAS;oBACX;iBACD;gBACDC,WAAW;gBACXL,QAAQ;gBACRM,QAAQ;gBACRC,YAAY;gBACZC,WAAW;gBACXJ,SAAS;YACX;SACD;QACDC,WAAW;QACXL,QAAQ;QACRM,QAAQ;QACRF,SAAS;IACX;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateComponentMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateComponentMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAG1E,eAAO,MAAM,uBAAuB,SAC3B;IACL,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"generateComponentMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateComponentMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAG1E,eAAO,MAAM,uBAAuB,SAC3B;IACL,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,sBAAsB,CAgHzC,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createElement as _createElement } from "react";
|
|
3
3
|
import { mapFields } from '@payloadcms/ui/utilities/buildComponentMap';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
export const getGenerateComponentMap = (args)=>({ WithServerSideProps, config, i18n, schemaPath })=>{
|
|
5
|
+
export const getGenerateComponentMap = (args)=>({ WithServerSideProps, config, i18n, payload, schemaPath })=>{
|
|
6
6
|
const componentMap = new Map();
|
|
7
7
|
// turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:
|
|
8
8
|
const resolvedFeatureMapArray = Array.from(args.resolvedFeatureMap.entries()).sort((a, b)=>a[1].order - b[1].order);
|
|
@@ -15,6 +15,7 @@ export const getGenerateComponentMap = (args)=>({ WithServerSideProps, config, i
|
|
|
15
15
|
const components = resolvedFeature.generateComponentMap({
|
|
16
16
|
config,
|
|
17
17
|
i18n,
|
|
18
|
+
payload,
|
|
18
19
|
props: resolvedFeature.sanitizedServerFeatureProps,
|
|
19
20
|
schemaPath
|
|
20
21
|
});
|
|
@@ -48,6 +49,7 @@ export const getGenerateComponentMap = (args)=>({ WithServerSideProps, config, i
|
|
|
48
49
|
fieldSchema: fields,
|
|
49
50
|
i18n,
|
|
50
51
|
parentPath: `${schemaPath}.lexical_internal_feature.${featureKey}.fields.${schemaKey}`,
|
|
52
|
+
payload,
|
|
51
53
|
readOnly: false
|
|
52
54
|
});
|
|
53
55
|
componentMap.set(`lexical_internal_feature.${featureKey}.fields.${schemaKey}`, mappedFields);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/generateComponentMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { mapFields } from '@payloadcms/ui/utilities/buildComponentMap'\nimport React from 'react'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { GeneratedFeatureProviderComponent } from '../types.js'\n\nexport const getGenerateComponentMap =\n (args: {\n resolvedFeatureMap: ResolvedServerFeatureMap\n }): RichTextAdapter['generateComponentMap'] =>\n ({ WithServerSideProps, config, i18n, schemaPath }) => {\n const componentMap = new Map()\n\n // turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:\n const resolvedFeatureMapArray = Array.from(args.resolvedFeatureMap.entries()).sort(\n (a, b) => a[1].order - b[1].order,\n )\n\n componentMap.set(\n `features`,\n resolvedFeatureMapArray\n .map(([featureKey, resolvedFeature]) => {\n const ClientComponent = resolvedFeature.ClientFeature\n const clientComponentProps = resolvedFeature.clientFeatureProps\n\n /**\n * Handle Feature Component Maps\n */\n if (\n 'generateComponentMap' in resolvedFeature &&\n typeof resolvedFeature.generateComponentMap === 'function'\n ) {\n const components = resolvedFeature.generateComponentMap({\n config,\n i18n,\n props: resolvedFeature.sanitizedServerFeatureProps,\n schemaPath,\n })\n\n for (const componentKey in components) {\n const Component = components[componentKey]\n\n if (Component) {\n componentMap.set(\n `lexical_internal_feature.${featureKey}.lexical_internal_components.${componentKey}`,\n <WithServerSideProps\n Component={Component}\n componentKey={componentKey}\n featureKey={resolvedFeature.key}\n key={`${resolvedFeature.key}-${componentKey}`}\n />,\n )\n }\n }\n }\n\n /**\n * Handle Feature Schema Maps (rendered fields)\n */\n if (\n 'generateSchemaMap' in resolvedFeature &&\n typeof resolvedFeature.generateSchemaMap === 'function'\n ) {\n const schemas = resolvedFeature.generateSchemaMap({\n config,\n i18n,\n props: resolvedFeature.sanitizedServerFeatureProps,\n schemaMap: new Map(),\n schemaPath,\n })\n\n if (schemas) {\n for (const [schemaKey, fields] of schemas.entries()) {\n const mappedFields = mapFields({\n WithServerSideProps,\n config,\n disableAddingID: true,\n fieldSchema: fields,\n i18n,\n parentPath: `${schemaPath}.lexical_internal_feature.${featureKey}.fields.${schemaKey}`,\n readOnly: false,\n })\n\n componentMap.set(\n `lexical_internal_feature.${featureKey}.fields.${schemaKey}`,\n mappedFields,\n )\n }\n }\n }\n\n if (!ClientComponent) {\n return null\n }\n\n return {\n ClientFeature:\n clientComponentProps && typeof clientComponentProps === 'object' ? (\n <ClientComponent\n {...clientComponentProps}\n featureKey={resolvedFeature.key}\n key={resolvedFeature.key}\n order={resolvedFeature.order}\n />\n ) : (\n <ClientComponent\n featureKey={resolvedFeature.key}\n key={resolvedFeature.key}\n order={resolvedFeature.order}\n />\n ),\n key: resolvedFeature.key,\n order: resolvedFeature.order,\n } as GeneratedFeatureProviderComponent\n })\n .filter((feature) => feature !== null),\n )\n\n return componentMap\n }\n"],"names":["mapFields","React","getGenerateComponentMap","args","WithServerSideProps","config","i18n","schemaPath","componentMap","Map","resolvedFeatureMapArray","Array","from","resolvedFeatureMap","entries","sort","a","b","order","set","map","featureKey","resolvedFeature","ClientComponent","ClientFeature","clientComponentProps","clientFeatureProps","generateComponentMap","components","props","sanitizedServerFeatureProps","componentKey","Component","key","generateSchemaMap","schemas","schemaMap","schemaKey","fields","mappedFields","disableAddingID","fieldSchema","parentPath","readOnly","filter","feature"],"mappings":";;AAEA,SAASA,SAAS,QAAQ,6CAA4C;AACtE,OAAOC,WAAW,QAAO;AAKzB,OAAO,MAAMC,0BACX,CAACC,OAGD,CAAC,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,IAAI,EAAEC,UAAU,EAAE;
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/generateComponentMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { mapFields } from '@payloadcms/ui/utilities/buildComponentMap'\nimport React from 'react'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { GeneratedFeatureProviderComponent } from '../types.js'\n\nexport const getGenerateComponentMap =\n (args: {\n resolvedFeatureMap: ResolvedServerFeatureMap\n }): RichTextAdapter['generateComponentMap'] =>\n ({ WithServerSideProps, config, i18n, payload, schemaPath }) => {\n const componentMap = new Map()\n\n // turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:\n const resolvedFeatureMapArray = Array.from(args.resolvedFeatureMap.entries()).sort(\n (a, b) => a[1].order - b[1].order,\n )\n\n componentMap.set(\n `features`,\n resolvedFeatureMapArray\n .map(([featureKey, resolvedFeature]) => {\n const ClientComponent = resolvedFeature.ClientFeature\n const clientComponentProps = resolvedFeature.clientFeatureProps\n\n /**\n * Handle Feature Component Maps\n */\n if (\n 'generateComponentMap' in resolvedFeature &&\n typeof resolvedFeature.generateComponentMap === 'function'\n ) {\n const components = resolvedFeature.generateComponentMap({\n config,\n i18n,\n payload,\n props: resolvedFeature.sanitizedServerFeatureProps,\n schemaPath,\n })\n\n for (const componentKey in components) {\n const Component = components[componentKey]\n\n if (Component) {\n componentMap.set(\n `lexical_internal_feature.${featureKey}.lexical_internal_components.${componentKey}`,\n <WithServerSideProps\n Component={Component}\n componentKey={componentKey}\n featureKey={resolvedFeature.key}\n key={`${resolvedFeature.key}-${componentKey}`}\n />,\n )\n }\n }\n }\n\n /**\n * Handle Feature Schema Maps (rendered fields)\n */\n if (\n 'generateSchemaMap' in resolvedFeature &&\n typeof resolvedFeature.generateSchemaMap === 'function'\n ) {\n const schemas = resolvedFeature.generateSchemaMap({\n config,\n i18n,\n props: resolvedFeature.sanitizedServerFeatureProps,\n schemaMap: new Map(),\n schemaPath,\n })\n\n if (schemas) {\n for (const [schemaKey, fields] of schemas.entries()) {\n const mappedFields = mapFields({\n WithServerSideProps,\n config,\n disableAddingID: true,\n fieldSchema: fields,\n i18n,\n parentPath: `${schemaPath}.lexical_internal_feature.${featureKey}.fields.${schemaKey}`,\n payload,\n readOnly: false,\n })\n\n componentMap.set(\n `lexical_internal_feature.${featureKey}.fields.${schemaKey}`,\n mappedFields,\n )\n }\n }\n }\n\n if (!ClientComponent) {\n return null\n }\n\n return {\n ClientFeature:\n clientComponentProps && typeof clientComponentProps === 'object' ? (\n <ClientComponent\n {...clientComponentProps}\n featureKey={resolvedFeature.key}\n key={resolvedFeature.key}\n order={resolvedFeature.order}\n />\n ) : (\n <ClientComponent\n featureKey={resolvedFeature.key}\n key={resolvedFeature.key}\n order={resolvedFeature.order}\n />\n ),\n key: resolvedFeature.key,\n order: resolvedFeature.order,\n } as GeneratedFeatureProviderComponent\n })\n .filter((feature) => feature !== null),\n )\n\n return componentMap\n }\n"],"names":["mapFields","React","getGenerateComponentMap","args","WithServerSideProps","config","i18n","payload","schemaPath","componentMap","Map","resolvedFeatureMapArray","Array","from","resolvedFeatureMap","entries","sort","a","b","order","set","map","featureKey","resolvedFeature","ClientComponent","ClientFeature","clientComponentProps","clientFeatureProps","generateComponentMap","components","props","sanitizedServerFeatureProps","componentKey","Component","key","generateSchemaMap","schemas","schemaMap","schemaKey","fields","mappedFields","disableAddingID","fieldSchema","parentPath","readOnly","filter","feature"],"mappings":";;AAEA,SAASA,SAAS,QAAQ,6CAA4C;AACtE,OAAOC,WAAW,QAAO;AAKzB,OAAO,MAAMC,0BACX,CAACC,OAGD,CAAC,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,UAAU,EAAE;QACzD,MAAMC,eAAe,IAAIC;QAEzB,gHAAgH;QAChH,MAAMC,0BAA0BC,MAAMC,IAAI,CAACV,KAAKW,kBAAkB,CAACC,OAAO,IAAIC,IAAI,CAChF,CAACC,GAAGC,IAAMD,CAAC,CAAC,EAAE,CAACE,KAAK,GAAGD,CAAC,CAAC,EAAE,CAACC,KAAK;QAGnCV,aAAaW,GAAG,CACd,CAAC,QAAQ,CAAC,EACVT,wBACGU,GAAG,CAAC,CAAC,CAACC,YAAYC,gBAAgB;YACjC,MAAMC,kBAAkBD,gBAAgBE,aAAa;YACrD,MAAMC,uBAAuBH,gBAAgBI,kBAAkB;YAE/D;;WAEC,GACD,IACE,0BAA0BJ,mBAC1B,OAAOA,gBAAgBK,oBAAoB,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,gBAAgBW,GAAG;oBAC/BA,KAAKX,gBAAgBW,GAAG;oBACxBf,OAAOI,gBAAgBJ,KAAK;mCAG9B,KAACK;oBACCF,YAAYC,gBAAgBW,GAAG;oBAE/Bf,OAAOI,gBAAgBJ,KAAK;mBADvBI,gBAAgBW,GAAG;gBAI9BA,KAAKX,gBAAgBW,GAAG;gBACxBf,OAAOI,gBAAgBJ,KAAK;YAC9B;QACF,GACC0B,MAAM,CAAC,CAACC,UAAYA,YAAY;QAGrC,OAAOrC;IACT,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.74",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -30,24 +30,24 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lexical/headless": "0.
|
|
34
|
-
"@lexical/link": "0.
|
|
35
|
-
"@lexical/list": "0.
|
|
36
|
-
"@lexical/mark": "0.
|
|
37
|
-
"@lexical/markdown": "0.
|
|
38
|
-
"@lexical/react": "0.
|
|
39
|
-
"@lexical/rich-text": "0.
|
|
40
|
-
"@lexical/selection": "0.
|
|
41
|
-
"@lexical/utils": "0.
|
|
33
|
+
"@lexical/headless": "0.17.0",
|
|
34
|
+
"@lexical/link": "0.17.0",
|
|
35
|
+
"@lexical/list": "0.17.0",
|
|
36
|
+
"@lexical/mark": "0.17.0",
|
|
37
|
+
"@lexical/markdown": "0.17.0",
|
|
38
|
+
"@lexical/react": "0.17.0",
|
|
39
|
+
"@lexical/rich-text": "0.17.0",
|
|
40
|
+
"@lexical/selection": "0.17.0",
|
|
41
|
+
"@lexical/utils": "0.17.0",
|
|
42
42
|
"@types/uuid": "10.0.0",
|
|
43
43
|
"bson-objectid": "2.0.4",
|
|
44
44
|
"dequal": "2.0.3",
|
|
45
|
-
"lexical": "0.
|
|
45
|
+
"lexical": "0.17.0",
|
|
46
46
|
"react-error-boundary": "4.0.13",
|
|
47
47
|
"uuid": "10.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@lexical/eslint-plugin": "
|
|
50
|
+
"@lexical/eslint-plugin": "0.17.0",
|
|
51
51
|
"@types/json-schema": "7.0.15",
|
|
52
52
|
"@types/node": "20.12.5",
|
|
53
53
|
"@types/react": "npm:types-react@19.0.0-rc.0",
|
|
@@ -56,31 +56,31 @@
|
|
|
56
56
|
"esbuild-sass-plugin": "3.3.1",
|
|
57
57
|
"swc-plugin-transform-remove-imports": "1.14.0",
|
|
58
58
|
"@payloadcms/eslint-config": "3.0.0-beta.59",
|
|
59
|
-
"@payloadcms/next": "3.0.0-beta.
|
|
60
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
61
|
-
"@payloadcms/ui": "3.0.0-beta.
|
|
62
|
-
"payload": "3.0.0-beta.
|
|
59
|
+
"@payloadcms/next": "3.0.0-beta.74",
|
|
60
|
+
"@payloadcms/translations": "3.0.0-beta.74",
|
|
61
|
+
"@payloadcms/ui": "3.0.0-beta.74",
|
|
62
|
+
"payload": "3.0.0-beta.74"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@faceless-ui/modal": "3.0.0-beta.2",
|
|
66
66
|
"@faceless-ui/scroll-info": "2.0.0-beta.0",
|
|
67
|
-
"@lexical/headless": "0.
|
|
68
|
-
"@lexical/link": "0.
|
|
69
|
-
"@lexical/list": "0.
|
|
70
|
-
"@lexical/mark": "0.
|
|
71
|
-
"@lexical/markdown": "0.
|
|
72
|
-
"@lexical/react": "0.
|
|
73
|
-
"@lexical/rich-text": "0.
|
|
74
|
-
"@lexical/selection": "0.
|
|
75
|
-
"@lexical/table": "0.
|
|
76
|
-
"@lexical/utils": "0.
|
|
77
|
-
"lexical": "0.
|
|
67
|
+
"@lexical/headless": "0.17.0",
|
|
68
|
+
"@lexical/link": "0.17.0",
|
|
69
|
+
"@lexical/list": "0.17.0",
|
|
70
|
+
"@lexical/mark": "0.17.0",
|
|
71
|
+
"@lexical/markdown": "0.17.0",
|
|
72
|
+
"@lexical/react": "0.17.0",
|
|
73
|
+
"@lexical/rich-text": "0.17.0",
|
|
74
|
+
"@lexical/selection": "0.17.0",
|
|
75
|
+
"@lexical/table": "0.17.0",
|
|
76
|
+
"@lexical/utils": "0.17.0",
|
|
77
|
+
"lexical": "0.17.0",
|
|
78
78
|
"react": "^19.0.0 || ^19.0.0-rc-6230622a1a-20240610",
|
|
79
79
|
"react-dom": "^19.0.0 || ^19.0.0-rc-6230622a1a-20240610",
|
|
80
|
-
"@payloadcms/next": "3.0.0-beta.
|
|
81
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
82
|
-
"
|
|
83
|
-
"
|
|
80
|
+
"@payloadcms/next": "3.0.0-beta.74",
|
|
81
|
+
"@payloadcms/translations": "3.0.0-beta.74",
|
|
82
|
+
"@payloadcms/ui": "3.0.0-beta.74",
|
|
83
|
+
"payload": "3.0.0-beta.74"
|
|
84
84
|
},
|
|
85
85
|
"engines": {
|
|
86
86
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";import{a as ce,b as ue,c as de,d as fe,e as K,f as I,h as pe}from"./chunk-EBB2CEB6.js";import{a as me,b as N}from"./chunk-IWZVO3AI.js";import{FieldDescription as At,FieldError as Ot,FieldLabel as _t,useField as zt,useFieldProps as $t,withCondition as Gt}from"@payloadcms/ui";import{useCallback as Kt}from"react";import{ErrorBoundary as Wt}from"react-error-boundary";import{LexicalComposer as Ht}from"@lexical/react/LexicalComposer.js";import*as We from"react";import{useMemo as Ke}from"react";import{useLexicalComposerContext as Pt}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as Nt}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as St}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as kt}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as wt}from"@lexical/react/LexicalRichTextPlugin.js";import{TabIndentationPlugin as It}from"@lexical/react/LexicalTabIndentationPlugin.js";import{useTranslation as Dt}from"@payloadcms/ui";import{BLUR_COMMAND as Bt,COMMAND_PRIORITY_LOW as _e,FOCUS_COMMAND as Ft}from"lexical";import*as q from"react";import{useEffect as ze,useState as $e}from"react";import{jsx as ge}from"react/jsx-runtime";var O=({anchorElem:t,clientProps:e,plugin:i})=>i.position==="floatingAnchorElem"?i.Component&&ge(i.Component,{anchorElem:t,clientProps:e}):i.Component&&ge(i.Component,{clientProps:e});import{MarkdownShortcutPlugin as Je}from"@lexical/react/LexicalMarkdownShortcutPlugin.js";import{jsx as je}from"react/jsx-runtime";var ye=()=>{let{editorConfig:t}=N();return je(Je,{transformers:t.features.markdownTransformers})};import{useLexicalComposerContext as Qe}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as be}from"@payloadcms/ui";import{useCallback as Ee,useMemo as Ze,useState as et}from"react";import*as xe from"react-dom";import{useCallback as Xe}from"react";function he(t,{maxLength:e=75,minLength:i=1}){return Xe(({query:l})=>{let r="[^"+t+ue+"\\s]",d=new RegExp("(^|\\s|\\()(["+t+"]((?:"+r+"){0,"+e+"}))$").exec(l);if(d!==null){let c=d[1],m=d[3];if(m.length>=i)return{leadOffset:d.index+c.length,matchingString:m,replaceableString:d[2]}}return null},[e,i,t])}import{jsx as W,jsxs as Te}from"react/jsx-runtime";var k="slash-menu-popup";function tt({isSelected:t,item:e,onClick:i,onMouseEnter:l}){let{i18n:r}=be(),u=`${k}__item ${k}__item-${e.key}`;t&&(u+=` ${k}__item--selected`);let d=e.key;return e.label&&(d=typeof e.label=="function"?e.label({i18n:r}):e.label),d.length>25&&(d=d.substring(0,25)+"..."),Te("button",{"aria-selected":t,className:u,id:k+"__item-"+e.key,onClick:i,onMouseEnter:l,ref:c=>{e.ref={current:c}},role:"option",tabIndex:-1,type:"button",children:[e?.Icon&&W(e.Icon,{}),W("span",{className:`${k}__item-text`,children:d})]},e.key)}function Ce({anchorElem:t=document.body}){let[e]=Qe(),[i,l]=et(null),{editorConfig:r}=N(),{i18n:u}=be(),d=he("/",{minLength:0}),c=Ee(()=>{let a=[];for(let s of r.features.slashMenu.dynamicGroups){let o=s({editor:e,queryString:i});a=a.concat(o)}return a},[e,i,r?.features]),m=Ze(()=>{let a=[];for(let s of r?.features.slashMenu.groups??[])a.push(s);if(i){a=a.map(o=>{let n=o.items.filter(f=>{let E=f.key;return f.label&&(E=typeof f.label=="function"?f.label({i18n:u}):f.label),new RegExp(i,"gi").exec(E)?!0:f.keywords!=null?f.keywords.some(h=>new RegExp(i,"gi").exec(h)):!1});return n.length?{...o,items:n}:null}),a=a.filter(o=>o!=null);let s=c();for(let o of s){let n=a.find(f=>f.key===o.key);n?a=a.filter(f=>f.key!==o.key):n={...o,items:[]},n?.items?.length&&(n.items=n.items.concat(n.items)),a.push(n)}}return a},[c,i,r?.features,u]),p=Ee((a,s,o,n)=>{s&&e.update(()=>{s.remove()}),a.onSelect({editor:e,queryString:n}),o()},[e]);return W(fe,{anchorElem:t,groups:m,menuRenderFn:(a,{selectItemAndCleanUp:s,selectedItemKey:o,setSelectedItemKey:n})=>a.current&&m.length?xe.createPortal(W("div",{className:k,children:m.map(f=>{let E=f.key;return f.label&&(E=typeof f.label=="function"?f.label({i18n:u}):f.label),Te("div",{className:`${k}__group ${k}__group-${f.key}`,children:[W("div",{className:`${k}__group-title`,children:E}),f.items.map((h,g)=>W(tt,{index:g,isSelected:o===h.key,item:h,onClick:()=>{n(h.key),s(h)},onMouseEnter:()=>{n(h.key)}},h.key))]},f.key)})}),a.current):null,onQueryChange:l,onSelectItem:p,triggerFn:d})}import{useLexicalComposerContext as at}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as st}from"lexical";import*as Re from"react";import{useCallback as ct,useEffect as ve,useRef as mt,useState as ut}from"react";import{createPortal as dt}from"react-dom";var Y=(t,e,i,l,r=50,u=25)=>{let d=0;if(t&&!t.contains(l)){let{bottom:c,left:m,right:p,top:a}=t.getBoundingClientRect(),s=a+window.scrollY,o=c+window.scrollY;if(i<s-u||i>o+u||e<m-r||e>p+r)return-1;(e<m||e>p)&&(d=e<m?e-m:e-p)}return d};import{$getNodeByKey as Q}from"lexical";function D(t){let e=t.getBoundingClientRect(),i=getComputedStyle(t).getPropertyValue("transform");if(!i||i==="none")return e;let l=i.split(",").pop();return e.y=e.y-Number(l.replace(")","")),e}function X(t){let e=(m,p)=>m?parseFloat(window.getComputedStyle(m)[p]):0,{marginBottom:i,marginTop:l}=window.getComputedStyle(t),r=e(t.previousElementSibling,"marginBottom"),u=e(t.nextElementSibling,"marginTop"),d=Math.max(parseFloat(l),r);return{marginBottom:Math.max(parseFloat(i),u),marginTop:d}}import{$getRoot as ot}from"lexical";function _(t){return t.getEditorState().read(()=>ot().getChildrenKeys())}var nt=1,rt=-1,Me=0,w={props:null,result:null};function it(t,e,i=20){let l=t.x-e.x,r=t.y-e.y;return l*l+r*r<=i*i}function V(t){let{anchorElem:e,cache_threshold:i=20,editor:l,fuzzy:r=!1,horizontalOffset:u=0,point:{x:d,y:c},startIndex:m=0,useEdgeAsDefault:p=!1,verbose:a=!1}=t;if(i>0&&w.props&&w.result&&w.props.fuzzy===t.fuzzy&&w.props.horizontalOffset===t.horizontalOffset&&w.props.useEdgeAsDefault===t.useEdgeAsDefault&&it(w.props.point,t.point,i))return w.result;let s=e.getBoundingClientRect(),o=_(l),n={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return l.getEditorState().read(()=>{if(p){let[h,g]=[l.getElementByKey(o[0]),l.getElementByKey(o[o.length-1])],[y,b]=[D(h),D(g)];if(y&&b&&(c<y.top?(n.blockElem=h,n.distance=y.top-c,n.blockNode=Q(o[0]),n.foundAtIndex=0):c>b.bottom&&(n.distance=c-b.bottom,n.blockNode=Q(o[o.length-1]),n.blockElem=g,n.foundAtIndex=o.length-1),n?.blockElem))return{blockElem:null,isFoundNodeEmptyParagraph:!1}}let f=m,E=Me;for(;f>=0&&f<o.length;){let h=o[f],g=l.getElementByKey(h);if(g===null)break;let y=new I(d+u,c),b=pe.fromDOMRect(D(g)),{marginBottom:R,marginTop:M}=X(g),L=b.generateNewRect({bottom:b.bottom+R,left:s.left,right:s.right,top:b.top-M}),{distance:v,isOnBottomSide:x,isOnTopSide:F}=L.distanceFromPoint(y);if(v===0){n.blockElem=g,n.blockNode=Q(h),n.foundAtIndex=f,n.distance=v,n.blockNode&&n.blockNode.getType()==="paragraph"&&n.blockNode.getTextContent()===""&&(!r&&!t.returnEmptyParagraphs&&(n.blockElem=null,n.blockNode=null),n.isFoundNodeEmptyParagraph=!0);break}else r&&v<n.distance&&(n.blockElem=g,n.blockNode=Q(h),n.distance=v,n.foundAtIndex=f);E===Me&&(F?E=rt:x?E=nt:E=1/0),f+=E}}),w.props=t,w.result={blockElem:n.blockElem,blockNode:n.blockNode,foundAtIndex:n.foundAtIndex,isFoundNodeEmptyParagraph:n.isFoundNodeEmptyParagraph},{blockElem:n.blockElem,blockNode:n.blockNode,foundAtIndex:n.foundAtIndex,isFoundNodeEmptyParagraph:n.isFoundNodeEmptyParagraph}}function Z(t,e){return!!t.closest(`.${e}`)}var lt=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Le(t){if(!t||lt.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 ee(t,e,i,l=0){if(!t){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let r=t.getBoundingClientRect(),u=window.getComputedStyle(t),d=e.getBoundingClientRect(),c=i.getBoundingClientRect(),m;if(r.height<60)m=r.top-d.height/2-c.top+r.height/2-1;else{let s=Le(t)?parseInt(u.lineHeight,10):0;m=r.top+(s-d.height)/2-c.top-1}let a=l;e.style.opacity="1",e.style.transform=`translate(${a}px, ${m}px)`}import{jsx as le}from"react/jsx-runtime";var ft="add-block-menu",te=1/0;function pt(t){return t===0?1/0:te>=0&&te<t?te:Math.floor(t/2)}function gt(t,e,i){let l=e.parentElement,{editorConfig:r}=N(),u=r?.admin?.hideGutter?-24:12,d=mt(null),[c,m]=ut(null);ve(()=>{function a(s){let o=s.target;if(!K(o))return;let n=Y(l,s.pageX,s.pageY,o);if(n===-1){m(null);return}if(Z(o,ft))return;let f=_(t),{blockElem:E,blockNode:h,foundAtIndex:g}=V({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-n,point:new I(s.x,s.y),returnEmptyParagraphs:!0,startIndex:pt(f.length),useEdgeAsDefault:!1});te=g,E&&(c?.node!==h||c?.elem!==E)&&m({elem:E,node:h})}return document?.addEventListener("mousemove",a),()=>{document?.removeEventListener("mousemove",a)}},[l,e,t,c]),ve(()=>{d.current&&c?.node&&ee(c?.elem,d.current,e,u)},[e,c,u]);let p=ct(a=>{let s=c;s?.node&&(t.update(()=>{let o=!0;if((s.node.getType()!=="paragraph"||s.node.getTextContent()!=="")&&(o=!1),!o){let n=st();s.node.insertAfter(n),setTimeout(()=>{s={elem:t.getElementByKey(n.getKey()),node:n},m(s)},0)}}),setTimeout(()=>{t.update(()=>{t.focus(),s.node&&"select"in s.node&&typeof s.node.select=="function"&&s.node.select()})},1),setTimeout(()=>{t.dispatchCommand(de,{node:s.node})},2),a.stopPropagation(),a.preventDefault())},[t,c]);return dt(le(Re.Fragment,{children:le("button",{className:"icon add-block-menu",onClick:a=>{p(a)},ref:d,type:"button",children:le("div",{className:i?"icon":""})})}),e)}function Pe({anchorElem:t=document.body}){let[e]=at();return gt(e,t,e._editable)}import{useLexicalComposerContext as Et}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as ke}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as we,$getNodeByKey as bt}from"lexical";import*as He from"react";import{useEffect as ae,useRef as oe,useState as Ie}from"react";import{createPortal as xt}from"react-dom";function Ne(t,e,i){if(!t.current)return;let{left:l,top:r}=i.getBoundingClientRect(),u=D(e),d=u.width,c=u.height,m=u.top-r,p=u.left-l;t.current.style.border="2px solid green",t.current.style.boxSizing="border-box",t.current.style.height=c+"px",t.current.style.pointerEvents="none",t.current.style.position="absolute",t.current.style.top=m+"px",t.current.style.left=p+"px",t.current.style.width=d+"px",t.current.style.zIndex="1000",t.current.style.opacity="0.5"}var U=25,yt=-24,ht=!1,z=0;function Se(t,e,i,l,r,u,d,c,m,p=!1){let{height:a,top:s}=l.getBoundingClientRect(),{top:o,width:n}=d.getBoundingClientRect(),{marginBottom:f,marginTop:E}=X(l),h=s,g=u>=s+a/2+window.scrollY,y=!1;if(r?.elem)if(l!==r?.elem)(g&&r?.elem&&r?.elem===l.nextElementSibling||!g&&r?.elem&&r?.elem===l.previousElementSibling)&&(z++,z<200&&(y=!0));else{z++;let v=r?.boundingBox?.y,x=l.getBoundingClientRect().y;(g===r?.isBelow&&v===x||z<200)&&(y=!1)}if(y)return{isBelow:g,willStayInSamePosition:y};p?h+=a/2:g?h+=a+f/2:h-=E/2;let b=0;p||(g?b=-U:b=U);let R=h-o+b,M=yt-e;i.style.width=`calc(${n}px - ${t})`,i.style.opacity=".4";let L=12;return p?i.style.transform=`translate(${M}px, ${R-U}px)`:g?(l.style.marginBottom=U*2+L+"px",i.style.transform=`translate(${M}px, calc(${R}px - 0px))`):(l.style.marginTop=U*2+L+"px",i.style.transform=`translate(${M}px, calc(${R-U*2}px - 0px))`),ht&&Ne(m,l,d),r.elem.style.opacity="",r?.elem===l?g?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop=""),z=0,{isBelow:g,willStayInSamePosition:y}}import{jsx as ne,jsxs as Lt}from"react/jsx-runtime";var Ct="draggable-block-menu",De="application/x-lexical-drag-block",J=1/0;function Be(t){return t===0?1/0:J>=0&&J<t?J:Math.floor(t/2)}function Tt(t,e){let{transform:i}=e.style;t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=i})}function Fe(t,e){t&&(t.style.opacity="0"),e&&(e.style.opacity="",e.style.marginBottom="",e.style.marginTop="")}function Mt(t,e,i){let l=e.parentElement,r=oe(null),u=oe(null),d=oe(null),c=oe(!1),[m,p]=Ie(null),[a,s]=Ie(null),{editorConfig:o}=N(),n=o?.admin?.hideGutter?-44:-8;ae(()=>{function h(g){let y=g.target;if(!K(y))return;let b=Y(l,g.pageX,g.pageY,y);if(b===-1){p(null);return}if(Z(y,Ct))return;let R=_(t),{blockElem:M,foundAtIndex:L,isFoundNodeEmptyParagraph:v}=V({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-b,point:new I(g.x,g.y),startIndex:Be(R.length),useEdgeAsDefault:!1,verbose:!1});J=L,!(!M&&!v)&&m!==M&&p(M)}return document?.addEventListener("mousemove",h),()=>{document?.removeEventListener("mousemove",h)}},[l,e,t,m]),ae(()=>{r.current&&ee(m,r.current,e,n)},[e,m,n]),ae(()=>{function h(y){if(!c.current)return!1;let[b]=ke(y);if(b)return!1;let{pageY:R,target:M}=y;if(!K(M))return!1;let L=Y(l,y.pageX,y.pageY,M,100,50),v=_(t),{blockElem:x,foundAtIndex:F,isFoundNodeEmptyParagraph:H}=V({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-L,point:new I(y.x,y.y),startIndex:Be(v.length),useEdgeAsDefault:!0,verbose:!0});J=F;let A=u.current;if(x===null||A===null)return!1;if(m!==x){let{isBelow:P,willStayInSamePosition:S}=Se(o?.admin?.hideGutter?"0px":"3rem",n+(o?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),A,x,a,R,e,y,d,H);y.preventDefault(),S||s({boundingBox:x.getBoundingClientRect(),elem:x,isBelow:P})}else Fe(A,a?.elem),s({boundingBox:x.getBoundingClientRect(),elem:x,isBelow:!1});return!0}function g(y){if(!c.current)return!1;let[b]=ke(y);if(b)return!1;let{dataTransfer:R,pageY:M,target:L}=y,v=R?.getData(De)||"";return t.update(()=>{let x=bt(v);if(!x||!K(L))return!1;let F=Y(l,y.pageX,y.pageY,L,100,50),{blockElem:H,isFoundNodeEmptyParagraph:A}=V({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-F,point:new I(y.x,y.y),useEdgeAsDefault:!0});if(!H)return!1;let P=we(H);if(!P)return!1;if(P===x)return!0;let{height:S,top:ie}=D(H),Ue=M>=ie+S/2+window.scrollY;A?(P.insertBefore(x),P.remove()):Ue?P.insertAfter(x):P.insertBefore(x),m!==null&&p(null),document.querySelectorAll(".lexical-block-highlighter").forEach(G=>{G.remove()});let qe=t.getElementByKey(x.getKey());setTimeout(()=>{let G=qe.getBoundingClientRect(),T=document.createElement("div");T.className="lexical-block-highlighter",document.documentElement.getAttribute("data-theme")==="dark"?T.style.backgroundColor="white":T.style.backgroundColor="black",T.style.transition="opacity 0.1s ease-in-out",T.style.zIndex="1",T.style.pointerEvents="none",T.style.boxSizing="border-box",T.style.borderRadius="4px",T.style.position="absolute",document.body.appendChild(T),T.style.opacity="0.1",T.style.height=`${G.height+8}px`,T.style.width=`${G.width+8}px`,T.style.top=`${G.top+window.scrollY-4}px`,T.style.left=`${G.left-4}px`,setTimeout(()=>{T.style.opacity="0",setTimeout(()=>{T.remove()},1e3)},3e3)},120)}),!0}return document.addEventListener("dragover",h),document.addEventListener("drop",g),()=>{document.removeEventListener("dragover",h),document.removeEventListener("drop",g)}},[l,n,e,t,a,m,o?.admin?.hideGutter]);function f(h){let g=h.dataTransfer;if(!g||!m)return;Tt(g,m);let y="";t.update(()=>{let b=we(m);b&&(y=b.getKey())}),c.current=!0,g.setData(De,y)}function E(){c.current=!1,Fe(u.current,a?.elem)}return xt(Lt(He.Fragment,{children:[ne("div",{className:"icon draggable-block-menu",draggable:!0,onDragEnd:E,onDragStart:f,ref:r,children:ne("div",{className:i?"icon":""})}),ne("div",{className:"draggable-block-target-line",ref:u}),ne("div",{className:"debug-highlight",ref:d})]}),e)}function Ae({anchorElem:t=document.body}){let[e]=Et();return Mt(e,t,e._editable)}import{ContentEditable as vt}from"@lexical/react/LexicalContentEditable.js";import{jsx as Rt}from"react/jsx-runtime";function Oe({className:t}){return Rt(vt,{className:t??"ContentEditable__root"})}import{jsx as C,jsxs as j}from"react/jsx-runtime";var Ge=t=>{let{editorConfig:e,editorContainerRef:i,onChange:l}=t,r=N(),[u]=Pt(),{t:d}=Dt(),[c,m]=$e(null),p=o=>{o!==null&&m(o)};ze(()=>{if(!r?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}r?.parentEditor?.uuid&&r.parentEditor?.registerChild(r.uuid,r);let o=()=>{r.focusEditor(r)},n=()=>{r.blurEditor(r)},f=u.registerCommand(Ft,()=>(o(),!0),_e),E=u.registerCommand(Bt,()=>(n(),!0),_e);return()=>{f(),E(),r.parentEditor?.unregisterChild?.(r.uuid)}},[u,r]);let[a,s]=$e(!1);return ze(()=>{let o=()=>{let n=window.matchMedia("(max-width: 768px)").matches;n!==a&&s(n)};return o(),window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}},[a]),j(q.Fragment,{children:[e.features.plugins.map(o=>{if(o.position==="aboveContainer")return C(O,{clientProps:o.clientProps,plugin:o},o.key)}),j("div",{className:"editor-container",ref:i,children:[e.features.plugins.map(o=>{if(o.position==="top")return C(O,{clientProps:o.clientProps,plugin:o},o.key)}),C(wt,{ErrorBoundary:Nt,contentEditable:C("div",{className:"editor-scroller",children:C("div",{className:"editor",ref:p,children:C(Oe,{})})}),placeholder:C("p",{className:"editor-placeholder",children:d("lexical:general:placeholder")})}),C(kt,{ignoreSelectionChange:!0,onChange:(o,n,f)=>{(!f.has("focus")||f.size>1)&&l?.(o,n,f)}}),c&&j(q.Fragment,{children:[!a&&u.isEditable()&&j(q.Fragment,{children:[C(Ae,{anchorElem:c}),C(Pe,{anchorElem:c})]}),e.features.plugins.map(o=>{if(o.position==="floatingAnchorElem"&&!(o.desktopOnly===!0&&a))return C(O,{anchorElem:c,clientProps:o.clientProps,plugin:o},o.key)}),u.isEditable()&&C(q.Fragment,{children:C(Ce,{anchorElem:c})})]}),u.isEditable()&&j(q.Fragment,{children:[C(St,{}),e?.features?.markdownTransformers?.length>0&&C(ye,{})]}),C(It,{}),e.features.plugins.map(o=>{if(o.position==="normal")return C(O,{clientProps:o.clientProps,plugin:o},o.key)}),e.features.plugins.map(o=>{if(o.position==="bottom")return C(O,{clientProps:o.clientProps,plugin:o},o.key)})]}),e.features.plugins.map(o=>{if(o.position==="belowContainer")return C(O,{clientProps:o.clientProps,plugin:o},o.key)})]})};import{jsx as B}from"react/jsx-runtime";var Ye=({children:t,providers:e})=>{if(!e?.length)return t;let i=e[0];return e.length>1?B(i,{children:B(Ye,{providers:e.slice(1),children:t})}):B(i,{children:t})},Ve=t=>{let{editorConfig:e,fieldProps:i,onChange:l,path:r,readOnly:u,value:d}=t,c=N(),m=We.useRef(null),p=Ke(()=>{let s=d;return e?.features?.hooks?.load?.length&&e.features.hooks.load.forEach(o=>{s=o({incomingEditorState:s})}),s},[e,d]),a=Ke(()=>{if(p&&typeof p!="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(p));if(p&&Array.isArray(p)&&!("root"in p))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/beta/lexical/migration#migration-via-migration-script-recommended");if(p&&"jsonContent"in p)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/beta/lexical/migration#migrating-from-payload-plugin-lexical");return{editable:u!==!0,editorState:p!=null?JSON.stringify(p):void 0,namespace:e.lexical.namespace,nodes:[...ce({editorConfig:e})],onError:s=>{throw s},theme:e.lexical.theme}},[e,p,u]);return a?B(Ht,{initialConfig:a,children:B(me,{editorConfig:e,editorContainerRef:m,fieldProps:i,parentContext:c,children:B(Ye,{providers:e.features.providers,children:B(Ge,{editorConfig:e,editorContainerRef:m,onChange:l})})})},r):B("p",{children:"Loading..."})};import"./bundled.css";import{jsx as $,jsxs as se}from"react/jsx-runtime";var re="rich-text-lexical",Yt=t=>{let{name:e,CustomDescription:i,CustomError:l,CustomLabel:r,className:u,descriptionProps:d,editorConfig:c,errorProps:m,label:p,labelProps:a,path:s,readOnly:o,required:n,style:f,validate:E,width:h}=t,g=Kt((P,S)=>{if(typeof E=="function")return E(P,{...S,props:t,required:n})},[E,n]),{path:y}=$t(),b=zt({path:y??s??e,validate:g}),{errorMessage:R,initialValue:M,path:L,schemaPath:v,setValue:x,showError:F,value:H}=b,A=[re,"field-type",u,F&&"error",o&&`${re}--read-only`,c?.admin?.hideGutter!==!0?`${re}--show-gutter`:null].filter(Boolean).join(" ");return se("div",{className:A,style:{...f,width:h},children:[$(Ot,{CustomError:l,path:L,...m||{},alignCaret:"left"}),$(_t,{CustomLabel:r,label:p,required:n,...a||{}}),se("div",{className:`${re}__wrap`,children:[$(Wt,{fallbackRender:Vt,onReset:()=>{},children:$(Ve,{editorConfig:c,fieldProps:t,onChange:P=>{let S=P.toJSON();c?.features?.hooks?.save?.length&&c.features.hooks.save.forEach(ie=>{S=ie({incomingEditorState:S})}),x(S)},path:L,readOnly:o,value:H},JSON.stringify({initialValue:M,path:L}))}),i!==void 0?i:$(At,{...d||{}})]})]},L)};function Vt({error:t}){return se("div",{className:"errorBoundary",role:"alert",children:[$("p",{children:"Something went wrong:"}),$("pre",{style:{color:"red"},children:t.message})]})}var Un=Gt(Yt);export{Un as RichText};
|
|
2
|
-
//# sourceMappingURL=Field-YNHIDK3D.js.map
|