@payloadcms/richtext-lexical 3.38.0-internal.8afd37f → 3.38.0
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-PWFMMJ4H.js +2 -0
- package/dist/exports/client/Field-PWFMMJ4H.js.map +7 -0
- package/dist/exports/client/index.js +7 -7
- package/dist/exports/client/index.js.map +3 -3
- package/dist/features/link/client/index.d.ts.map +1 -1
- package/dist/features/link/client/index.js +1 -2
- package/dist/features/link/client/index.js.map +1 -1
- package/dist/features/toolbars/fixed/server/index.d.ts +10 -0
- package/dist/features/toolbars/fixed/server/index.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/server/index.js +1 -0
- package/dist/features/toolbars/fixed/server/index.js.map +1 -1
- package/dist/features/toolbars/types.d.ts +1 -0
- package/dist/features/toolbars/types.d.ts.map +1 -1
- package/dist/features/toolbars/types.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +22 -9
- package/dist/field/Field.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/client/sanitize.js +21 -0
- package/dist/lexical/config/client/sanitize.js.map +1 -1
- package/package.json +8 -9
- package/dist/exports/client/Field-QFHWUA2L.js +0 -2
- package/dist/exports/client/Field-QFHWUA2L.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/link/client/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AAevE,MAAM,MAAM,WAAW,GAAG;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CACzC,GAAG,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/link/client/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AAevE,MAAM,MAAM,WAAW,GAAG;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CACzC,GAAG,6BAA6B,CAAA;AAsDjC,eAAO,MAAM,iBAAiB,wFAgC3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["$findMatchingParent","$getSelection","$isRangeSelection","LinkIcon","getSelectedNode","createClientFeature","toolbarFeatureButtonsGroupWithItems","LinkMarkdownTransformer","AutoLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","AutoLinkPlugin","ClickableLinkPlugin","FloatingLinkEditorPlugin","TOGGLE_LINK_WITH_MODAL_COMMAND","LinkPlugin","toolbarGroups","ChildComponent","isActive","selection","selectedNode","linkParent","isEnabled","getTextContent","length","key","label","i18n","t","onSelect","editor","selectedText","selectedNodes","getEditorState","read","getNodes","linkFields","doc","
|
|
1
|
+
{"version":3,"file":"index.js","names":["$findMatchingParent","$getSelection","$isRangeSelection","LinkIcon","getSelectedNode","createClientFeature","toolbarFeatureButtonsGroupWithItems","LinkMarkdownTransformer","AutoLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","AutoLinkPlugin","ClickableLinkPlugin","FloatingLinkEditorPlugin","TOGGLE_LINK_WITH_MODAL_COMMAND","LinkPlugin","toolbarGroups","ChildComponent","isActive","selection","selectedNode","linkParent","isEnabled","getTextContent","length","key","label","i18n","t","onSelect","editor","selectedText","selectedNodes","getEditorState","read","getNodes","linkFields","doc","dispatchCommand","fields","text","order","LinkFeatureClient","props","markdownTransformers","nodes","disableAutoLinks","filter","Boolean","plugins","Component","position","sanitizedClientFeatureProps","toolbarFixed","groups","toolbarInline"],"sources":["../../../../src/features/link/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { Klass, LexicalNode } from 'lexical'\n\nimport { $findMatchingParent } from '@lexical/utils'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\nimport type { ClientFeature } from '../../typesClient.js'\nimport type { LinkFields } from '../nodes/types.js'\nimport type { ExclusiveLinkCollectionsProps } from '../server/index.js'\n\nimport { LinkIcon } from '../../../lexical/ui/icons/Link/index.js'\nimport { getSelectedNode } from '../../../lexical/utils/getSelectedNode.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { toolbarFeatureButtonsGroupWithItems } from '../../shared/toolbar/featureButtonsGroup.js'\nimport { LinkMarkdownTransformer } from '../markdownTransformer.js'\nimport { AutoLinkNode } from '../nodes/AutoLinkNode.js'\nimport { $isLinkNode, LinkNode, TOGGLE_LINK_COMMAND } from '../nodes/LinkNode.js'\nimport { AutoLinkPlugin } from './plugins/autoLink/index.js'\nimport { ClickableLinkPlugin } from './plugins/clickableLink/index.js'\nimport { FloatingLinkEditorPlugin } from './plugins/floatingLinkEditor/index.js'\nimport { TOGGLE_LINK_WITH_MODAL_COMMAND } from './plugins/floatingLinkEditor/LinkEditor/commands.js'\nimport { LinkPlugin } from './plugins/link/index.js'\n\nexport type ClientProps = {\n defaultLinkType?: string\n defaultLinkURL?: string\n disableAutoLinks?: 'creationOnly' | true\n} & ExclusiveLinkCollectionsProps\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarFeatureButtonsGroupWithItems([\n {\n ChildComponent: LinkIcon,\n isActive: ({ selection }) => {\n if ($isRangeSelection(selection)) {\n const selectedNode = getSelectedNode(selection)\n const linkParent = $findMatchingParent(selectedNode, $isLinkNode)\n return linkParent != null\n }\n return false\n },\n isEnabled: ({ selection }) => {\n return !!($isRangeSelection(selection) && $getSelection()?.getTextContent()?.length)\n },\n key: 'link',\n label: ({ i18n }) => {\n return i18n.t('lexical:link:label')\n },\n onSelect: ({ editor, isActive }) => {\n if (!isActive) {\n let selectedText: string | undefined\n let selectedNodes: LexicalNode[] = []\n editor.getEditorState().read(() => {\n selectedText = $getSelection()?.getTextContent()\n // We need to selected nodes here before the drawer opens, as clicking around in the drawer may change the original selection\n selectedNodes = $getSelection()?.getNodes() ?? []\n })\n\n if (!selectedText?.length) {\n return\n }\n\n const linkFields: Partial<LinkFields> = {\n doc: null,\n }\n\n editor.dispatchCommand(TOGGLE_LINK_WITH_MODAL_COMMAND, {\n fields: linkFields,\n selectedNodes,\n text: selectedText,\n })\n } else {\n // remove link\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, null)\n }\n },\n order: 1,\n },\n ]),\n]\n\nexport const LinkFeatureClient = createClientFeature<ClientProps>(({ props }) => ({\n markdownTransformers: [LinkMarkdownTransformer],\n nodes: [LinkNode, props?.disableAutoLinks === true ? null : AutoLinkNode].filter(\n Boolean,\n ) as Array<Klass<LexicalNode>>,\n plugins: [\n {\n Component: LinkPlugin,\n position: 'normal',\n },\n props?.disableAutoLinks === true || props?.disableAutoLinks === 'creationOnly'\n ? null\n : {\n Component: AutoLinkPlugin,\n position: 'normal',\n },\n {\n Component: ClickableLinkPlugin,\n position: 'normal',\n },\n {\n Component: FloatingLinkEditorPlugin,\n position: 'floatingAnchorElem',\n },\n ].filter(Boolean) as ClientFeature<ClientProps>['plugins'],\n sanitizedClientFeatureProps: props,\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n}))\n"],"mappings":"AAAA;;AAIA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,aAAa,EAAEC,iBAAiB,QAAQ;AAOjD,SAASC,QAAQ,QAAQ;AACzB,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,mCAAmC,QAAQ;AACpD,SAASC,uBAAuB,QAAQ;AACxC,SAASC,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AA,EAAgC;QACrDyB,MAAA,EAAQH,UAAA;QACRJ,aAAA;QACAQ,IAAA,EAAMT;MACR;IACF,OAAO;MACL;MACAD,MAAA,CAAOQ,eAAe,CAAC5B,mBAAA,EAAqB;IAC9C;EACF;EACA+B,KAAA,EAAO;AACT,EACD,EACF;AAED,OAAO,MAAMC,iBAAA,GAAoBtC,mBAAA,CAAiC,CAAC;EAAEuC;AAAK,CAAE,MAAM;EAChFC,oBAAA,EAAsB,CAACtC,uBAAA,CAAwB;EAC/CuC,KAAA,EAAO,CAACpC,QAAA,EAAUkC,KAAA,EAAOG,gBAAA,KAAqB,OAAO,OAAOvC,YAAA,CAAa,CAACwC,MAAM,CAC9EC,OAAA;EAEFC,OAAA,EAAS,CACP;IACEC,SAAA,EAAWnC,UAAA;IACXoC,QAAA,EAAU;EACZ,GACAR,KAAA,EAAOG,gBAAA,KAAqB,QAAQH,KAAA,EAAOG,gBAAA,KAAqB,iBAC5D,OACA;IACEI,SAAA,EAAWvC,cAAA;IACXwC,QAAA,EAAU;EACZ,GACJ;IACED,SAAA,EAAWtC,mBAAA;IACXuC,QAAA,EAAU;EACZ,GACA;IACED,SAAA,EAAWrC,wBAAA;IACXsC,QAAA,EAAU;EACZ,EACD,CAACJ,MAAM,CAACC,OAAA;EACTI,2BAAA,EAA6BT,KAAA;EAC7BU,YAAA,EAAc;IACZC,MAAA,EAAQtC;EACV;EACAuC,aAAA,EAAe;IACbD,MAAA,EAAQtC;EACV;AACF","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CustomGroups } from '../../types.js';
|
|
1
2
|
export type FixedToolbarFeatureProps = {
|
|
2
3
|
/**
|
|
3
4
|
* @default false
|
|
@@ -7,6 +8,15 @@ export type FixedToolbarFeatureProps = {
|
|
|
7
8
|
* This means that if the editor has a child-editor, and the child-editor is focused, the toolbar will apply to the child-editor, not the parent editor with this feature added.
|
|
8
9
|
*/
|
|
9
10
|
applyToFocusedEditor?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Custom configurations for toolbar groups
|
|
13
|
+
* Key is the group key (e.g. 'format', 'indent', 'align')
|
|
14
|
+
* Value is a partial ToolbarGroup object that will be merged with the default configuration
|
|
15
|
+
*
|
|
16
|
+
* @note Props passed via customGroups must be serializable. Avoid using functions or dynamic components.
|
|
17
|
+
* ChildComponent, if provided, must be a serializable server component.
|
|
18
|
+
*/
|
|
19
|
+
customGroups?: CustomGroups;
|
|
10
20
|
/**
|
|
11
21
|
* @default false
|
|
12
22
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/toolbars/fixed/server/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/toolbars/fixed/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAIlD,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B;;;;OAIG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,CAAA;AAED,eAAO,MAAM,mBAAmB,+IAuB9B,CAAA"}
|
|
@@ -5,6 +5,7 @@ export const FixedToolbarFeature = createServerFeature({
|
|
|
5
5
|
}) => {
|
|
6
6
|
const sanitizedProps = {
|
|
7
7
|
applyToFocusedEditor: props?.applyToFocusedEditor === undefined ? false : props.applyToFocusedEditor,
|
|
8
|
+
customGroups: props?.customGroups,
|
|
8
9
|
disableIfParentHasFixedToolbar: props?.disableIfParentHasFixedToolbar === undefined ? false : props.disableIfParentHasFixedToolbar
|
|
9
10
|
};
|
|
10
11
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["createServerFeature","FixedToolbarFeature","feature","props","sanitizedProps","applyToFocusedEditor","undefined","disableIfParentHasFixedToolbar","ClientFeature","clientFeatureProps","sanitizedServerFeatureProps","key"],"sources":["../../../../../src/features/toolbars/fixed/server/index.ts"],"sourcesContent":["import { createServerFeature } from '../../../../utilities/createServerFeature.js'\n\nexport type FixedToolbarFeatureProps = {\n /**\n * @default false\n *\n * If this is enabled, the toolbar will apply to the focused editor, not the editor with the FixedToolbarFeature.\n *\n * This means that if the editor has a child-editor, and the child-editor is focused, the toolbar will apply to the child-editor, not the parent editor with this feature added.\n */\n applyToFocusedEditor?: boolean\n /**\n * @default false\n *\n * If there is a parent editor with a fixed toolbar, this will disable the toolbar for this editor.\n */\n disableIfParentHasFixedToolbar?: boolean\n}\n\nexport const FixedToolbarFeature = createServerFeature<\n FixedToolbarFeatureProps,\n FixedToolbarFeatureProps,\n FixedToolbarFeatureProps\n>({\n feature: ({ props }) => {\n const sanitizedProps: FixedToolbarFeatureProps = {\n applyToFocusedEditor:\n props?.applyToFocusedEditor === undefined ? false : props.applyToFocusedEditor,\n disableIfParentHasFixedToolbar:\n props?.disableIfParentHasFixedToolbar === undefined\n ? false\n : props.disableIfParentHasFixedToolbar,\n }\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#FixedToolbarFeatureClient',\n clientFeatureProps: sanitizedProps,\n sanitizedServerFeatureProps: sanitizedProps,\n }\n },\n key: 'toolbarFixed',\n})\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["createServerFeature","FixedToolbarFeature","feature","props","sanitizedProps","applyToFocusedEditor","undefined","customGroups","disableIfParentHasFixedToolbar","ClientFeature","clientFeatureProps","sanitizedServerFeatureProps","key"],"sources":["../../../../../src/features/toolbars/fixed/server/index.ts"],"sourcesContent":["import type { CustomGroups } from '../../types.js'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\n\nexport type FixedToolbarFeatureProps = {\n /**\n * @default false\n *\n * If this is enabled, the toolbar will apply to the focused editor, not the editor with the FixedToolbarFeature.\n *\n * This means that if the editor has a child-editor, and the child-editor is focused, the toolbar will apply to the child-editor, not the parent editor with this feature added.\n */\n applyToFocusedEditor?: boolean\n /**\n * Custom configurations for toolbar groups\n * Key is the group key (e.g. 'format', 'indent', 'align')\n * Value is a partial ToolbarGroup object that will be merged with the default configuration\n *\n * @note Props passed via customGroups must be serializable. Avoid using functions or dynamic components.\n * ChildComponent, if provided, must be a serializable server component.\n */\n customGroups?: CustomGroups\n /**\n * @default false\n *\n * If there is a parent editor with a fixed toolbar, this will disable the toolbar for this editor.\n */\n disableIfParentHasFixedToolbar?: boolean\n}\n\nexport const FixedToolbarFeature = createServerFeature<\n FixedToolbarFeatureProps,\n FixedToolbarFeatureProps,\n FixedToolbarFeatureProps\n>({\n feature: ({ props }) => {\n const sanitizedProps: FixedToolbarFeatureProps = {\n applyToFocusedEditor:\n props?.applyToFocusedEditor === undefined ? false : props.applyToFocusedEditor,\n customGroups: props?.customGroups,\n disableIfParentHasFixedToolbar:\n props?.disableIfParentHasFixedToolbar === undefined\n ? false\n : props.disableIfParentHasFixedToolbar,\n }\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#FixedToolbarFeatureClient',\n clientFeatureProps: sanitizedProps,\n sanitizedServerFeatureProps: sanitizedProps,\n }\n },\n key: 'toolbarFixed',\n})\n"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ;AA4BpC,OAAO,MAAMC,mBAAA,GAAsBD,mBAAA,CAIjC;EACAE,OAAA,EAASA,CAAC;IAAEC;EAAK,CAAE;IACjB,MAAMC,cAAA,GAA2C;MAC/CC,oBAAA,EACEF,KAAA,EAAOE,oBAAA,KAAyBC,SAAA,GAAY,QAAQH,KAAA,CAAME,oBAAoB;MAChFE,YAAA,EAAcJ,KAAA,EAAOI,YAAA;MACrBC,8BAAA,EACEL,KAAA,EAAOK,8BAAA,KAAmCF,SAAA,GACtC,QACAH,KAAA,CAAMK;IACd;IAEA,OAAO;MACLC,aAAA,EAAe;MACfC,kBAAA,EAAoBN,cAAA;MACpBO,2BAAA,EAA6BP;IAC/B;EACF;EACAQ,GAAA,EAAK;AACP","ignoreList":[]}
|
|
@@ -99,4 +99,5 @@ export type ToolbarGroupItem = {
|
|
|
99
99
|
}) => void;
|
|
100
100
|
order?: number;
|
|
101
101
|
};
|
|
102
|
+
export type CustomGroups = Record<string, Partial<Omit<ToolbarButtonsGroup, 'items' | 'key'>> | Partial<Omit<ToolbarDropdownGroup, 'isEnabled' | 'items' | 'key'>>>;
|
|
102
103
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/toolbars/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAClG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAE5D,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,oBAAoB,CAAA;AAErE,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,EACX,MAAM,EACN,mBAAmB,EACnB,SAAS,GACV,EAAE;QACD,MAAM,EAAE,aAAa,CAAA;QACrB,mBAAmB,EAAE,uBAAuB,CAAA;QAC5C,SAAS,EAAE,aAAa,CAAA;KACzB,KAAK,OAAO,CAAA;IACb;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAA;IAC9B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE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E;QACN,sBAAsB,EAAE,sBAAsB,CAAA;QAC9C,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QAC5B,UAAU,EAAE,MAAM,CAAA;KACnB,KAAK,MAAM,CAAC,GACb,MAAM,CAAA;IACV,oDAAoD;IACpD,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;QAAE,MAAM,EAAE,aAAa,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAA;IACvF,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAC/B,MAAM,EACJ,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,KAAK,CAAC,CAAC,GACnD,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,WAAW,GAAG,OAAO,GAAG,KAAK,CAAC,CAAC,CACrE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/features/toolbars/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\nimport type React from 'react'\n\nimport type { EditorConfigContextType } from '../../lexical/config/client/EditorConfigProvider.js'\nimport type { FeatureClientSchemaMap } from '../../types.js'\n\nexport type ToolbarGroup = ToolbarButtonsGroup | ToolbarDropdownGroup\n\nexport type ToolbarDropdownGroup = {\n /**\n * The dropdown toolbar ChildComponent allows you to pass in a React Component which will be displayed within the dropdown button.\n */\n ChildComponent?: React.FC\n /**\n * This is optional and controls if the toolbar group is highlighted or not.\n */\n isEnabled?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /**\n * All toolbar items part of this toolbar group need to be added here.\n */\n items: Array<ToolbarGroupItem>\n /**\n * Each toolbar group needs to have a unique key. Groups with the same keys will have their items merged together.\n */\n key: string\n /**\n * The maximum number of active items that can be selected at once.\n * Increasing this will hurt performance, as more nodes need to be checked for their active state.\n *\n * E.g. if this is 1, we can stop checking nodes once we find an active node.\n *\n * @default 1\n */\n maxActiveItems?: number\n /**\n * Determines where the toolbar group will be.\n */\n order?: number\n /**\n * Controls the toolbar group type. Set to `dropdown` to create a buttons toolbar group, which displays toolbar items vertically using their icons and labels, if the dropdown is open.\n */\n type: 'dropdown'\n}\n\nexport type ToolbarButtonsGroup = {\n /**\n * All toolbar items part of this toolbar group need to be added here.\n */\n items: Array<ToolbarGroupItem>\n /**\n * Each toolbar group needs to have a unique key. Groups with the same keys will have their items merged together.\n */\n key: string\n /**\n * Determines where the toolbar group will be.\n */\n order?: number\n /**\n * Controls the toolbar group type. Set to `buttons` to create a buttons toolbar group, which displays toolbar items horizontally using only their icons.\n */\n type: 'buttons'\n}\n\nexport type ToolbarGroupItem = {\n /** A React component which is rendered within your toolbar item's default button component. Usually, you want this to be an icon. */\n ChildComponent?: React.FC\n /** A React component which is rendered in place of the toolbar item's default button component, thus completely replacing it. The `ChildComponent` and `onSelect` properties will be ignored. */\n Component?: React.FC<{\n active?: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n }>\n /** This is optional and controls if the toolbar item is highlighted or not. */\n isActive?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /** This is optional and controls if the toolbar item is clickable or not. If `false` is returned here, it will be grayed out and unclickable. */\n isEnabled?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /** Each toolbar item needs to have a unique key. */\n key: string\n /** The label will be displayed in your toolbar item, if it's within a dropdown group. In order to make use of i18n, this can be a function. */\n label?:\n | ((args: {\n featureClientSchemaMap: FeatureClientSchemaMap\n i18n: I18nClient<{}, string>\n schemaPath: string\n }) => string)\n | string\n /** Each toolbar item needs to have a unique key. */\n onSelect?: ({ editor, isActive }: { editor: LexicalEditor; isActive: boolean }) => void\n order?: number\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/features/toolbars/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\nimport type React from 'react'\n\nimport type { EditorConfigContextType } from '../../lexical/config/client/EditorConfigProvider.js'\nimport type { FeatureClientSchemaMap } from '../../types.js'\n\nexport type ToolbarGroup = ToolbarButtonsGroup | ToolbarDropdownGroup\n\nexport type ToolbarDropdownGroup = {\n /**\n * The dropdown toolbar ChildComponent allows you to pass in a React Component which will be displayed within the dropdown button.\n */\n ChildComponent?: React.FC\n /**\n * This is optional and controls if the toolbar group is highlighted or not.\n */\n isEnabled?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /**\n * All toolbar items part of this toolbar group need to be added here.\n */\n items: Array<ToolbarGroupItem>\n /**\n * Each toolbar group needs to have a unique key. Groups with the same keys will have their items merged together.\n */\n key: string\n /**\n * The maximum number of active items that can be selected at once.\n * Increasing this will hurt performance, as more nodes need to be checked for their active state.\n *\n * E.g. if this is 1, we can stop checking nodes once we find an active node.\n *\n * @default 1\n */\n maxActiveItems?: number\n /**\n * Determines where the toolbar group will be.\n */\n order?: number\n /**\n * Controls the toolbar group type. Set to `dropdown` to create a buttons toolbar group, which displays toolbar items vertically using their icons and labels, if the dropdown is open.\n */\n type: 'dropdown'\n}\n\nexport type ToolbarButtonsGroup = {\n /**\n * All toolbar items part of this toolbar group need to be added here.\n */\n items: Array<ToolbarGroupItem>\n /**\n * Each toolbar group needs to have a unique key. Groups with the same keys will have their items merged together.\n */\n key: string\n /**\n * Determines where the toolbar group will be.\n */\n order?: number\n /**\n * Controls the toolbar group type. Set to `buttons` to create a buttons toolbar group, which displays toolbar items horizontally using only their icons.\n */\n type: 'buttons'\n}\n\nexport type ToolbarGroupItem = {\n /** A React component which is rendered within your toolbar item's default button component. Usually, you want this to be an icon. */\n ChildComponent?: React.FC\n /** A React component which is rendered in place of the toolbar item's default button component, thus completely replacing it. The `ChildComponent` and `onSelect` properties will be ignored. */\n Component?: React.FC<{\n active?: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n }>\n /** This is optional and controls if the toolbar item is highlighted or not. */\n isActive?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /** This is optional and controls if the toolbar item is clickable or not. If `false` is returned here, it will be grayed out and unclickable. */\n isEnabled?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /** Each toolbar item needs to have a unique key. */\n key: string\n /** The label will be displayed in your toolbar item, if it's within a dropdown group. In order to make use of i18n, this can be a function. */\n label?:\n | ((args: {\n featureClientSchemaMap: FeatureClientSchemaMap\n i18n: I18nClient<{}, string>\n schemaPath: string\n }) => string)\n | string\n /** Each toolbar item needs to have a unique key. */\n onSelect?: ({ editor, isActive }: { editor: LexicalEditor; isActive: boolean }) => void\n order?: number\n}\n\nexport type CustomGroups = Record<\n string,\n | Partial<Omit<ToolbarButtonsGroup, 'items' | 'key'>>\n | Partial<Omit<ToolbarDropdownGroup, 'isEnabled' | 'items' | 'key'>>\n>\n"],"mappings":"AAsHA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAcA,OAAO,
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAcA,OAAO,KAA4D,MAAM,OAAO,CAAA;AAGhF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,mCAAmC,CAAA;AAC1C,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAM5D,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,CA8K9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAqC,CAAA"}
|
package/dist/field/Field.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { FieldDescription, FieldError, FieldLabel, RenderCustomComponent, useEditDepth, useEffectEvent, useField } from '@payloadcms/ui';
|
|
5
5
|
import { mergeFieldStyles } from '@payloadcms/ui/shared';
|
|
6
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
7
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
8
8
|
import './bundled.css';
|
|
9
9
|
import { LexicalProvider } from '../lexical/LexicalProvider.js';
|
|
@@ -80,16 +80,29 @@ const RichTextComponent = props => {
|
|
|
80
80
|
}, [isSmallWidthViewport]);
|
|
81
81
|
const classes = [baseClass, 'field-type', className, showError && 'error', disabled && `${baseClass}--read-only`, editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport ? `${baseClass}--show-gutter` : null].filter(Boolean).join(' ');
|
|
82
82
|
const pathWithEditDepth = `${path}.${editDepth}`;
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
const dispatchFieldUpdateTask = useRef(undefined);
|
|
84
|
+
const handleChange = useCallback(editorState => {
|
|
85
|
+
const updateFieldValue = editorState_0 => {
|
|
86
|
+
const newState = editorState_0.toJSON();
|
|
87
|
+
prevValueRef.current = newState;
|
|
88
|
+
setValue(newState);
|
|
89
|
+
};
|
|
89
90
|
if (typeof window.requestIdleCallback === 'function') {
|
|
90
|
-
|
|
91
|
+
// Cancel earlier scheduled value updates,
|
|
92
|
+
// so that a CPU-limited event loop isn't flooded with n callbacks for n keystrokes into the rich text field,
|
|
93
|
+
// but that there's only ever the latest one state update
|
|
94
|
+
// dispatch task, to be executed with the next idle time,
|
|
95
|
+
// or the deadline of 500ms.
|
|
96
|
+
if (typeof window.cancelIdleCallback === 'function' && dispatchFieldUpdateTask.current) {
|
|
97
|
+
cancelIdleCallback(dispatchFieldUpdateTask.current);
|
|
98
|
+
}
|
|
99
|
+
// Schedule the state update to happen the next time the browser has sufficient resources,
|
|
100
|
+
// or the latest after 500ms.
|
|
101
|
+
dispatchFieldUpdateTask.current = requestIdleCallback(() => updateFieldValue(editorState), {
|
|
102
|
+
timeout: 500
|
|
103
|
+
});
|
|
91
104
|
} else {
|
|
92
|
-
updateFieldValue(
|
|
105
|
+
updateFieldValue(editorState);
|
|
93
106
|
}
|
|
94
107
|
}, [setValue]);
|
|
95
108
|
const styles = useMemo(() => mergeFieldStyles(field), [field]);
|
package/dist/field/Field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","names":["FieldDescription","FieldError","FieldLabel","RenderCustomComponent","useEditDepth","useEffectEvent","useField","mergeFieldStyles","React","useCallback","useEffect","useMemo","useState","ErrorBoundary","LexicalProvider","baseClass","RichTextComponent","props","editorConfig","field","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","editDepth","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","disabledFromField","initialValue","setValue","showError","potentiallyStalePath","isSmallWidthViewport","setIsSmallWidthViewport","rerenderProviderKey","setRerenderProviderKey","prevInitialValueRef","useRef","prevValueRef","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","updateFieldValue","editorState","newState","toJSON","current","handleChange","requestIdleCallback","styles","handleInitialValueChange","JSON","stringify","Date","Object","is","_jsxs","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","composerKey","fieldProps","onChange","error","role","color","message","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\nimport type { Validate } from 'payload'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n RenderCustomComponent,\n useEditDepth,\n useEffectEvent,\n useField,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\n\nimport '../lexical/theme/EditorTheme.scss'\nimport './bundled.css'\nimport './index.scss'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled: disabledFromField,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || disabledFromField\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n const [rerenderProviderKey, setRerenderProviderKey] = useState<Date>()\n\n const prevInitialValueRef = React.useRef<SerializedEditorState | undefined>(initialValue)\n const prevValueRef = React.useRef<SerializedEditorState | undefined>(value)\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 const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport\n ? `${baseClass}--show-gutter`\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const updateFieldValue = (editorState: EditorState) => {\n const newState = editorState.toJSON()\n prevValueRef.current = newState\n setValue(newState)\n }\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n if (typeof window.requestIdleCallback === 'function') {\n requestIdleCallback(() => updateFieldValue(editorState))\n } else {\n updateFieldValue(editorState)\n }\n },\n [setValue],\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const handleInitialValueChange = useEffectEvent(\n (initialValue: SerializedEditorState | undefined) => {\n // Object deep equality check here, as re-mounting the editor if\n // the new value is the same as the old one is not necessary\n if (\n prevValueRef.current !== value &&\n JSON.stringify(prevValueRef.current) !== JSON.stringify(value)\n ) {\n prevInitialValueRef.current = initialValue\n prevValueRef.current = value\n setRerenderProviderKey(new Date())\n }\n },\n )\n\n useEffect(() => {\n // Needs to trigger for object reference changes - otherwise,\n // reacting to the same initial value change twice will cause\n // the second change to be ignored, even though the value has changed.\n // That's because initialValue is not kept up-to-date\n if (!Object.is(initialValue, prevInitialValueRef.current)) {\n handleInitialValueChange(initialValue)\n }\n }, [initialValue])\n\n return (\n <div className={classes} key={pathWithEditDepth} style={styles}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {Label || <FieldLabel label={label} localized={localized} path={path} required={required} />}\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n isSmallWidthViewport={isSmallWidthViewport}\n key={JSON.stringify({ path, rerenderProviderKey })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n {Description}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n"],"mappings":"AAAA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qBAChFwD,KAAA,CAAC;MAAI9D,SAAA,EAAW,GAAGN,SAAA,QAAiB;8BAClCoE,KAAA,CAACtE,aAAA;QAAc2E,cAAA,EAAgBA,cAAA;QAAgBC,OAAA,EAASA,CAAA,MAAO;mBAC5DlD,WAAA,E,aACD8C,IAAA,CAACvE,eAAA;UACC4E,WAAA,EAAatB,iBAAA;UACblD,YAAA,EAAcA,YAAA;UACdyE,UAAA,EAAY1E,KAAA;UACZgC,oBAAA,EAAsBA,oBAAA;UAEtB2C,QAAA,EAAUlB,YAAA;UACVnD,QAAA,EAAUoB,QAAA;UACVR,KAAA,EAAOA;WAHF2C,IAAA,CAAKC,SAAS,CAAC;UAAEnD,IAAA;UAAMuB;QAAoB,KAKjDb,UAAA;UAEFE,WAAA,E,aACD6C,IAAA,CAAClF,qBAAA;QACCmF,eAAA,EAAiB9C,WAAA;QACjB+C,QAAA,eAAUF,IAAA,CAACrF,gBAAA;UAAiBsB,WAAA,EAAaA,WAAA;UAAaM,IAAA,EAAMA;;;;KAxBpCwC,iBAAA;AA6BlC;AAEA,SAASoB,eAAe;EAAEK;AAAK,CAAoB;EACjD;EAEA,oBACEV,KAAA,CAAC;IAAI9D,SAAA,EAAU;IAAgByE,IAAA,EAAK;4BAClCT,IAAA,CAAC;gBAAE;qBACHA,IAAA,CAAC;MAAID,KAAA,EAAO;QAAEW,KAAA,EAAO;MAAM;gBAAIF,KAAA,CAAMG;;;AAG3C;AAEA,OAAO,MAAMC,QAAA,GAAqCjF,iBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Field.js","names":["FieldDescription","FieldError","FieldLabel","RenderCustomComponent","useEditDepth","useEffectEvent","useField","mergeFieldStyles","React","useCallback","useEffect","useMemo","useRef","useState","ErrorBoundary","LexicalProvider","baseClass","RichTextComponent","props","editorConfig","field","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","editDepth","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","disabledFromField","initialValue","setValue","showError","potentiallyStalePath","isSmallWidthViewport","setIsSmallWidthViewport","rerenderProviderKey","setRerenderProviderKey","prevInitialValueRef","prevValueRef","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","dispatchFieldUpdateTask","undefined","handleChange","editorState","updateFieldValue","newState","toJSON","current","requestIdleCallback","cancelIdleCallback","timeout","styles","handleInitialValueChange","JSON","stringify","Date","Object","is","_jsxs","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","composerKey","fieldProps","onChange","error","role","color","message","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\nimport type { Validate } from 'payload'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n RenderCustomComponent,\n useEditDepth,\n useEffectEvent,\n useField,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\n\nimport '../lexical/theme/EditorTheme.scss'\nimport './bundled.css'\nimport './index.scss'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled: disabledFromField,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || disabledFromField\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n const [rerenderProviderKey, setRerenderProviderKey] = useState<Date>()\n\n const prevInitialValueRef = React.useRef<SerializedEditorState | undefined>(initialValue)\n const prevValueRef = React.useRef<SerializedEditorState | undefined>(value)\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 const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport\n ? `${baseClass}--show-gutter`\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const dispatchFieldUpdateTask = useRef<number>(undefined)\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n const updateFieldValue = (editorState: EditorState) => {\n const newState = editorState.toJSON()\n prevValueRef.current = newState\n setValue(newState)\n }\n\n if (typeof window.requestIdleCallback === 'function') {\n // Cancel earlier scheduled value updates,\n // so that a CPU-limited event loop isn't flooded with n callbacks for n keystrokes into the rich text field,\n // but that there's only ever the latest one state update\n // dispatch task, to be executed with the next idle time,\n // or the deadline of 500ms.\n if (typeof window.cancelIdleCallback === 'function' && dispatchFieldUpdateTask.current) {\n cancelIdleCallback(dispatchFieldUpdateTask.current)\n }\n // Schedule the state update to happen the next time the browser has sufficient resources,\n // or the latest after 500ms.\n dispatchFieldUpdateTask.current = requestIdleCallback(() => updateFieldValue(editorState), {\n timeout: 500,\n })\n } else {\n updateFieldValue(editorState)\n }\n },\n [setValue],\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const handleInitialValueChange = useEffectEvent(\n (initialValue: SerializedEditorState | undefined) => {\n // Object deep equality check here, as re-mounting the editor if\n // the new value is the same as the old one is not necessary\n if (\n prevValueRef.current !== value &&\n JSON.stringify(prevValueRef.current) !== JSON.stringify(value)\n ) {\n prevInitialValueRef.current = initialValue\n prevValueRef.current = value\n setRerenderProviderKey(new Date())\n }\n },\n )\n\n useEffect(() => {\n // Needs to trigger for object reference changes - otherwise,\n // reacting to the same initial value change twice will cause\n // the second change to be ignored, even though the value has changed.\n // That's because initialValue is not kept up-to-date\n if (!Object.is(initialValue, prevInitialValueRef.current)) {\n handleInitialValueChange(initialValue)\n }\n }, [initialValue])\n\n return (\n <div className={classes} key={pathWithEditDepth} style={styles}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {Label || <FieldLabel label={label} localized={localized} path={path} required={required} />}\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n isSmallWidthViewport={isSmallWidthViewport}\n key={JSON.stringify({ path, rerenderProviderKey })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n {Description}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n"],"mappings":"AAAA;;;AAIA,SACEA,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,qBAAqB,EACrBC,YAAY,EACZC,cAAc,EACdC,QAAQ,QACH;AACP,SAASC,gBAAgB,QAAQ;AACjC,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AACzE,SAASC,aAAa,QAAQ;AAK9B,OAAO;AAKP,SAASC,eAAe,QAAQ;AAEhC,MAAMC,SAAA,GAAY;AAElB,MAAMC,iBAAA,GAIDC,KAAA;EACH,MAAM;IACJC,YAAY;IACZC,KAAK;IACLA,KAAA,EAAO;MACLC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC,QAAA,EAAUC;MAAiB,CAAE,GAAG,CAAC,CAAC;MACnEC,KAAK;MACLC,SAAS;MACTC;IAAQ,CACT;IACDC,IAAA,EAAMC,aAAa;IACnBN,QAAA,EAAUO,yBAAyB;IACnCC;EAAQ,CACT,GAAGd,KAAA;EAEJ,MAAMe,iBAAA,GAAoBF,yBAAA,IAA6BN,iBAAA;EAEvD,MAAMS,SAAA,GAAY9B,YAAA;EAElB,MAAM+B,gBAAA,GAAmB1B,WAAA,CACvB,CAAC2B,KAAA,EAAOC,iBAAA;I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A,CAACtF,qBAAA;QACCuF,eAAA,EAAiBjD,WAAA;QACjBkD,QAAA,eAAUF,IAAA,CAACzF,gBAAA;UAAiBuB,WAAA,EAAaA,WAAA;UAAaM,IAAA,EAAMA;;;;KAxBpCuC,iBAAA;AA6BlC;AAEA,SAASwB,eAAe;EAAEK;AAAK,CAAoB;EACjD;EAEA,oBACEV,KAAA,CAAC;IAAIjE,SAAA,EAAU;IAAgB4E,IAAA,EAAK;4BAClCT,IAAA,CAAC;gBAAE;qBACHA,IAAA,CAAC;MAAID,KAAA,EAAO;QAAEW,KAAA,EAAO;MAAM;gBAAIF,KAAA,CAAMG;;;AAG3C;AAEA,OAAO,MAAMC,QAAA,GAAqCpF,iBAAA","ignoreList":[]}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAA;AAclG,eAAO,MAAM,oBAAoB,WAAW,CAAA;AAE5C,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,kBAAkB,GAAG,8BAA8B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAA;AAclG,eAAO,MAAM,oBAAoB,WAAW,CAAA;AAE5C,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,kBAAkB,GAAG,8BAA8B,CAw0BvF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAC1F,OAAO,EACL,sB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F,YAAY,EACV,cAAc,EACd,aAAa,GACd,MAAM,iEAAiE,CAAA;AACxE,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEjE,mBAAmB,gBAAgB,CAAA;AAEnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAExD,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAEpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AAExE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AAC3E,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAA;AAElG,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -379,6 +379,7 @@ export function lexicalEditor(args) {
|
|
|
379
379
|
mergeLocaleActions,
|
|
380
380
|
operation,
|
|
381
381
|
originalDoc,
|
|
382
|
+
overrideAccess,
|
|
382
383
|
parentIsLocalized,
|
|
383
384
|
path,
|
|
384
385
|
previousValue,
|
|
@@ -486,6 +487,7 @@ export function lexicalEditor(args) {
|
|
|
486
487
|
global,
|
|
487
488
|
mergeLocaleActions: mergeLocaleActions,
|
|
488
489
|
operation: operation,
|
|
490
|
+
overrideAccess,
|
|
489
491
|
parentIndexPath: indexPath.join('-'),
|
|
490
492
|
parentIsLocalized: parentIsLocalized || field.localized || false,
|
|
491
493
|
parentPath: path.join('.'),
|