@payloadcms/richtext-lexical 3.35.0-internal.5e55452 → 3.35.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/indent/client/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAwE5D,eAAO,MAAM,mBAAmB,sGAiB9B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/indent/client/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAmE5D,eAAO,MAAM,mBAAmB,sGAiB9B,CAAA"}
@@ -59,10 +59,7 @@ const toolbarGroups = ({
59
59
  if (!nodes?.length) {
60
60
  return false;
61
61
  }
62
- if (nodes.some(node => disabledNodes?.includes(node.getType()))) {
63
- return false;
64
- }
65
- return !$pointsAncestorMatch(selection, node => (disabledNodes ?? []).includes(node.getType()));
62
+ return !nodes.some(node => disabledNodes?.includes(node.getType()));
66
63
  },
67
64
  key: 'indentIncrease',
68
65
  label: ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$findMatchingParent","$isElementNode","$isRangeSelection","INDENT_CONTENT_COMMAND","OUTDENT_CONTENT_COMMAND","IndentDecreaseIcon","IndentIncreaseIcon","createClientFeature","IndentPlugin","toolbarIndentGroupWithItems","toolbarGroups","disabledNodes","ChildComponent","isActive","isEnabled","selection","nodes","getNodes","length","atLeastOneNodeCanOutdent","isIndentable","node","canIndent","getIndent","$pointsAncestorMatch","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","some","includes","getType","IndentFeatureClient","props","plugins","Component","position","sanitizedClientFeatureProps","toolbarFixed","groups","toolbarInline","fn","anchor","getNode","focus"],"sources":["../../../../src/features/indent/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BaseSelection, ElementNode, LexicalNode } from 'lexical'\n\nimport { $findMatchingParent } from '@lexical/utils'\nimport {\n $isElementNode,\n $isRangeSelection,\n INDENT_CONTENT_COMMAND,\n OUTDENT_CONTENT_COMMAND,\n} from 'lexical'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\n\nimport { IndentDecreaseIcon } from '../../../lexical/ui/icons/IndentDecrease/index.js'\nimport { IndentIncreaseIcon } from '../../../lexical/ui/icons/IndentIncrease/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { type IndentFeatureProps } from '../server/index.js'\nimport { IndentPlugin } from './IndentPlugin.js'\nimport { toolbarIndentGroupWithItems } from './toolbarIndentGroup.js'\n\nconst toolbarGroups = ({ disabledNodes }: IndentFeatureProps): ToolbarGroup[] => [\n toolbarIndentGroupWithItems([\n {\n ChildComponent: IndentDecreaseIcon,\n isActive: () => false,\n isEnabled: ({ selection }) => {\n const nodes = selection?.getNodes()\n if (!nodes?.length) {\n return false\n }\n let atLeastOneNodeCanOutdent = false\n const isIndentable = (node: LexicalNode): node is ElementNode =>\n $isElementNode(node) && node.canIndent()\n for (const node of nodes) {\n if (isIndentable(node)) {\n if (node.getIndent() <= 0) {\n return false\n } else {\n atLeastOneNodeCanOutdent = true\n }\n }\n }\n\n if (!atLeastOneNodeCanOutdent) {\n if (\n $pointsAncestorMatch(selection, (node) => isIndentable(node) && node.getIndent() > 0)\n ) {\n return true\n }\n }\n return atLeastOneNodeCanOutdent\n },\n key: 'indentDecrease',\n label: ({ i18n }) => {\n return i18n.t('lexical:indent:decreaseLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, undefined)\n },\n order: 1,\n },\n {\n ChildComponent: IndentIncreaseIcon,\n isActive: () => false,\n isEnabled: ({ selection }) => {\n const nodes = selection?.getNodes()\n if (!nodes?.length) {\n return false\n }\n if (nodes.some((node) => disabledNodes?.includes(node.getType()))) {\n return false\n }\n return !$pointsAncestorMatch(selection, (node) =>\n (disabledNodes ?? []).includes(node.getType()),\n )\n },\n key: 'indentIncrease',\n label: ({ i18n }) => {\n return i18n.t('lexical:indent:increaseLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INDENT_CONTENT_COMMAND, undefined)\n },\n order: 2,\n },\n ]),\n]\n\nexport const IndentFeatureClient = createClientFeature<IndentFeatureProps>(({ props }) => {\n const disabledNodes = props.disabledNodes ?? []\n return {\n plugins: [\n {\n Component: IndentPlugin,\n position: 'normal',\n },\n ],\n sanitizedClientFeatureProps: props,\n toolbarFixed: {\n groups: toolbarGroups({ disabledNodes }),\n },\n toolbarInline: {\n groups: toolbarGroups({ disabledNodes }),\n },\n }\n})\n\nfunction $pointsAncestorMatch(\n selection: BaseSelection,\n fn: (node: LexicalNode) => boolean,\n): boolean {\n return (\n $isRangeSelection(selection) &&\n (!!$findMatchingParent(selection.anchor.getNode(), fn) ||\n !!$findMatchingParent(selection.focus.getNode(), fn))\n )\n}\n"],"mappings":"AAAA;;AAIA,SAASA,mBAAmB,QAAQ;AACpC,SACEC,cAAc,EACdC,iBAAiB,EACjBC,sBAAsB,EACtBC,uBAAuB,QAClB;AAIP,SAASC,kBAAkB,QAAQ;AACnC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,mBAAmB,QAAQ;AAEpC,SAASC,YAAY,QAAQ;AAC7B,SAASC,2BAA2B,QAAQ;AAE5C,MAAMC,aAAA,GAAgBA,CAAC;EAAEC;AAAa,CAAsB,KAAqB,CAC/EF,2BAAA,CAA4B,CAC1B;EACEG,cAAA,EAAgBP,kBAAA;EAChBQ,QAAA,EAAUA,CAAA,KAAM;EAChBC,SAAA,EAAWA,CAAC;IAAEC;EAAS,CAAE;IACvB,MAAMC,KAAA,GAAQD,SAAA,EAAWE,QAAA;IACzB,IAAI,CAACD,KAAA,EAAOE,MAAA,EAAQ;MAClB,OAAO;IACT;IACA,IAAIC,wBAAA,GAA2B;IAC/B,MAAMC,YAAA,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CAAKC,CAAC,CAAC;EAChB;EACAC,QAAA,EAAUA,CAAC;IAAEC;EAAM,CAAE;IACnBA,MAAA,CAAOC,eAAe,CAAC5B,sBAAA,EAAwB6B,SAAA;EACjD;EACAC,KAAA,EAAO;AACT,EACD,EACF;AAED,OAAO,MAAMI,mBAAA,GAAsB9B,mBAAA,CAAwC,CAAC;EAAE+B;AAAK,CAAE;EACnF,MAAM3B,aAAA,GAAgB2B,KAAA,CAAM3B,aAAa,IAAI,EAAE;EAC/C,OAAO;IACL4B,OAAA,EAAS,CACP;MACEC,SAAA,EAAWhC,YAAA;MACXiC,QAAA,EAAU;IACZ,EACD;IACDC,2BAAA,EAA6BJ,KAAA;IAC7BK,YAAA,EAAc;MACZC,MAAA,EAAQlC,aAAA,CAAc;QAAEC;MAAc;IACxC;IACAkC,aAAA,EAAe;MACbD,MAAA,EAAQlC,aAAA,CAAc;QAAEC;MAAc;IACxC;EACF;AACF;AAEA,SAASa,qBACPT,SAAwB,EACxB+B,EAAkC;EAElC,OACE5C,iBAAA,CAAkBa,SAAA,MACjB,CAAC,CAACf,mBAAA,CAAoBe,SAAA,CAAUgC,MAAM,CAACC,OAAO,IAAIF,EAAA,KACjD,CAAC,CAAC9C,mBAAA,CAAoBe,SAAA,CAAUkC,KAAK,CAACD,OAAO,IAAIF,EAAA,CAAE;AAEzD","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$findMatchingParent","$isElementNode","$isRangeSelection","INDENT_CONTENT_COMMAND","OUTDENT_CONTENT_COMMAND","IndentDecreaseIcon","IndentIncreaseIcon","createClientFeature","IndentPlugin","toolbarIndentGroupWithItems","toolbarGroups","disabledNodes","ChildComponent","isActive","isEnabled","selection","nodes","getNodes","length","atLeastOneNodeCanOutdent","isIndentable","node","canIndent","getIndent","$pointsAncestorMatch","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","some","includes","getType","IndentFeatureClient","props","plugins","Component","position","sanitizedClientFeatureProps","toolbarFixed","groups","toolbarInline","fn","anchor","getNode","focus"],"sources":["../../../../src/features/indent/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BaseSelection, ElementNode, LexicalNode } from 'lexical'\n\nimport { $findMatchingParent } from '@lexical/utils'\nimport {\n $isElementNode,\n $isRangeSelection,\n INDENT_CONTENT_COMMAND,\n OUTDENT_CONTENT_COMMAND,\n} from 'lexical'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\n\nimport { IndentDecreaseIcon } from '../../../lexical/ui/icons/IndentDecrease/index.js'\nimport { IndentIncreaseIcon } from '../../../lexical/ui/icons/IndentIncrease/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { type IndentFeatureProps } from '../server/index.js'\nimport { IndentPlugin } from './IndentPlugin.js'\nimport { toolbarIndentGroupWithItems } from './toolbarIndentGroup.js'\n\nconst toolbarGroups = ({ disabledNodes }: IndentFeatureProps): ToolbarGroup[] => [\n toolbarIndentGroupWithItems([\n {\n ChildComponent: IndentDecreaseIcon,\n isActive: () => false,\n isEnabled: ({ selection }) => {\n const nodes = selection?.getNodes()\n if (!nodes?.length) {\n return false\n }\n let atLeastOneNodeCanOutdent = false\n const isIndentable = (node: LexicalNode): node is ElementNode =>\n $isElementNode(node) && node.canIndent()\n for (const node of nodes) {\n if (isIndentable(node)) {\n if (node.getIndent() <= 0) {\n return false\n } else {\n atLeastOneNodeCanOutdent = true\n }\n }\n }\n\n if (!atLeastOneNodeCanOutdent) {\n if (\n $pointsAncestorMatch(selection, (node) => isIndentable(node) && node.getIndent() > 0)\n ) {\n return true\n }\n }\n return atLeastOneNodeCanOutdent\n },\n key: 'indentDecrease',\n label: ({ i18n }) => {\n return i18n.t('lexical:indent:decreaseLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, undefined)\n },\n order: 1,\n },\n {\n ChildComponent: IndentIncreaseIcon,\n isActive: () => false,\n isEnabled: ({ selection }) => {\n const nodes = selection?.getNodes()\n if (!nodes?.length) {\n return false\n }\n return !nodes.some((node) => disabledNodes?.includes(node.getType()))\n },\n key: 'indentIncrease',\n label: ({ i18n }) => {\n return i18n.t('lexical:indent:increaseLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INDENT_CONTENT_COMMAND, undefined)\n },\n order: 2,\n },\n ]),\n]\n\nexport const IndentFeatureClient = createClientFeature<IndentFeatureProps>(({ props }) => {\n const disabledNodes = props.disabledNodes ?? []\n return {\n plugins: [\n {\n Component: IndentPlugin,\n position: 'normal',\n },\n ],\n sanitizedClientFeatureProps: props,\n toolbarFixed: {\n groups: toolbarGroups({ disabledNodes }),\n },\n toolbarInline: {\n groups: toolbarGroups({ disabledNodes }),\n },\n }\n})\n\nfunction $pointsAncestorMatch(\n selection: BaseSelection,\n fn: (node: LexicalNode) => boolean,\n): boolean {\n return (\n $isRangeSelection(selection) &&\n (!!$findMatchingParent(selection.anchor.getNode(), fn) ||\n !!$findMatchingParent(selection.focus.getNode(), fn))\n )\n}\n"],"mappings":"AAAA;;AAIA,SAASA,mBAAmB,QAAQ;AACpC,SACEC,cAAc,EACdC,iBAAiB,EACjBC,sBAAsB,EACtBC,uBAAuB,QAClB;AAIP,SAASC,kBAAkB,QAAQ;AACnC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,mBAAmB,QAAQ;AAEpC,SAASC,YAAY,QAAQ;AAC7B,SAASC,2BAA2B,QAAQ;AAE5C,MAAMC,aAAA,GAAgBA,CAAC;EAAEC;AAAa,CAAsB,KAAqB,CAC/EF,2BAAA,CAA4B,CAC1B;EACEG,cAAA,EAAgBP,kBAAA;EAChBQ,QAAA,EAAUA,CAAA,KAAM;EAChBC,SAAA,EAAWA,CAAC;IAAEC;EAAS,CAAE;IACvB,MAAMC,KAAA,GAAQD,SAAA,EAAWE,QAAA;IACzB,IAAI,CAACD,KAAA,EAAOE,MAAA,EAAQ;MAClB,OAAO;IACT;IACA,IAAIC,wBAAA,GAA2B;IAC/B,MAAMC,YAAA,GAAgBC,IAA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EACD,EACF;AAED,OAAO,MAAMI,mBAAA,GAAsB9B,mBAAA,CAAwC,CAAC;EAAE+B;AAAK,CAAE;EACnF,MAAM3B,aAAA,GAAgB2B,KAAA,CAAM3B,aAAa,IAAI,EAAE;EAC/C,OAAO;IACL4B,OAAA,EAAS,CACP;MACEC,SAAA,EAAWhC,YAAA;MACXiC,QAAA,EAAU;IACZ,EACD;IACDC,2BAAA,EAA6BJ,KAAA;IAC7BK,YAAA,EAAc;MACZC,MAAA,EAAQlC,aAAA,CAAc;QAAEC;MAAc;IACxC;IACAkC,aAAA,EAAe;MACbD,MAAA,EAAQlC,aAAA,CAAc;QAAEC;MAAc;IACxC;EACF;AACF;AAEA,SAASa,qBACPT,SAAwB,EACxB+B,EAAkC;EAElC,OACE5C,iBAAA,CAAkBa,SAAA,MACjB,CAAC,CAACf,mBAAA,CAAoBe,SAAA,CAAUgC,MAAM,CAACC,OAAO,IAAIF,EAAA,KACjD,CAAC,CAAC9C,mBAAA,CAAoBe,SAAA,CAAUkC,KAAK,CAACD,OAAO,IAAIF,EAAA,CAAE;AAEzD","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,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,CAiK9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAqC,CAAA"}
1
+ {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,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,CAgK9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAqC,CAAA"}
@@ -13,7 +13,6 @@ const RichTextComponent = props => {
13
13
  editorConfig,
14
14
  field,
15
15
  field: {
16
- name,
17
16
  admin: {
18
17
  className,
19
18
  description,
@@ -28,7 +27,6 @@ const RichTextComponent = props => {
28
27
  validate
29
28
  } = props;
30
29
  const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin;
31
- const path = pathFromProps ?? name;
32
30
  const editDepth = useEditDepth();
33
31
  const memoizedValidate = useCallback((value, validationOptions) => {
34
32
  if (typeof validate === 'function') {
@@ -54,11 +52,12 @@ const RichTextComponent = props => {
54
52
  } = {},
55
53
  disabled: disabledFromField,
56
54
  initialValue,
55
+ path,
57
56
  setValue,
58
57
  showError,
59
58
  value: value_0
60
59
  } = useField({
61
- path,
60
+ potentiallyStalePath: pathFromProps,
62
61
  validate: memoizedValidate
63
62
  });
64
63
  const disabled = readOnlyFromProps || disabledFromField;
@@ -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","name","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","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 name,\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 const path = pathFromProps ?? name\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 setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n path,\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;;;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,QAAQ,QAAQ;AACjE,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,IAAI;MACJC,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,GAAGf,KAAA;EAEJ,MAAMgB,iBAAA,GAAoBF,yBAAA,IAA6BN,iBAAA;EACvD,MAAMI,IAAA,GAAOC,aAAA,IAAiBV,IAAA;EAE9B,MAAMc,SAAA,GAAY9B,YAAA;EAElB,MAAM+B,gBAAA,GAAmB1B,WAAA,CACvB,CAAC2B,KAAA,EAAOC,iBAAA;IACN,IAAI,OAAOL,QAAA,KAAa,YAAY;MAClC;MACA,OAAOA,QAAA,CAASI,KAAA,EAAO;QAAE,GAAGC,iBAAiB;QAAET;MAAS;IAC1D;IACA,OAAO;EACT;EACA;EACA;EACA;EACA,CAACI,QAAA,EAAUJ,QAAA,CAAS;EAGtB,MAAM;IACJU,gBAAA,EAAkB;MAAEC,UAAU;MAAEC,WAAW;MAAEC,WAAW;MAAEC,KA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AWA;;QAE9CL,KAAA,iBAAS0C,IAAA,CAACnF,UAAA;MAAWwB,KAAA,EAAOA,KAAA;MAAOC,SAAA,EAAWA,SAAA;MAAWE,IAAA,EAAMA,IAAA;MAAMD,QAAA,EAAUA;qBAChFuD,KAAA,CAAC;MAAI7D,SAAA,EAAW,GAAGP,SAAA,QAAiB;8BAClCoE,KAAA,CAACtE,aAAA;QAAc2E,cAAA,EAAgBA,cAAA;QAAgBC,OAAA,EAASA,CAAA,MAAO;mBAC5DjD,WAAA,E,aACD6C,IAAA,CAACvE,eAAA;UACC4E,WAAA,EAAatB,iBAAA;UACblD,YAAA,EAAcA,YAAA;UACdyE,UAAA,EAAY1E,KAAA;UACZgC,oBAAA,EAAsBA,oBAAA;UAEtB2C,QAAA,EAAUlB,YAAA;UACVlD,QAAA,EAAUoB,QAAA;UACVR,KAAA,EAAOA;WAHF0C,IAAA,CAAKC,SAAS,CAAC;UAAElD,IAAA;UAAMsB;QAAoB,KAKjDZ,UAAA;UAEFE,WAAA,E,aACD4C,IAAA,CAAClF,qBAAA;QACCmF,eAAA,EAAiB7C,WAAA;QACjB8C,QAAA,eAAUF,IAAA,CAACrF,gBAAA;UAAiBuB,WAAA,EAAaA,WAAA;UAAaM,IAAA,EAAMA;;;;KAxBpCuC,iBAAA;AA6BlC;AAEA,SAASoB,eAAe;EAAEK;AAAK,CAAoB;EACjD;EAEA,oBACEV,KAAA,CAAC;IAAI7D,SAAA,EAAU;IAAgBwE,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","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;;;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,QAAQ,QAAQ;AACjE,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,GAAY7B,YAAA;EAElB,MAAM8B,gBAAA,GAAmBzB,WAAA,CACvB,CAAC0B,KAAA,EAAOC,iBAAA;IACN,IAAI,OAAOL,QAAA,KAAa,YAAY;MAClC;MACA,OAAOA,QAAA,CAASI,KAAA,EAAO;QAAE,GAAGC,iBAAiB;QAAET;MAAS;IAC1D;IACA,OAAO;EACT;EACA;EACA;EACA;EACA,CAACI,QAAA,EAAUJ,QAAA,CAAS;EAGtB,MAAM;IACJU,gBAAA,EAAkB;MAAEC,UAAU;MAAEC,WAAW;MAA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