@payloadcms/richtext-lexical 3.0.0-beta.90 → 3.0.0-beta.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/exports/client/Field-SUWHJ4HF.js +2 -0
  2. package/dist/exports/client/Field-SUWHJ4HF.js.map +7 -0
  3. package/dist/exports/client/RelationshipComponent-EZORSGUZ.js +2 -0
  4. package/dist/exports/client/RelationshipComponent-EZORSGUZ.js.map +7 -0
  5. package/dist/exports/client/bundled.css +1 -1
  6. package/dist/exports/client/{chunk-NI6Z4GBD.js → chunk-OLSILJA6.js} +1 -1
  7. package/dist/exports/client/{chunk-NI6Z4GBD.js.map → chunk-OLSILJA6.js.map} +1 -1
  8. package/dist/exports/client/{chunk-G5DTIOPI.js → chunk-TD7O23AB.js} +2 -2
  9. package/dist/exports/client/{chunk-G5DTIOPI.js.map → chunk-TD7O23AB.js.map} +2 -2
  10. package/dist/exports/client/{chunk-LGUXX2QH.js → chunk-UJDWBQ2K.js} +2 -2
  11. package/dist/exports/client/{chunk-LGUXX2QH.js.map → chunk-UJDWBQ2K.js.map} +2 -2
  12. package/dist/exports/client/{chunk-OKMIHD2R.js → chunk-YL453UOS.js} +2 -2
  13. package/dist/exports/client/chunk-YSI2QILQ.js +2 -0
  14. package/dist/exports/client/{chunk-TO2W7Q2G.js.map → chunk-YSI2QILQ.js.map} +2 -2
  15. package/dist/exports/client/component-2YLEVOFH.js +2 -0
  16. package/dist/exports/client/component-2YLEVOFH.js.map +7 -0
  17. package/dist/exports/client/{component-LCAAX56T.js → component-7RAP75FW.js} +2 -2
  18. package/dist/exports/client/{componentInline-72VZAAHP.js → componentInline-YSHGRL2J.js} +2 -2
  19. package/dist/exports/client/index.js +12 -12
  20. package/dist/exports/client/index.js.map +3 -3
  21. package/dist/features/debug/testRecorder/client/plugin/index.js +187 -363
  22. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  23. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +234 -470
  24. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  25. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +3 -16
  26. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  27. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +59 -123
  28. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  29. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  30. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +5 -3
  31. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  32. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  33. package/dist/features/link/server/baseFields.js +12 -2
  34. package/dist/features/link/server/baseFields.js.map +1 -1
  35. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js +1 -1
  36. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +1 -1
  37. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  38. package/dist/features/relationship/client/components/RelationshipComponent.js +8 -5
  39. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  40. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +6 -4
  41. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  42. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  43. package/dist/features/toolbars/inline/client/Toolbar/index.js +53 -94
  44. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  45. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  46. package/dist/features/upload/client/component/index.js +3 -0
  47. package/dist/features/upload/client/component/index.js.map +1 -1
  48. package/dist/features/upload/server/nodes/UploadNode.d.ts +9 -7
  49. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  50. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  51. package/dist/field/bundled.css +1 -1
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +8 -19
  54. package/dist/index.js.map +1 -1
  55. package/dist/lexical/config/client/EditorConfigProvider.js +1 -1
  56. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  57. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +71 -109
  58. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  59. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +96 -135
  60. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  61. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  62. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +114 -139
  63. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  64. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts.map +1 -1
  65. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +7 -25
  66. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
  67. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  68. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +4 -6
  69. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  70. package/dist/lexical/ui/icons/Caret/index.svg +2 -2
  71. package/dist/lexical/utils/setFloatingElemPosition.js +1 -1
  72. package/dist/lexical/utils/setFloatingElemPosition.js.map +1 -1
  73. package/dist/lexical/utils/url.d.ts +5 -0
  74. package/dist/lexical/utils/url.d.ts.map +1 -1
  75. package/dist/lexical/utils/url.js +7 -0
  76. package/dist/lexical/utils/url.js.map +1 -1
  77. package/dist/utilities/migrateSlateToLexical/index.d.ts.map +1 -1
  78. package/dist/utilities/migrateSlateToLexical/index.js +16 -1
  79. package/dist/utilities/migrateSlateToLexical/index.js.map +1 -1
  80. package/package.json +13 -13
  81. package/dist/exports/client/Field-63NGLPJB.js +0 -2
  82. package/dist/exports/client/Field-63NGLPJB.js.map +0 -7
  83. package/dist/exports/client/RelationshipComponent-3QWBV4GT.js +0 -2
  84. package/dist/exports/client/RelationshipComponent-3QWBV4GT.js.map +0 -7
  85. package/dist/exports/client/chunk-TO2W7Q2G.js +0 -2
  86. package/dist/exports/client/component-3OFD6Q4Z.js +0 -2
  87. package/dist/exports/client/component-3OFD6Q4Z.js.map +0 -7
  88. /package/dist/exports/client/{chunk-OKMIHD2R.js.map → chunk-YL453UOS.js.map} +0 -0
  89. /package/dist/exports/client/{component-LCAAX56T.js.map → component-7RAP75FW.js.map} +0 -0
  90. /package/dist/exports/client/{componentInline-72VZAAHP.js.map → componentInline-YSHGRL2J.js.map} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/upload/client/component/index.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { ClientCollectionConfig, Data } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js'\nimport { mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n DrawerToggler,\n File,\n formatDrawerSlug,\n useConfig,\n useDocumentDrawer,\n useEditDepth,\n useModal,\n usePayloadAPI,\n useTranslation,\n} from '@payloadcms/ui'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\nimport React, { useCallback, useEffect, useId, useReducer, useRef, useState } from 'react'\n\nimport type { ClientComponentProps } from '../../../typesClient.js'\nimport type { UploadData } from '../../server/nodes/UploadNode.js'\nimport type { UploadFeaturePropsClient } from '../feature.client.js'\nimport type { UploadNode } from '../nodes/UploadNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../utilities/fieldsDrawer/Drawer.js'\nimport { EnabledRelationshipsCondition } from '../../../relationship/client/utils/EnabledRelationshipsCondition.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport { $isUploadNode } from '../nodes/UploadNode.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-upload'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n data: UploadData\n nodeKey: string\n}\n\nconst Component: React.FC<ElementProps> = (props) => {\n const {\n data: { fields, relationTo, value },\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.',\n )\n }\n\n const {\n config: {\n collections,\n routes: { api },\n serverURL,\n },\n } = useConfig()\n const uploadRef = useRef<HTMLDivElement | null>(null)\n const { closeModal } = useModal()\n const { uuid } = useEditorConfigContext()\n const editDepth = useEditDepth()\n const [editor] = useLexicalComposerContext()\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n\n const { editorConfig, field } = useEditorConfigContext()\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [relatedCollection] = useState<ClientCollectionConfig>(() =>\n collections.find((coll) => coll.slug === relationTo),\n )\n\n const componentID = useId()\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-upload-drawer-` + uuid + componentID, // There can be multiple upload components, each with their own drawer, in one single editor => separate them by componentID\n depth: editDepth,\n })\n\n const [DocumentDrawer, DocumentDrawerToggler, { closeDrawer }] = useDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n // Get the referenced document\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value}`,\n { initialParams },\n )\n\n const thumbnailSRC = data?.thumbnailURL || data?.url\n\n const removeUpload = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n const updateUpload = useCallback(\n (data: Data) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n dispatchCacheBust()\n closeDrawer()\n },\n [setParams, cacheBust, closeDrawer],\n )\n\n const $onDelete = useCallback(\n (event: KeyboardEvent) => {\n if (isSelected && $isNodeSelection($getSelection())) {\n event.preventDefault()\n const node = $getNodeByKey(nodeKey)\n if ($isUploadNode(node)) {\n node.remove()\n return true\n }\n }\n return false\n },\n [isSelected, nodeKey],\n )\n const onClick = useCallback(\n (event: MouseEvent) => {\n // Check if uploadRef.target or anything WITHIN uploadRef.target was clicked\n if (event.target === uploadRef.current || uploadRef.current?.contains(event.target as Node)) {\n if (event.shiftKey) {\n setSelected(!isSelected)\n } else {\n if (!isSelected) {\n clearSelection()\n setSelected(true)\n }\n }\n return true\n }\n\n return false\n },\n [isSelected, setSelected, clearSelection],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(CLICK_COMMAND, onClick, COMMAND_PRIORITY_LOW),\n\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected, onClick])\n\n const hasExtraFields = (\n editorConfig?.resolvedFeatureMap?.get('upload')\n ?.sanitizedClientFeatureProps as ClientComponentProps<UploadFeaturePropsClient>\n ).collections?.[relatedCollection.slug]?.hasExtraFields\n\n const onExtraFieldsDrawerSubmit = useCallback(\n (_, data) => {\n // Update lexical node (with key nodeKey) with new data\n editor.update(() => {\n const uploadNode: UploadNode | null = $getNodeByKey(nodeKey)\n if (uploadNode) {\n const newData: UploadData = {\n ...uploadNode.getData(),\n fields: data,\n }\n uploadNode.setData(newData)\n }\n })\n\n closeModal(drawerSlug)\n },\n [closeModal, editor, drawerSlug, nodeKey],\n )\n\n return (\n <div\n className={[baseClass, isSelected && `${baseClass}--selected`].filter(Boolean).join(' ')}\n contentEditable={false}\n ref={uploadRef}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__topRow`}>\n {/* TODO: migrate to use @payloadcms/ui/elements/Thumbnail component */}\n <div className={`${baseClass}__thumbnail`}>\n {thumbnailSRC ? (\n <img\n alt={data?.filename}\n data-lexical-upload-id={value}\n data-lexical-upload-relation-to={relationTo}\n src={thumbnailSRC}\n />\n ) : (\n <File />\n )}\n </div>\n <div className={`${baseClass}__topRowRightPanel`}>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n {hasExtraFields ? (\n <DrawerToggler\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={field?.admin?.readOnly}\n slug={drawerSlug}\n >\n <Button\n buttonStyle=\"icon-label\"\n el=\"div\"\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n }}\n round\n tooltip={t('fields:editRelationship')}\n />\n </DrawerToggler>\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n disabled={field?.admin?.readOnly}\n el=\"div\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapUpload')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.admin?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n tooltip={t('fields:removeUpload')}\n />\n </div>\n )}\n </div>\n </div>\n <div className={`${baseClass}__bottomRow`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong>{data?.filename}</strong>\n </DocumentDrawerToggler>\n </div>\n </div>\n {value && <DocumentDrawer onSave={updateUpload} />}\n {hasExtraFields ? (\n <FieldsDrawer\n data={fields}\n drawerSlug={drawerSlug}\n drawerTitle={t('general:editLabel', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n featureKey=\"upload\"\n handleDrawerSubmit={onExtraFieldsDrawerSubmit}\n schemaPathSuffix={relatedCollection.slug}\n />\n ) : null}\n </div>\n )\n}\n\nexport const UploadComponent = (props: ElementProps): React.ReactNode => {\n return (\n <EnabledRelationshipsCondition {...props} uploads>\n <Component {...props} />\n </EnabledRelationshipsCondition>\n )\n}\n"],
5
+ "mappings": "oKAGA,OAASA,6BAAAA,OAAiC,2CAC1C,OAASC,2BAAAA,OAA+B,4CACxC,OAASC,iBAAAA,OAAqB,iBAC9B,OAASC,kBAAAA,MAAsB,2BAC/B,OACEC,UAAAA,EACAC,iBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,aAAAA,GACAC,qBAAAA,GACAC,gBAAAA,GACAC,YAAAA,GACAC,iBAAAA,GACAC,kBAAAA,OACK,iBACP,OACEC,iBAAAA,EACAC,iBAAAA,GACAC,oBAAAA,GACAC,iBAAAA,GACAC,wBAAAA,EACAC,yBAAAA,GACAC,sBAAAA,OACK,UACP,OAAgBC,eAAAA,EAAaC,aAAAA,GAAWC,SAAAA,GAAOC,cAAAA,GAAYC,UAAAA,GAAQC,YAAAA,OAAgB,QAcnF,IAAMC,EAAY,iBAEZC,EAAgB,CACpBC,MAAO,CACT,EAOMC,GAAqCC,GAAA,CACzC,GAAM,CACJC,KAAM,CAAEC,OAAAA,EAAQC,WAAAA,EAAYC,MAAAA,CAAK,EACjCC,QAAAA,CAAO,EACLL,EAEJ,GAAI,OAAOI,GAAU,SACnB,MAAM,IAAIE,MACR,wHAAA,EAIJ,GAAM,CACJC,OAAQ,CACNC,YAAAA,EACAC,OAAQ,CAAEC,IAAAA,CAAG,EACbC,UAAAA,CAAS,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AK,GACLC,QAASvF,EAAE,qBAAA,aAMrBoE,EAAC,MAAA,CAAIN,UAAW,GAAGhG,CAAA,uBACjBsG,EAACpD,EAAA,CAAsB8C,UAAW,GAAGhG,CAAA,gCACnCsG,EAAC,SAAA,UAAQjG,GAAMmG,kBAIpBhG,GAAS8F,EAACrD,EAAA,CAAe4E,OAAQ5D,IACjCoB,EACCiB,EAACwB,EAAA,CACCzH,KAAMC,EACNyC,WAAYA,EACZgF,YAAa7F,EAAE,oBAAqB,CAClC8F,MAAOrB,EAAenE,EAAkBoE,OAAOC,SAAU5E,CAAA,CAC3D,CAAA,EACAgG,WAAW,SACXC,mBAAoBzC,EACpB0C,iBAAkB3F,EAAkBI,OAEpC,IAAA,GAGV,EAEawF,GAAmBhI,GAE5BkG,EAAC+B,EAAA,CAA+B,GAAGjI,EAAOkI,QAAO,YAC/ChC,EAACnG,GAAA,CAAW,GAAGC",
6
+ "names": ["useLexicalComposerContext", "useLexicalNodeSelection", "mergeRegister", "getTranslation", "Button", "DrawerToggler", "File", "formatDrawerSlug", "useConfig", "useDocumentDrawer", "useEditDepth", "useModal", "usePayloadAPI", "useTranslation", "$getNodeByKey", "$getSelection", "$isNodeSelection", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_BACKSPACE_COMMAND", "KEY_DELETE_COMMAND", "useCallback", "useEffect", "useId", "useReducer", "useRef", "useState", "baseClass", "initialParams", "depth", "Component", "props", "data", "fields", "relationTo", "value", "nodeKey", "Error", "config", "collections", "routes", "api", "serverURL", "useConfig", "uploadRef", "useRef", "closeModal", "useModal", "uuid", "useEditorConfigContext", "editDepth", "useEditDepth", "editor", "useLexicalComposerContext", "isSelected", "setSelected", "clearSelection", "useLexicalNodeSelection", "editorConfig", "field", "i18n", "t", "useTranslation", "cacheBust", "dispatchCacheBust", "useReducer", "state", "relatedCollection", "useState", "find", "coll", "slug", "componentID", "useId", "drawerSlug", "formatDrawerSlug", "DocumentDrawer", "DocumentDrawerToggler", "closeDrawer", "useDocumentDrawer", "id", "collectionSlug", "setParams", "usePayloadAPI", "thumbnailSRC", "thumbnailURL", "url", "removeUpload", "useCallback", "update", "$getNodeByKey", "remove", "updateUpload", "$onDelete", "event", "$isNodeSelection", "$getSelection", "preventDefault", "node", "$isUploadNode", "onClick", "target", "current", "contains", "shiftKey", "useEffect", "mergeRegister", "registerCommand", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_DELETE_COMMAND", "KEY_BACKSPACE_COMMAND", "hasExtraFields", "resolvedFeatureMap", "get", "sanitizedClientFeatureProps", "onExtraFieldsDrawerSubmit", "_", "uploadNode", "newData", "getData", "setData", "_jsxs", "className", "filter", "Boolean", "join", "contentEditable", "ref", "_jsx", "alt", "filename", "src", "File", "getTranslation", "labels", "singular", "isEditable", "DrawerToggler", "disabled", "admin", "readOnly", "Button", "buttonStyle", "el", "icon", "e", "round", "tooltip", "dispatchCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND", "replace", "onSave", "FieldsDrawer", "drawerTitle", "label", "featureKey", "handleDrawerSubmit", "schemaPathSuffix", "UploadComponent", "EnabledRelationshipsCondition", "uploads"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use client";import{b as T}from"./chunk-NI6Z4GBD.js";import{jsx as f,jsxs as le}from"react/jsx-runtime";import{Collapsible as se,Form as ie,Pill as ne,RenderComponent as ae,SectionTitle as re,ShimmerEffect as ce,useConfig as de,useDocumentInfo as me,useFieldProps as ue,useFormSubmitted as fe,useTranslation as pe}from"@payloadcms/ui";import{useCallback as be,useEffect as he,useMemo as ke,useState as ye}from"react";import{getTranslation as _e}from"@payloadcms/translations";import{getFormState as I}from"@payloadcms/ui/shared";import{v4 as Ce}from"uuid";import{jsx as k,jsxs as B}from"react/jsx-runtime";import{useLexicalComposerContext as q}from"@lexical/react/LexicalComposerContext.js";import{getTranslation as H}from"@payloadcms/translations";import{Button as W,Collapsible as z,ErrorPill as G,Pill as J,RenderComponent as Q,RenderFields as X,SectionTitle as Y,useDocumentInfo as Z,useFormSubmitted as ee,useTranslation as oe}from"@payloadcms/ui";import{dequal as te}from"dequal/lite";import{$getNodeByKey as O}from"lexical";import A,{useCallback as E}from"react";import{c as K}from"react/compiler-runtime";import{useAllFormFields as V}from"@payloadcms/ui";import{reduceFieldsToValues as D}from"payload/shared";import{useEffect as M}from"react";function w({fields:i}){for(let e in i){let o=i[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return i}var j=i=>{let e=K(8),{onChange:o}=i,[l]=V(),d,s;e[0]!==l?(s=w({fields:l}),d=D(s,!0),e[0]=l,e[1]=d,e[2]=s):(d=e[1],s=e[2]);let m=d,t,a;return e[3]!==o||e[4]!==s||e[5]!==m?(t=()=>{o&&o({fullFieldsWithValues:s,newFormData:m})},a=[m,o,s],e[3]=o,e[4]=s,e[5]=m,e[6]=t,e[7]=a):(t=e[6],a=e[7]),M(t,a),null};function L(i){for(let e in i){let o=i[e];Array.isArray(o)&&!o?.length?delete i[e]:o&&typeof o=="object"?L(o):o==null&&delete i[e]}}var U=i=>{let{baseClass:e,clientBlock:o,field:l,formSchema:d,nodeKey:s,schemaPath:m}=i,{formData:t}=i,{i18n:a}=oe(),[u]=q(),{getDocPreferences:x,setDocFieldPreferences:P}=Z(),[p,N]=A.useState(()=>{let r=!1;return x().then(c=>{let h=c?.fields[l.name]?.collapsed;h&&h.includes(t.id)&&(r=!0,N(!0))}),r}),F=ee(),[n,S]=A.useState(0),C=F&&n>0,$=[`${e}__row`,C?`${e}__row--has-errors`:`${e}__row--no-errors`].filter(Boolean).join(" "),R=E(({fullFieldsWithValues:r,newFormData:c})=>{if(c.id=t.id,c.blockType=t.blockType,L(c),L(t),te(t,c)||setTimeout(()=>{u.update(()=>{let _=O(s);_&&(t=c,_.setFields(c))})},0),F){let _=0;for(let h of Object.values(r))h?.valid===!1&&_++;S(_)}},[u,s,F,t]),v=E(r=>{x().then(c=>{let h=c?.fields[l.name]?.collapsed,g=h&&h?.length?h:[];r?g.includes(t.id)||g.push(t.id):g.includes(t.id)&&g.splice(g.indexOf(t.id),1),P(l.name,{collapsed:g,hello:"hi"})})},[x,l.name,P,t.id]),b=E(()=>{u.update(()=>{O(s).remove()})},[u,s]);return B(A.Fragment,{children:[k(z,{className:$,collapsibleStyle:C?"error":"default",header:o?.admin?.components?.Label?k(Q,{clientProps:{blockKind:"lexicalBlock",formData:t},mappedComponent:o.admin.components.Label}):B("div",{className:`${e}__block-header`,children:[B("div",{children:[k(J,{className:`${e}__block-pill ${e}__block-pill-${t?.blockType}`,pillStyle:"white",children:typeof o?.labels.singular=="string"?H(o?.labels.singular,a):o.slug}),k(Y,{path:"blockName",readOnly:l?.admin?.readOnly}),C&&k(G,{count:n,i18n:a,withMessage:!0})]}),u.isEditable()&&k(W,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:l?.admin?.readOnly,icon:"x",onClick:r=>{r.preventDefault(),b()},round:!0,tooltip:"Remove Block"})]}),isCollapsed:p,onToggle:r=>{v(r),N(r)},children:k(X,{className:`${e}__fields`,fields:d,forceRender:!0,margins:"small",path:"",readOnly:!1,schemaPath:m})},0),k(j,{onChange:R})]})};var y="lexical-block",We=i=>{let{formData:e,nodeKey:o}=i,{config:l}=de(),d=fe(),{id:s}=me(),{path:m,schemaPath:t}=ue(),{field:a}=T(),[u,x]=ye(!1),{field:{richTextComponentMap:P}}=T(),p=`${t}.lexical_internal_feature.blocks.lexical_blocks.lexical_blocks.${e.blockType}`,n=P.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(v=>v.slug===e.blockType);he(()=>{e&&(async()=>{let b=await I({apiRoute:l.routes.api,body:{id:s,data:e,operation:"update",schemaPath:p},serverURL:l.serverURL});b&&(b.blockName={initialValue:"",passesCondition:!0,valid:!0,value:e.blockName},x(b))})()},[l.routes.api,l.serverURL,p,s]);let S=be(async({formState:v})=>{let b=await I({apiRoute:l.routes.api,body:{id:s,formState:v,operation:"update",schemaPath:p},serverURL:l.serverURL});return b.blockName={initialValue:"",passesCondition:!0,valid:!0,value:e.blockName},b},[l.routes.api,l.serverURL,s,p,e.blockName]),{i18n:C}=pe(),$=[`${y}__row`,`${y}__row--no-errors`].filter(Boolean).join(" "),R=ke(()=>n&&u!==!1?f(ie,{beforeSubmit:[S],fields:n.fields,initialState:u,onChange:[S],submitted:d,uuid:Ce(),children:f(U,{baseClass:y,clientBlock:n,field:a,formData:e,formSchema:n.fields,nodeKey:o,path:`${m}.lexical_internal_feature.blocks.${e.blockType}`,schemaPath:p})}):f(se,{className:$,collapsibleStyle:"default",header:n?.admin?.components?.Label?f(ae,{clientProps:{blockKind:"lexicalBlock",formData:e},mappedComponent:n.admin.components.Label}):f("div",{className:`${y}__block-header`,children:le("div",{children:[f(ne,{className:`${y}__block-pill ${y}__block-pill-${e?.blockType}`,pillStyle:"white",children:n&&typeof n.labels.singular=="string"?_e(n.labels.singular,C):n.slug}),f(re,{path:"blockName",readOnly:a?.admin?.readOnly})]})}),children:f(ce,{height:"35vh"})},0),[n,u,S,d,a,o,m,p,$,C]);return f("div",{className:y+" "+y+"-"+e.blockType,children:R})};export{We as BlockComponent};
2
- //# sourceMappingURL=component-LCAAX56T.js.map
1
+ "use client";import{b as T}from"./chunk-OLSILJA6.js";import{jsx as f,jsxs as le}from"react/jsx-runtime";import{Collapsible as se,Form as ie,Pill as ne,RenderComponent as ae,SectionTitle as re,ShimmerEffect as ce,useConfig as de,useDocumentInfo as me,useFieldProps as ue,useFormSubmitted as fe,useTranslation as pe}from"@payloadcms/ui";import{useCallback as be,useEffect as he,useMemo as ke,useState as ye}from"react";import{getTranslation as _e}from"@payloadcms/translations";import{getFormState as I}from"@payloadcms/ui/shared";import{v4 as Ce}from"uuid";import{jsx as k,jsxs as B}from"react/jsx-runtime";import{useLexicalComposerContext as q}from"@lexical/react/LexicalComposerContext.js";import{getTranslation as H}from"@payloadcms/translations";import{Button as W,Collapsible as z,ErrorPill as G,Pill as J,RenderComponent as Q,RenderFields as X,SectionTitle as Y,useDocumentInfo as Z,useFormSubmitted as ee,useTranslation as oe}from"@payloadcms/ui";import{dequal as te}from"dequal/lite";import{$getNodeByKey as O}from"lexical";import A,{useCallback as E}from"react";import{c as K}from"react/compiler-runtime";import{useAllFormFields as V}from"@payloadcms/ui";import{reduceFieldsToValues as D}from"payload/shared";import{useEffect as M}from"react";function w({fields:i}){for(let e in i){let o=i[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return i}var j=i=>{let e=K(8),{onChange:o}=i,[l]=V(),d,s;e[0]!==l?(s=w({fields:l}),d=D(s,!0),e[0]=l,e[1]=d,e[2]=s):(d=e[1],s=e[2]);let m=d,t,a;return e[3]!==o||e[4]!==s||e[5]!==m?(t=()=>{o&&o({fullFieldsWithValues:s,newFormData:m})},a=[m,o,s],e[3]=o,e[4]=s,e[5]=m,e[6]=t,e[7]=a):(t=e[6],a=e[7]),M(t,a),null};function L(i){for(let e in i){let o=i[e];Array.isArray(o)&&!o?.length?delete i[e]:o&&typeof o=="object"?L(o):o==null&&delete i[e]}}var U=i=>{let{baseClass:e,clientBlock:o,field:l,formSchema:d,nodeKey:s,schemaPath:m}=i,{formData:t}=i,{i18n:a}=oe(),[u]=q(),{getDocPreferences:x,setDocFieldPreferences:P}=Z(),[p,N]=A.useState(()=>{let r=!1;return x().then(c=>{let h=c?.fields[l.name]?.collapsed;h&&h.includes(t.id)&&(r=!0,N(!0))}),r}),F=ee(),[n,S]=A.useState(0),C=F&&n>0,$=[`${e}__row`,C?`${e}__row--has-errors`:`${e}__row--no-errors`].filter(Boolean).join(" "),R=E(({fullFieldsWithValues:r,newFormData:c})=>{if(c.id=t.id,c.blockType=t.blockType,L(c),L(t),te(t,c)||setTimeout(()=>{u.update(()=>{let _=O(s);_&&(t=c,_.setFields(c))})},0),F){let _=0;for(let h of Object.values(r))h?.valid===!1&&_++;S(_)}},[u,s,F,t]),v=E(r=>{x().then(c=>{let h=c?.fields[l.name]?.collapsed,g=h&&h?.length?h:[];r?g.includes(t.id)||g.push(t.id):g.includes(t.id)&&g.splice(g.indexOf(t.id),1),P(l.name,{collapsed:g,hello:"hi"})})},[x,l.name,P,t.id]),b=E(()=>{u.update(()=>{O(s).remove()})},[u,s]);return B(A.Fragment,{children:[k(z,{className:$,collapsibleStyle:C?"error":"default",header:o?.admin?.components?.Label?k(Q,{clientProps:{blockKind:"lexicalBlock",formData:t},mappedComponent:o.admin.components.Label}):B("div",{className:`${e}__block-header`,children:[B("div",{children:[k(J,{className:`${e}__block-pill ${e}__block-pill-${t?.blockType}`,pillStyle:"white",children:typeof o?.labels.singular=="string"?H(o?.labels.singular,a):o.slug}),k(Y,{path:"blockName",readOnly:l?.admin?.readOnly}),C&&k(G,{count:n,i18n:a,withMessage:!0})]}),u.isEditable()&&k(W,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:l?.admin?.readOnly,icon:"x",onClick:r=>{r.preventDefault(),b()},round:!0,tooltip:"Remove Block"})]}),isCollapsed:p,onToggle:r=>{v(r),N(r)},children:k(X,{className:`${e}__fields`,fields:d,forceRender:!0,margins:"small",path:"",readOnly:!1,schemaPath:m})},0),k(j,{onChange:R})]})};var y="lexical-block",We=i=>{let{formData:e,nodeKey:o}=i,{config:l}=de(),d=fe(),{id:s}=me(),{path:m,schemaPath:t}=ue(),{field:a}=T(),[u,x]=ye(!1),{field:{richTextComponentMap:P}}=T(),p=`${t}.lexical_internal_feature.blocks.lexical_blocks.lexical_blocks.${e.blockType}`,n=P.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(v=>v.slug===e.blockType);he(()=>{e&&(async()=>{let b=await I({apiRoute:l.routes.api,body:{id:s,data:e,operation:"update",schemaPath:p},serverURL:l.serverURL});b&&(b.blockName={initialValue:"",passesCondition:!0,valid:!0,value:e.blockName},x(b))})()},[l.routes.api,l.serverURL,p,s]);let S=be(async({formState:v})=>{let b=await I({apiRoute:l.routes.api,body:{id:s,formState:v,operation:"update",schemaPath:p},serverURL:l.serverURL});return b.blockName={initialValue:"",passesCondition:!0,valid:!0,value:e.blockName},b},[l.routes.api,l.serverURL,s,p,e.blockName]),{i18n:C}=pe(),$=[`${y}__row`,`${y}__row--no-errors`].filter(Boolean).join(" "),R=ke(()=>n&&u!==!1?f(ie,{beforeSubmit:[S],fields:n.fields,initialState:u,onChange:[S],submitted:d,uuid:Ce(),children:f(U,{baseClass:y,clientBlock:n,field:a,formData:e,formSchema:n.fields,nodeKey:o,path:`${m}.lexical_internal_feature.blocks.${e.blockType}`,schemaPath:p})}):f(se,{className:$,collapsibleStyle:"default",header:n?.admin?.components?.Label?f(ae,{clientProps:{blockKind:"lexicalBlock",formData:e},mappedComponent:n.admin.components.Label}):f("div",{className:`${y}__block-header`,children:le("div",{children:[f(ne,{className:`${y}__block-pill ${y}__block-pill-${e?.blockType}`,pillStyle:"white",children:n&&typeof n.labels.singular=="string"?_e(n.labels.singular,C):n.slug}),f(re,{path:"blockName",readOnly:a?.admin?.readOnly})]})}),children:f(ce,{height:"35vh"})},0),[n,u,S,d,a,o,m,p,$,C]);return f("div",{className:y+" "+y+"-"+e.blockType,children:R})};export{We as BlockComponent};
2
+ //# sourceMappingURL=component-7RAP75FW.js.map
@@ -1,2 +1,2 @@
1
- "use client";import{c as N,f as x}from"./chunk-OKMIHD2R.js";import{b as p}from"./chunk-NI6Z4GBD.js";import{jsx as a,jsxs as E}from"react/jsx-runtime";import{useCallback as f,useEffect as I,useRef as K}from"react";import{useLexicalComposerContext as L}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as S}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as $}from"@lexical/utils";import{getTranslation as M}from"@payloadcms/translations";import{Button as v,RenderComponent as h,useTranslation as A}from"@payloadcms/ui";import{$getNodeByKey as D,$getSelection as T,$isNodeSelection as P,CLICK_COMMAND as j,COMMAND_PRIORITY_LOW as b,KEY_BACKSPACE_COMMAND as Y,KEY_DELETE_COMMAND as z}from"lexical";var s="inline-block",le=y=>{let{formData:r,nodeKey:o}=y,[e]=L(),{i18n:C,t:k}=A(),{field:_}=p(),m=K(null),[l,c,d]=S(o),{field:{richTextComponentMap:O}}=p(),t=O.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(n=>n.slug===r.blockType),R=f(()=>{e.update(()=>{D(o).remove()})},[e,o]),u=f(n=>{if(l&&P(T())){n.preventDefault();let i=D(o);if(x(i))return i.remove(),!0}return!1},[l,o]),g=f(n=>{let i=n;return i.target===m.current||m.current?.contains(i.target)?(i.shiftKey?c(!l):l||(d(),c(!0)),!0):!1},[l,c,d]);I(()=>$(e.registerCommand(j,g,b),e.registerCommand(z,u,b),e.registerCommand(Y,u,b)),[d,e,l,o,u,c,g]);let B=t?.labels?.singular?M(t.labels.singular,C):t.slug;return E("div",{className:[s,s+"-"+r.blockType,l&&`${s}--selected`].filter(Boolean).join(" "),ref:m,children:[t?.admin?.components?.Label?a(h,{clientProps:{blockKind:"lexicalInlineBlock",formData:r},mappedComponent:t.admin.components.Label}):a("div",{children:M(t.labels?.singular,C)}),e.isEditable()&&E("div",{className:`${s}__actions`,children:[a(v,{buttonStyle:"icon-label",className:`${s}__editButton`,disabled:_?.admin?.readOnly,el:"div",icon:"edit",onClick:()=>{e.dispatchCommand(N,{fields:r,nodeKey:o})},round:!0,size:"small",tooltip:k("lexical:blocks:inlineBlocks:edit",{label:B})}),a(v,{buttonStyle:"icon-label",className:`${s}__removeButton`,disabled:_?.admin?.readOnly,icon:"x",onClick:n=>{n.preventDefault(),R()},round:!0,size:"small",tooltip:k("lexical:blocks:inlineBlocks:remove",{label:B})})]})]})};export{le as InlineBlockComponent};
2
- //# sourceMappingURL=componentInline-72VZAAHP.js.map
1
+ "use client";import{c as N,f as x}from"./chunk-YL453UOS.js";import{b as p}from"./chunk-OLSILJA6.js";import{jsx as a,jsxs as E}from"react/jsx-runtime";import{useCallback as f,useEffect as I,useRef as K}from"react";import{useLexicalComposerContext as L}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as S}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as $}from"@lexical/utils";import{getTranslation as M}from"@payloadcms/translations";import{Button as v,RenderComponent as h,useTranslation as A}from"@payloadcms/ui";import{$getNodeByKey as D,$getSelection as T,$isNodeSelection as P,CLICK_COMMAND as j,COMMAND_PRIORITY_LOW as b,KEY_BACKSPACE_COMMAND as Y,KEY_DELETE_COMMAND as z}from"lexical";var s="inline-block",le=y=>{let{formData:r,nodeKey:o}=y,[e]=L(),{i18n:C,t:k}=A(),{field:_}=p(),m=K(null),[l,c,d]=S(o),{field:{richTextComponentMap:O}}=p(),t=O.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(n=>n.slug===r.blockType),R=f(()=>{e.update(()=>{D(o).remove()})},[e,o]),u=f(n=>{if(l&&P(T())){n.preventDefault();let i=D(o);if(x(i))return i.remove(),!0}return!1},[l,o]),g=f(n=>{let i=n;return i.target===m.current||m.current?.contains(i.target)?(i.shiftKey?c(!l):l||(d(),c(!0)),!0):!1},[l,c,d]);I(()=>$(e.registerCommand(j,g,b),e.registerCommand(z,u,b),e.registerCommand(Y,u,b)),[d,e,l,o,u,c,g]);let B=t?.labels?.singular?M(t.labels.singular,C):t.slug;return E("div",{className:[s,s+"-"+r.blockType,l&&`${s}--selected`].filter(Boolean).join(" "),ref:m,children:[t?.admin?.components?.Label?a(h,{clientProps:{blockKind:"lexicalInlineBlock",formData:r},mappedComponent:t.admin.components.Label}):a("div",{children:M(t.labels?.singular,C)}),e.isEditable()&&E("div",{className:`${s}__actions`,children:[a(v,{buttonStyle:"icon-label",className:`${s}__editButton`,disabled:_?.admin?.readOnly,el:"div",icon:"edit",onClick:()=>{e.dispatchCommand(N,{fields:r,nodeKey:o})},round:!0,size:"small",tooltip:k("lexical:blocks:inlineBlocks:edit",{label:B})}),a(v,{buttonStyle:"icon-label",className:`${s}__removeButton`,disabled:_?.admin?.readOnly,icon:"x",onClick:n=>{n.preventDefault(),R()},round:!0,size:"small",tooltip:k("lexical:blocks:inlineBlocks:remove",{label:B})})]})]})};export{le as InlineBlockComponent};
2
+ //# sourceMappingURL=componentInline-YSHGRL2J.js.map