@payloadcms/richtext-lexical 3.59.0-internal.56a1b3b → 3.59.0-internal.5ab25cf

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 (124) hide show
  1. package/dist/exports/client/Field-CJFETHA3.js +2 -0
  2. package/dist/exports/client/Field-CJFETHA3.js.map +7 -0
  3. package/dist/exports/client/RelationshipComponent-TSIENULZ.js +2 -0
  4. package/dist/exports/client/RelationshipComponent-TSIENULZ.js.map +7 -0
  5. package/dist/exports/client/bundled.css +1 -1
  6. package/dist/exports/client/chunk-BQCXN3B4.js +2 -0
  7. package/dist/exports/client/chunk-BQCXN3B4.js.map +7 -0
  8. package/dist/exports/client/chunk-XNERFY6G.js +2 -0
  9. package/dist/exports/client/chunk-XNERFY6G.js.map +7 -0
  10. package/dist/exports/client/component-CYFKY3IL.js +2 -0
  11. package/dist/exports/client/component-CYFKY3IL.js.map +7 -0
  12. package/dist/exports/client/componentInline-NGTRUSGB.js +2 -0
  13. package/dist/exports/client/index.js +24 -24
  14. package/dist/exports/client/index.js.map +3 -3
  15. package/dist/features/align/server/i18n.d.ts.map +1 -1
  16. package/dist/features/align/server/i18n.js +6 -0
  17. package/dist/features/align/server/i18n.js.map +1 -1
  18. package/dist/features/blockquote/server/i18n.d.ts.map +1 -1
  19. package/dist/features/blockquote/server/i18n.js +3 -0
  20. package/dist/features/blockquote/server/i18n.js.map +1 -1
  21. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  22. package/dist/features/blocks/client/component/BlockContent.js +4 -1
  23. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  24. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  25. package/dist/features/blocks/client/component/index.js +15 -12
  26. package/dist/features/blocks/client/component/index.js.map +1 -1
  27. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  28. package/dist/features/blocks/client/componentInline/index.js +13 -10
  29. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  30. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts +1 -1
  31. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  32. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +25 -18
  33. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  34. package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts +8 -0
  35. package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts.map +1 -1
  36. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +15 -0
  37. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  38. package/dist/features/blocks/server/i18n.d.ts.map +1 -1
  39. package/dist/features/blocks/server/i18n.js +47 -38
  40. package/dist/features/blocks/server/i18n.js.map +1 -1
  41. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
  42. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +5 -3
  43. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  44. package/dist/features/heading/server/i18n.d.ts.map +1 -1
  45. package/dist/features/heading/server/i18n.js +3 -0
  46. package/dist/features/heading/server/i18n.js.map +1 -1
  47. package/dist/features/horizontalRule/server/i18n.d.ts.map +1 -1
  48. package/dist/features/horizontalRule/server/i18n.js +3 -0
  49. package/dist/features/horizontalRule/server/i18n.js.map +1 -1
  50. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  51. package/dist/features/indent/server/i18n.js +4 -0
  52. package/dist/features/indent/server/i18n.js.map +1 -1
  53. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  54. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -1
  55. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  56. package/dist/features/link/server/i18n.d.ts.map +1 -1
  57. package/dist/features/link/server/i18n.js +4 -0
  58. package/dist/features/link/server/i18n.js.map +1 -1
  59. package/dist/features/lists/checklist/server/i18n.d.ts.map +1 -1
  60. package/dist/features/lists/checklist/server/i18n.js +3 -0
  61. package/dist/features/lists/checklist/server/i18n.js.map +1 -1
  62. package/dist/features/lists/orderedList/server/i18n.d.ts.map +1 -1
  63. package/dist/features/lists/orderedList/server/i18n.js +3 -0
  64. package/dist/features/lists/orderedList/server/i18n.js.map +1 -1
  65. package/dist/features/lists/unorderedList/server/i18n.d.ts.map +1 -1
  66. package/dist/features/lists/unorderedList/server/i18n.js +3 -0
  67. package/dist/features/lists/unorderedList/server/i18n.js.map +1 -1
  68. package/dist/features/paragraph/server/i18n.d.ts.map +1 -1
  69. package/dist/features/paragraph/server/i18n.js +4 -0
  70. package/dist/features/paragraph/server/i18n.js.map +1 -1
  71. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  72. package/dist/features/relationship/client/components/RelationshipComponent.js +5 -9
  73. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  74. package/dist/features/relationship/server/i18n.d.ts.map +1 -1
  75. package/dist/features/relationship/server/i18n.js +3 -0
  76. package/dist/features/relationship/server/i18n.js.map +1 -1
  77. package/dist/features/textState/i18n.d.ts.map +1 -1
  78. package/dist/features/textState/i18n.js +3 -0
  79. package/dist/features/textState/i18n.js.map +1 -1
  80. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  81. package/dist/features/toolbars/fixed/client/Toolbar/index.js +7 -1
  82. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  83. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  84. package/dist/features/toolbars/inline/client/Toolbar/index.js +3 -1
  85. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  86. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  87. package/dist/features/upload/client/component/index.js +6 -5
  88. package/dist/features/upload/client/component/index.js.map +1 -1
  89. package/dist/features/upload/server/i18n.d.ts.map +1 -1
  90. package/dist/features/upload/server/i18n.js +3 -0
  91. package/dist/features/upload/server/i18n.js.map +1 -1
  92. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  93. package/dist/field/RenderLexical/index.js +1 -0
  94. package/dist/field/RenderLexical/index.js.map +1 -1
  95. package/dist/field/bundled.css +1 -1
  96. package/dist/field/rscEntry.d.ts.map +1 -1
  97. package/dist/field/rscEntry.js +2 -0
  98. package/dist/field/rscEntry.js.map +1 -1
  99. package/dist/i18n.d.ts.map +1 -1
  100. package/dist/i18n.js +6 -0
  101. package/dist/i18n.js.map +1 -1
  102. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  103. package/dist/lexical/LexicalEditor.js +20 -26
  104. package/dist/lexical/LexicalEditor.js.map +1 -1
  105. package/dist/utilities/buildInitialState.d.ts +1 -0
  106. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  107. package/dist/utilities/buildInitialState.js +1 -0
  108. package/dist/utilities/buildInitialState.js.map +1 -1
  109. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  110. package/dist/utilities/fieldsDrawer/DrawerContent.js +7 -3
  111. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  112. package/package.json +6 -6
  113. package/dist/exports/client/Field-2MCIQXRP.js +0 -2
  114. package/dist/exports/client/Field-2MCIQXRP.js.map +0 -7
  115. package/dist/exports/client/RelationshipComponent-APF3CN47.js +0 -2
  116. package/dist/exports/client/RelationshipComponent-APF3CN47.js.map +0 -7
  117. package/dist/exports/client/chunk-CYLMY5ZJ.js +0 -2
  118. package/dist/exports/client/chunk-CYLMY5ZJ.js.map +0 -7
  119. package/dist/exports/client/chunk-K47TNP5J.js +0 -2
  120. package/dist/exports/client/chunk-K47TNP5J.js.map +0 -7
  121. package/dist/exports/client/component-VDJI45F2.js +0 -2
  122. package/dist/exports/client/component-VDJI45F2.js.map +0 -7
  123. package/dist/exports/client/componentInline-AGFSKAY4.js +0 -2
  124. /package/dist/exports/client/{componentInline-AGFSKAY4.js.map → componentInline-NGTRUSGB.js.map} +0 -0
@@ -4,6 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
4
4
  import React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react';
5
5
  const baseClass = 'inline-block';
6
6
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
7
+ import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
7
8
  import { getTranslation } from '@payloadcms/translations';
8
9
  import { Button, Drawer, EditDepthProvider, Form, formatDrawerSlug, FormSubmit, RenderFields, ShimmerEffect, useConfig, useDocumentForm, useDocumentInfo, useEditDepth, useServerFunctions, useTranslation } from '@payloadcms/ui';
9
10
  import { abortAndIgnore } from '@payloadcms/ui/shared';
@@ -24,6 +25,7 @@ export const InlineBlockComponent = props => {
24
25
  nodeKey
25
26
  } = props;
26
27
  const [editor] = useLexicalComposerContext();
28
+ const isEditable = useLexicalEditable();
27
29
  const {
28
30
  i18n,
29
31
  t
@@ -33,7 +35,6 @@ export const InlineBlockComponent = props => {
33
35
  fieldProps: {
34
36
  featureClientSchemaMap,
35
37
  initialLexicalFormState,
36
- readOnly,
37
38
  schemaPath
38
39
  },
39
40
  setCreatedInlineBlock,
@@ -131,6 +132,7 @@ export const InlineBlockComponent = props => {
131
132
  initialBlockData: formData,
132
133
  initialBlockFormState: formData,
133
134
  operation: 'update',
135
+ readOnly: !isEditable,
134
136
  renderAllFields: true,
135
137
  schemaPath: schemaFieldsPath,
136
138
  signal: abortController.signal
@@ -157,7 +159,7 @@ export const InlineBlockComponent = props => {
157
159
  return () => {
158
160
  abortAndIgnore(abortController);
159
161
  };
160
- }, [getFormState, editor, nodeKey, schemaFieldsPath, id, formData, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields]);
162
+ }, [getFormState, editor, nodeKey, isEditable, schemaFieldsPath, id, formData, initialState, collectionSlug, globalSlug, getDocPreferences, parentDocumentFields]);
161
163
  /**
162
164
  * HANDLE ONCHANGE
163
165
  */
@@ -182,6 +184,7 @@ export const InlineBlockComponent = props => {
182
184
  globalSlug,
183
185
  initialBlockFormState: prevFormState,
184
186
  operation: 'update',
187
+ readOnly: !isEditable,
185
188
  renderAllFields: submit ? true : false,
186
189
  schemaPath: schemaFieldsPath,
187
190
  signal: controller.signal
@@ -194,7 +197,7 @@ export const InlineBlockComponent = props => {
194
197
  setCustomBlock(state_0['_components']?.customComponents?.Block);
195
198
  }
196
199
  return state_0;
197
- }, [getFormState, id, collectionSlug, getDocPreferences, parentDocumentFields, globalSlug, schemaFieldsPath]);
200
+ }, [getFormState, id, collectionSlug, getDocPreferences, parentDocumentFields, globalSlug, isEditable, schemaFieldsPath]);
198
201
  // cleanup effect
199
202
  useEffect(() => {
200
203
  const isStateOutOfSync = (formData_0, initialState_0) => {
@@ -225,7 +228,7 @@ export const InlineBlockComponent = props => {
225
228
  const RemoveButton = useMemo(() => () => /*#__PURE__*/_jsx(Button, {
226
229
  buttonStyle: "icon-label",
227
230
  className: `${baseClass}__removeButton`,
228
- disabled: readOnly,
231
+ disabled: !isEditable,
229
232
  icon: "x",
230
233
  onClick: e => {
231
234
  e.preventDefault();
@@ -236,11 +239,11 @@ export const InlineBlockComponent = props => {
236
239
  tooltip: t('lexical:blocks:inlineBlocks:remove', {
237
240
  label: blockDisplayName
238
241
  })
239
- }), [blockDisplayName, readOnly, removeInlineBlock, t]);
242
+ }), [blockDisplayName, isEditable, removeInlineBlock, t]);
240
243
  const EditButton = useMemo(() => () => /*#__PURE__*/_jsx(Button, {
241
244
  buttonStyle: "icon-label",
242
245
  className: `${baseClass}__editButton`,
243
- disabled: readOnly,
246
+ disabled: !isEditable,
244
247
  el: "button",
245
248
  icon: "edit",
246
249
  onClick: () => {
@@ -251,7 +254,7 @@ export const InlineBlockComponent = props => {
251
254
  tooltip: t('lexical:blocks:inlineBlocks:edit', {
252
255
  label: blockDisplayName
253
256
  })
254
- }), [blockDisplayName, readOnly, t, toggleDrawer]);
257
+ }), [blockDisplayName, isEditable, t, toggleDrawer]);
255
258
  const InlineBlockContainer = useMemo(() => ({
256
259
  children,
257
260
  className
@@ -274,7 +277,7 @@ export const InlineBlockComponent = props => {
274
277
  className: `${baseClass}-not-found`,
275
278
  children: [/*#__PURE__*/_jsxs("span", {
276
279
  children: ["Error: Block '", formData.blockType, "' not found"]
277
- }), editor.isEditable() ? /*#__PURE__*/_jsx("div", {
280
+ }), isEditable ? /*#__PURE__*/_jsx("div", {
278
281
  className: `${baseClass}__actions`,
279
282
  children: /*#__PURE__*/_jsx(RemoveButton, {})
280
283
  }) : null]
@@ -317,7 +320,7 @@ export const InlineBlockComponent = props => {
317
320
 
318
321
  parentSchemaPath: schemaFieldsPath,
319
322
  permissions: true,
320
- readOnly: false
323
+ readOnly: !isEditable
321
324
  }), /*#__PURE__*/_jsx(FormSubmit, {
322
325
  programmaticSubmit: true,
323
326
  children: t('fields:saveChanges')
@@ -338,7 +341,7 @@ export const InlineBlockComponent = props => {
338
341
  children: [initialState ? /*#__PURE__*/_jsx(Label, {}) : /*#__PURE__*/_jsx(ShimmerEffect, {
339
342
  height: "15px",
340
343
  width: "40px"
341
- }), editor.isEditable() ? /*#__PURE__*/_jsxs("div", {
344
+ }), isEditable ? /*#__PURE__*/_jsxs("div", {
342
345
  className: `${baseClass}__actions`,
343
346
  children: [/*#__PURE__*/_jsx(EditButton, {}), /*#__PURE__*/_jsx(RemoveButton, {})]
344
347
  }) : null]
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","createContext","useCallback","useEffect","useMemo","useRef","baseClass","useLexicalComposerContext","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","formData","nodeKey","editor","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","readOnly","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","setInitialState","useState","id","formState","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","CustomBlock","setCustomBlock","Block","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","clientBlockFields","getKey","length","undefined","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","initialBlockFormState","operation","renderAllFields","signal","newFormStateData","node","newData","setFields","onChange","prevFormState","submit","controller","isStateOutOfSync","Object","keys","some","key","value","onFormSubmit","RemoveButton","_jsx","buttonStyle","className","disabled","icon","onClick","e","preventDefault","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","filter","Boolean","join","ref","Label","_jsxs","isEditable","beforeSubmit","disableValidationOnSubmit","onSubmit","title","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","height","width"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\n\nimport './index.scss'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly formData: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, readOnly, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n () => initialLexicalFormState?.[formData.id]?.formState,\n )\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, readOnly, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={readOnly}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, readOnly, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[baseClass, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {editor.isEditable() ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={false}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {editor.isEditable() ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n"],"mappings":"AAAA;;;AAEA,OAAOA,KAAA,IAASC,aAAa,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ;AAC9E,MAAMC,SAAA,GAAY;AAIlB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,MAAM,EACNC,iBAAiB,EACjBC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAI9B,SAASC,0CAA0C,EAAEC,oBAAoB,QAAQ;AACjF,SAASC,EAAA,IAAMC,IAAI,QAAQ;AAI3B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AO8G,UAAU,kBAChBD,KAAA,CAAC;QAAInB,SAAA,EAAW,GAAG7H,SAAA,WAAoB;gCACrC2H,IAAA,CAACY,UAAA,O,aACDZ,IAAA,CAACD,YAAA;WAED;;;AAKd","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","createContext","useCallback","useEffect","useMemo","useRef","baseClass","useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","formData","nodeKey","editor","isEditable","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","setInitialState","useState","id","formState","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","CustomBlock","setCustomBlock","Block","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","clientBlockFields","getKey","length","undefined","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","initialBlockFormState","operation","readOnly","renderAllFields","signal","newFormStateData","node","newData","setFields","onChange","prevFormState","submit","controller","isStateOutOfSync","Object","keys","some","key","value","onFormSubmit","RemoveButton","_jsx","buttonStyle","className","disabled","icon","onClick","e","preventDefault","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","filter","Boolean","join","ref","Label","_jsxs","beforeSubmit","disableValidationOnSubmit","onSubmit","title","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","height","width"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\n\nimport './index.scss'\n\nimport { $getNodeByKey } from 'lexical'\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly formData: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n () => initialLexicalFormState?.[formData.id]?.formState,\n )\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[baseClass, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <E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AA,GAAK,SAAS,UAAU,EAAE;UAC1EkF,KAAA,EAAO9C,gBAAA,IAAoBnD,CAAA,CAAE;QAC/B;kBAECX,YAAA,gBACCsH,KAAA,CAAAK,SAAA;kCACE1B,IAAA,CAACnH,YAAA;YACCqC,MAAA,EAAQgC,WAAA,EAAahC,MAAA;YACrByG,WAAW;YACXC,eAAA,EAAgB;YAChBC,UAAA,EAAW,GAAG;YAAA;;YACdC,gBAAA,EAAkB5D,gBAAA;YAClB6D,WAAA,EAAa;YACblD,QAAA,EAAU,CAACrE;2BAEbwF,IAAA,CAACpH,UAAA;YAAWoJ,kBAAA,EAAoB;sBAAOtH,CAAA,CAAE;;aAEzC;;QAGPwB,WAAA,gBACC8D,IAAA,CAAClG,2BAAA;MACC+F,KAAA,EAAO;QACLe,UAAA;QACA7G,YAAA;QACA+G,oBAAA;QACAM,KAAA;QACA9G,OAAA;QACAyF;MACF;gBAEC7D;sBAGHmF,KAAA,CAACP,oBAAA;iBACE/G,YAAA,gBAAeiG,IAAA,CAACoB,KAAA,qBAAWpB,IAAA,CAAClH,aAAA;QAAcmJ,MAAA,EAAO;QAAOC,KAAA,EAAM;UAC9D1H,UAAA,gBACC6G,KAAA,CAAC;QAAInB,SAAA,EAAW,GAAG/H,SAAA,WAAoB;gCACrC6H,IAAA,CAACY,UAAA,O,aACDZ,IAAA,CAACD,YAAA;WAED;;;AAKd","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import './index.scss';
2
+ import React from 'react';
3
3
  import type { AdditionalCodeComponentProps } from './Code.js';
4
4
  export declare const CodeBlockBlockComponent: React.FC<Required<Pick<AdditionalCodeComponentProps, 'languages'>>>;
5
5
  //# sourceMappingURL=Block.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Block.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAA;AAQ7D,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAC5C,QAAQ,CAAC,IAAI,CAAC,4BAA4B,EAAE,WAAW,CAAC,CAAC,CA6F1D,CAAA"}
1
+ {"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Block.tsx"],"names":[],"mappings":"AAKA,OAAO,cAAc,CAAA;AAWrB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAA;AAQ7D,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAC5C,QAAQ,CAAC,IAAI,CAAC,4BAA4B,EAAE,WAAW,CAAC,CAAC,CAmG1D,CAAA"}
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
4
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
5
+ import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
5
6
  import { ChevronIcon, CopyToClipboard, Popup, PopupList, RenderFields, useForm, useFormFields } from '@payloadcms/ui';
6
7
  import React from 'react';
7
8
  import { CodeBlockIcon } from '../../../../../lexical/ui/icons/CodeBlock/index.js';
@@ -10,13 +11,14 @@ import { Collapse } from './Collapse/index.js';
10
11
  import { FloatingCollapse } from './FloatingCollapse/index.js';
11
12
  const baseClass = 'payload-richtext-code-block';
12
13
  export const CodeBlockBlockComponent = args => {
13
- const $ = _c(13);
14
+ const $ = _c(15);
14
15
  const {
15
16
  languages
16
17
  } = args;
17
18
  const {
18
19
  BlockCollapsible,
19
- formSchema
20
+ formSchema,
21
+ RemoveButton
20
22
  } = useBlockComponentContext();
21
23
  const {
22
24
  setModified
@@ -50,11 +52,12 @@ export const CodeBlockBlockComponent = args => {
50
52
  setSelectedLanguage
51
53
  } = useFormFields(t0);
52
54
  const selectedLanguageLabel = languages[selectedLanguageField?.value];
55
+ const isEditable = useLexicalEditable();
53
56
  const t1 = selectedLanguageField?.value;
54
57
  let t2;
55
- if ($[2] !== BlockCollapsible || $[3] !== codeField?.value || $[4] !== formSchema || $[5] !== languages || $[6] !== selectedLanguageLabel || $[7] !== setSelectedLanguage || $[8] !== t1) {
58
+ if ($[2] !== BlockCollapsible || $[3] !== RemoveButton || $[4] !== codeField?.value || $[5] !== formSchema || $[6] !== isEditable || $[7] !== languages || $[8] !== selectedLanguageLabel || $[9] !== setSelectedLanguage || $[10] !== t1) {
56
59
  let t3;
57
- if ($[10] !== languages || $[11] !== setSelectedLanguage) {
60
+ if ($[12] !== languages || $[13] !== setSelectedLanguage) {
58
61
  t3 = t4 => {
59
62
  const {
60
63
  close
@@ -78,11 +81,11 @@ export const CodeBlockBlockComponent = args => {
78
81
  })
79
82
  });
80
83
  };
81
- $[10] = languages;
82
- $[11] = setSelectedLanguage;
83
- $[12] = t3;
84
+ $[12] = languages;
85
+ $[13] = setSelectedLanguage;
86
+ $[14] = t3;
84
87
  } else {
85
- t3 = $[12];
88
+ t3 = $[14];
86
89
  }
87
90
  t2 = _jsx(BlockCollapsible, {
88
91
  Actions: _jsxs("div", {
@@ -98,13 +101,14 @@ export const CodeBlockBlockComponent = args => {
98
101
  })]
99
102
  }),
100
103
  className: `${baseClass}__language-selector`,
104
+ disabled: !isEditable,
101
105
  horizontalAlign: "right",
102
106
  render: t3,
103
107
  showScrollbar: true,
104
108
  size: "large"
105
109
  }), _jsx(CopyToClipboard, {
106
110
  value: codeField?.value ?? ""
107
- }), _jsx(Collapse, {})]
111
+ }), _jsx(Collapse, {}), isEditable && _jsx(RemoveButton, {})]
108
112
  }),
109
113
  className: baseClass,
110
114
  collapsibleProps: {
@@ -123,20 +127,23 @@ export const CodeBlockBlockComponent = args => {
123
127
  parentIndexPath: "",
124
128
  parentPath: "",
125
129
  parentSchemaPath: "",
126
- permissions: true
130
+ permissions: true,
131
+ readOnly: !isEditable
127
132
  })
128
133
  })
129
134
  });
130
135
  $[2] = BlockCollapsible;
131
- $[3] = codeField?.value;
132
- $[4] = formSchema;
133
- $[5] = languages;
134
- $[6] = selectedLanguageLabel;
135
- $[7] = setSelectedLanguage;
136
- $[8] = t1;
137
- $[9] = t2;
136
+ $[3] = RemoveButton;
137
+ $[4] = codeField?.value;
138
+ $[5] = formSchema;
139
+ $[6] = isEditable;
140
+ $[7] = languages;
141
+ $[8] = selectedLanguageLabel;
142
+ $[9] = setSelectedLanguage;
143
+ $[10] = t1;
144
+ $[11] = t2;
138
145
  } else {
139
- t2 = $[9];
146
+ t2 = $[11];
140
147
  }
141
148
  return t2;
142
149
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Block.js","names":["c","_c","ChevronIcon","CopyToClipboard","Popup","PopupList","RenderFields","useForm","useFormFields","React","CodeBlockIcon","useBlockComponentContext","Collapse","FloatingCollapse","baseClass","CodeBlockBlockComponent","args","$","languages","BlockCollapsible","formSchema","setModified","codeField","_temp","t0","t1","fields_0","dispatch","selectedLanguageField","fields","language","setSelectedLanguage","type","path","value","selectedLanguageLabel","t2","t3","t4","close","_jsx","ButtonGroup","children","Object","entries","map","t5","languageCode","languageLabel","Button","active","disabled","onClick","className","Actions","_jsxs","button","horizontalAlign","render","disableHeaderToggle","disableToggleIndicator","Pill","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","code"],"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Block.tsx"],"sourcesContent":["'use client'\nimport type {} from 'payload'\n\nimport {\n ChevronIcon,\n CopyToClipboard,\n Popup,\n PopupList,\n RenderFields,\n useForm,\n useFormFields,\n} from '@payloadcms/ui'\nimport React from 'react'\n\nimport './index.scss'\n\nimport type { AdditionalCodeComponentProps } from './Code.js'\n\nimport { CodeBlockIcon } from '../../../../../lexical/ui/icons/CodeBlock/index.js'\nimport { useBlockComponentContext } from '../../../client/component/BlockContent.js'\nimport { Collapse } from './Collapse/index.js'\nimport { FloatingCollapse } from './FloatingCollapse/index.js'\n\nconst baseClass = 'payload-richtext-code-block'\nexport const CodeBlockBlockComponent: React.FC<\n Required<Pick<AdditionalCodeComponentProps, 'languages'>>\n> = (args) => {\n const { languages } = args\n const { BlockCollapsible, formSchema } = useBlockComponentContext()\n const { setModified } = useForm()\n\n const { codeField } = useFormFields(([fields]) => ({\n codeField: fields?.code,\n }))\n\n const { selectedLanguageField, setSelectedLanguage } = useFormFields(([fields, dispatch]) => ({\n selectedLanguageField: fields?.language,\n setSelectedLanguage: (language: string) => {\n dispatch({\n type: 'UPDATE',\n path: 'language',\n value: language,\n })\n setModified(true)\n },\n }))\n\n const selectedLanguageLabel = languages[selectedLanguageField?.value as keyof typeof languages]\n\n return (\n <BlockCollapsible\n Actions={\n <div className={`${baseClass}__actions`}>\n <Popup\n button={\n <div\n className={`${baseClass}__language-selector-button`}\n data-selected-language={selectedLanguageField?.value}\n >\n <span>{selectedLanguageLabel}</span>\n <ChevronIcon className={`${baseClass}__chevron`} />\n </div>\n }\n className={`${baseClass}__language-selector`}\n horizontalAlign=\"right\"\n render={({ close }) => (\n <PopupList.ButtonGroup>\n {Object.entries(languages).map(([languageCode, languageLabel]) => {\n return (\n <PopupList.Button\n active={false}\n disabled={false}\n key={languageCode}\n onClick={() => {\n setSelectedLanguage(languageCode)\n close()\n }}\n >\n <span className={`${baseClass}__language-code`} data-language={languageCode}>\n {languageLabel}\n </span>\n </PopupList.Button>\n )\n })}\n </PopupList.ButtonGroup>\n )}\n showScrollbar\n size=\"large\"\n />\n <CopyToClipboard value={(codeField?.value as string) ?? ''} />\n\n <Collapse />\n </div>\n }\n className={baseClass}\n collapsibleProps={{\n AfterCollapsible: <FloatingCollapse />,\n disableHeaderToggle: true,\n disableToggleIndicator: true,\n }}\n Pill={\n <div className={`${baseClass}__pill`}>\n <CodeBlockIcon />\n </div>\n }\n >\n <>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"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A;YAAuB,C;;qBAGxC,GAAAA,SAAA,qBAAiC;UAAA2C,eAAA,EAC5B;UAAAC,MAAA,EACRrB,E;;gBAsBH;QAAA,C,GAEPG,IAAA,CAAArC,eAAA;UAAA+B,KAAA,EAAwBZ,SAAC,EAAAY,KAAA,IAA+B;QAAA,C,GAExDM,IAAA,CAAA5B,QAAA,IAAC;MAAA,C;;;0BAKe4B,IAAA,CAAA3B,gBAAA,IAAC;QAAA8C,mBAAA;QAAAC,sBAAA;MAAA;MAAAC,IAAA,EAKnBrB,IAAA,CAAC;QAAAa,SAAA,EAAe,GAAAvC,SAAA,QAAoB;QAAA4B,QAAA,EAClCF,IAAA,CAAA9B,aAAA,IAAC;MAAA,C;gBAIL8B,IAAA,CAAAsB,SAAA;QAAApB,QAAA,EACEF,IAAA,CAAAlC,YAAA;UAAAuB,MAAA,EACUT,UAAA;UAAA2C,WAAA;UAAAC,eAAA,EAEQ;UAAAC,UAAA,EACJ;UAAAC,gBAAA,EACK;UAAAC,WAAA;QAAA,C;;;;;;;;;;;;;;SA9DvB/B,E;CAoEJ;AA5FI,SAAAb,MAAAC,EAAA;EAKmC,OAAAK,MAAA,IAAAL,EAAQ;EAAA;IAAAF,SAAA,EAChCO,MAAA,EAAAuC;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"Block.js","names":["c","_c","useLexicalEditable","ChevronIcon","CopyToClipboard","Popup","PopupList","RenderFields","useForm","useFormFields","React","CodeBlockIcon","useBlockComponentContext","Collapse","FloatingCollapse","baseClass","CodeBlockBlockComponent","args","$","languages","BlockCollapsible","formSchema","RemoveButton","setModified","codeField","_temp","t0","t1","fields_0","dispatch","selectedLanguageField","fields","language","setSelectedLanguage","type","path","value","selectedLanguageLabel","isEditable","t2","t3","t4","close","_jsx","ButtonGroup","children","Object","entries","map","t5","languageCode","languageLabel","Button","active","disabled","onClick","className","Actions","_jsxs","button","horizontalAlign","render","disableHeaderToggle","disableToggleIndicator","Pill","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly","code"],"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Block.tsx"],"sourcesContent":["'use client'\nimport type {} from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\n\nimport './index.scss'\n\nimport {\n ChevronIcon,\n CopyToClipboard,\n Popup,\n PopupList,\n RenderFields,\n useForm,\n useFormFields,\n} from '@payloadcms/ui'\nimport React from 'react'\n\nimport type { AdditionalCodeComponentProps } from './Code.js'\n\nimport { CodeBlockIcon } from '../../../../../lexical/ui/icons/CodeBlock/index.js'\nimport { useBlockComponentContext } from '../../../client/component/BlockContent.js'\nimport { Collapse } from './Collapse/index.js'\nimport { FloatingCollapse } from './FloatingCollapse/index.js'\n\nconst baseClass = 'payload-richtext-code-block'\nexport const CodeBlockBlockComponent: React.FC<\n Required<Pick<AdditionalCodeComponentProps, 'languages'>>\n> = (args) => {\n const { languages } = args\n const { BlockCollapsible, formSchema, RemoveButton } = useBlockComponentContext()\n const { setModified } = useForm()\n\n const { codeField } = useFormFields(([fields]) => ({\n codeField: fields?.code,\n }))\n\n const { selectedLanguageField, setSelectedLanguage } = useFormFields(([fields, dispatch]) => ({\n selectedLanguageField: fields?.language,\n setSelectedLanguage: (language: string) => {\n dispatch({\n type: 'UPDATE',\n path: 'language',\n value: language,\n })\n setModified(true)\n },\n }))\n\n const selectedLanguageLabel = languages[selectedLanguageField?.value as keyof typeof languages]\n\n const isEditable = useLexicalEditable()\n\n return (\n <BlockCollapsible\n Actions={\n <div className={`${baseClass}__actions`}>\n <Popup\n button={\n <div\n className={`${baseClass}__language-selector-button`}\n data-selected-language={selectedLanguageField?.value}\n >\n <span>{selectedLanguageLabel}</span>\n <ChevronIcon className={`${baseClass}__chevron`} />\n </div>\n }\n className={`${baseClass}__language-selector`}\n disabled={!isEditable}\n horizontalAlign=\"right\"\n render={({ close }) => (\n <PopupList.ButtonGroup>\n {Object.entries(languages).map(([languageCode, languageLabel]) => {\n return (\n <PopupList.Button\n active={false}\n disabled={false}\n key={languageCode}\n onClick={() => {\n setSelectedLanguage(languageCode)\n close()\n }}\n >\n <span className={`${baseClass}__language-code`} data-language={languageCode}>\n {languageLabel}\n </span>\n </PopupList.Button>\n )\n })}\n </PopupList.ButtonGroup>\n )}\n showScrollbar\n size=\"large\"\n />\n <CopyToClipboard value={(codeField?.value as string) ?? ''} />\n\n <Collapse />\n\n {isEditable && <RemoveButton />}\n </div>\n }\n className={baseClass}\n collapsibleProps={{\n AfterCollapsible: <FloatingCollapse />,\n disableHeaderToggle: true,\n disableToggleIndicator: true,\n }}\n Pill={\n <div className={`${baseClass}__pill`}>\n <CodeBlockIcon />\n </div>\n }\n >\n <>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </>\n </BlockCollapsible>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,kBAAkB,QAAQ;AAInC,SACEC,WAAW,EACXC,eAAe,EACfC,KAAK,EACLC,SAAS,EACTC,YAAY,EACZC,OAAO,EACPC,aAAa,QACR;AACP,OAAOC,KAAA,MAAW;AAIlB,SAASC,aAAa,QAAQ;AAC9B,SAASC,wBAAwB,QAAQ;AACzC,SAASC,QAAQ,QAAQ;AACzB,SAASC,gBAAgB,QAAQ;AAEjC,MAAMC,SAAA,GAAY;AAClB,OAAO,MAAMC,uBAAA,GAETC,IAAA;EAAA,MAAAC,CAAA,GAAAjB,EAAA;EACF;IAAAkB;EAAA,IAAsBF,IAAA;EACtB;IAAAG,gBAAA;IAAAC,UAAA;IAAAC;EAAA,IAAuDV,wBAAA;EACvD;IAAAW;EAAA,IAAwBf,OAAA;EAExB;IAAAgB;EAAA,IAAsBf,aAAA,CAAAgB,KAEtB;EAAA,IAAAC,EAAA;EAAA,IAAAR,CAAA,QAAAK,WAAA;IAEqEG,EAAA,GAAAC,EAAA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6C,WAAA;UAAAC,eAAA,EAEQ;UAAAC,UAAA,EACJ;UAAAC,gBAAA,EACK;UAAAC,WAAA;UAAAC,QAAA,GAENjC;QAAA,C;;;;;;;;;;;;;;;;SAnEjBC,E;CAwEJ;AAlGI,SAAAd,MAAAC,EAAA;EAKmC,OAAAK,MAAA,IAAAL,EAAQ;EAAA;IAAAF,SAAA,EAChCO,MAAA,EAAAyC;EAAA;AAAA","ignoreList":[]}
@@ -24,6 +24,14 @@ export type AdditionalCodeComponentProps = {
24
24
  * Configure typescript settings for the editor
25
25
  */
26
26
  typescript?: {
27
+ /**
28
+ * By default, the editor will not perform semantic validation. This means that
29
+ * while syntax errors will be highlighted, other issues like missing imports or incorrect
30
+ * types will not be.
31
+ *
32
+ * @default false
33
+ */
34
+ enableSemanticValidation?: boolean;
27
35
  /**
28
36
  * Additional types to fetch and include in the editor for autocompletion.
29
37
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Code.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAGpE,OAAO,KAAkB,MAAM,OAAO,CAAA;AAEtC,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;;;;;WAMG;QACH,UAAU,CAAC,EAAE,KAAK,CAAC;YACjB,QAAQ,EAAE,MAAM,CAAA;YAChB,GAAG,EAAE,MAAM,CAAA;SACZ,CAAC,CAAA;QACF;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;QAChC;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAA;QACf;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;KACrB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,GAAG,oBAAoB,CAuGvF,CAAA"}
1
+ {"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Code.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAGpE,OAAO,KAAkB,MAAM,OAAO,CAAA;AAEtC,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;;;;;WAMG;QACH,wBAAwB,CAAC,EAAE,OAAO,CAAA;QAClC;;;;;;WAMG;QACH,UAAU,CAAC,EAAE,KAAK,CAAC;YACjB,QAAQ,EAAE,MAAM,CAAA;YAChB,GAAG,EAAE,MAAM,CAAA;SACZ,CAAC,CAAA;QACF;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;QAChC;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAA;QACf;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;KACrB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,GAAG,oBAAoB,CAwHvF,CAAA"}
@@ -29,6 +29,11 @@ export const CodeComponent = ({
29
29
  admin: {
30
30
  ...field.admin,
31
31
  editorOptions: {},
32
+ editorProps: {
33
+ // If typescript is set, @monaco-editor/react needs to set the URI to a .ts or .tsx file when it calls createModel().
34
+ // This is done through the `defaultPath` prop.
35
+ defaultPath: language === 'ts' ? 'file.tsx' : undefined
36
+ },
32
37
  language
33
38
  }
34
39
  }), [field, language]);
@@ -57,11 +62,21 @@ export const CodeComponent = ({
57
62
  monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
58
63
  allowNonTsExtensions: true,
59
64
  // Set module resolution to NodeJs to enable autocompletion
65
+ allowJs: true,
66
+ allowSyntheticDefaultImports: true,
67
+ esModuleInterop: true,
68
+ jsx: monaco.languages.typescript.JsxEmit.React,
60
69
  moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
70
+ noEmit: true,
61
71
  paths: typescript?.paths,
72
+ reactNamespace: 'React',
62
73
  target: monaco.languages.typescript.ScriptTarget[typescript?.target ?? 'ESNext'],
63
74
  typeRoots: typescript?.typeRoots ?? ['node_modules/@types']
64
75
  });
76
+ monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
77
+ noSemanticValidation: typescript?.enableSemanticValidation ? false : true,
78
+ noSyntaxValidation: false
79
+ });
65
80
  const run = async () => {
66
81
  if (typescript?.fetchTypes && Array.isArray(typescript.fetchTypes) && typescript.fetchTypes.length > 0) {
67
82
  await Promise.all(typescript.fetchTypes.map(async type => {
@@ -1 +1 @@
1
- {"version":3,"file":"Code.js","names":["CodeField","useFormFields","React","useMemo","CodeComponent","autoComplete","field","forceRender","languages","js","plaintext","ts","path","permissions","readOnly","renderedBlocks","schemaPath","typescript","validate","languageField","fields","language","value","initialValue","label","props","type","admin","editorOptions","key","name","_jsx","onMount","_editor","monaco","editor","defineTheme","base","colors","inherit","rules","typescriptDefaults","setCompilerOptions","allowNonTsExtensions","moduleResolution","ModuleResolutionKind","NodeJs","paths","target","ScriptTarget","typeRoots","run","fetchTypes","Array","isArray","length","Promise","all","map","types","fetch","url","typesText","text","addExtraLib","filePath"],"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Code.tsx"],"sourcesContent":["'use client'\n\nimport type { CodeFieldClient, CodeFieldClientProps } from 'payload'\n\nimport { CodeField, useFormFields } from '@payloadcms/ui'\nimport React, { useMemo } from 'react'\n\nexport type AdditionalCodeComponentProps = {\n /**\n * @default first key of the `languages` prop\n */\n defaultLanguage?: string\n /**\n * @default\n * {\n * js: 'JavaScript',\n * plaintext: 'Plain Text',\n * ts: 'TypeScript',\n * }\n */\n languages?: Record<string, string>\n /**\n * Override the name of the block.\n *\n * @default 'Code'\n */\n slug?: string\n /**\n * Configure typescript settings for the editor\n */\n typescript?: {\n /**\n * Additional types to fetch and include in the editor for autocompletion.\n *\n * For example, to include types for payload, you would set this to\n *\n * [{ url: 'https://unpkg.com/payload@latest/dist/index.d.ts', filePath: 'file:///node_modules/payload/index.d.ts' }]\n */\n fetchTypes?: Array<{\n filePath: string\n url: string\n }>\n /**\n * @default undefined\n */\n paths?: Record<string, string[]>\n /**\n * @default \"ESNext\"\n */\n target?: string\n /**\n * @default ['node_modules/@types']\n */\n typeRoots?: string[]\n }\n}\n\nexport const CodeComponent: React.FC<AdditionalCodeComponentProps & CodeFieldClientProps> = ({\n autoComplete,\n field,\n forceRender,\n languages = {\n js: 'JavaScript',\n plaintext: 'Plain Text',\n ts: 'TypeScript',\n },\n path,\n permissions,\n readOnly,\n renderedBlocks,\n schemaPath,\n typescript,\n validate,\n}) => {\n const languageField = useFormFields(([fields]) => fields['language'])\n\n const language: string =\n (languageField?.value as string) || (languageField?.initialValue as string) || 'typescript'\n\n const label = languages[language]\n\n const props: CodeFieldClient = useMemo<CodeFieldClient>(\n () => ({\n ...field,\n type: 'code',\n admin: {\n ...field.admin,\n editorOptions: {},\n language,\n },\n }),\n [field, language],\n )\n\n const key = `${field.name}-${language}-${label}`\n\n return (\n props && (\n <CodeField\n autoComplete={autoComplete}\n field={props}\n forceRender={forceRender}\n key={key}\n onMount={(_editor, monaco) => {\n monaco.editor.defineTheme('vs-dark', {\n base: 'vs-dark',\n colors: {\n 'editor.background': '#222222',\n },\n inherit: true,\n rules: [],\n })\n\n monaco.editor.defineTheme('vs', {\n base: 'vs',\n colors: {\n 'editor.background': '#f5f5f5',\n },\n inherit: true,\n rules: [],\n })\n monaco.languages.typescript.typescriptDefaults.setCompilerOptions({\n allowNonTsExtensions: true,\n // Set module resolution to NodeJs to enable autocompletion\n moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,\n paths: typescript?.paths,\n target: monaco.languages.typescript.ScriptTarget[\n typescript?.target ?? ('ESNext' as any)\n ] as any,\n typeRoots: typescript?.typeRoots ?? ['node_modules/@types'],\n })\n const run = async () => {\n if (\n typescript?.fetchTypes &&\n Array.isArray(typescript.fetchTypes) &&\n typescript.fetchTypes.length > 0\n ) {\n await Promise.all(\n typescript.fetchTypes.map(async (type) => {\n const types = await fetch(type.url)\n const typesText = await types.text()\n monaco.languages.typescript.typescriptDefaults.addExtraLib(\n typesText,\n type.filePath,\n )\n }),\n )\n }\n }\n void run()\n }}\n path={path}\n permissions={permissions}\n readOnly={readOnly}\n renderedBlocks={renderedBlocks}\n schemaPath={schemaPath}\n validate={validate}\n />\n )\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,SAAS,EAAEC,aAAa,QAAQ;AACzC,OAAOC,KAAA,IAASC,OAAO,QAAQ;AAoD/B,OAAO,MAAMC,aAAA,GAA+EA,CAAC;EAC3FC,YAAY;EACZC,KAAK;EACLC,WAAW;EACXC,SAAA,GAAY;IACVC,EAAA,EAAI;IACJC,SAAA,EAAW;IACXC,EAAA,EAAI;EACN,CAAC;EACDC,IAAI;EACJC,WAAW;EACXC,QAAQ;EACRC,cAAc;EACdC,UAAU;EACVC,UAAU;EACVC;AAAQ,CACT;EACC,MAAMC,aAAA,GAAgBlB,aAAA,CAAc,CAAC,CAACmB,MAAA,CAAO,KAAKA,MAAM,CAAC,WAAW;EAEpE,MAAMC,QAAA,GACJF,aAAC,EAAeG,KAAA,IAAqBH,aAAA,EAAeI,YAA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ACA,MAAMC,GAAA,GAAM,MAAAA,CAAA;QACV,IACElC,UAAA,EAAYmC,UAAA,IACZC,KAAA,CAAMC,OAAO,CAACrC,UAAA,CAAWmC,UAAU,KACnCnC,UAAA,CAAWmC,UAAU,CAACG,MAAM,GAAG,GAC/B;UACA,MAAMC,OAAA,CAAQC,GAAG,CACfxC,UAAA,CAAWmC,UAAU,CAACM,GAAG,CAAC,MAAOhC,IAAA;YAC/B,MAAMiC,KAAA,GAAQ,MAAMC,KAAA,CAAMlC,IAAA,CAAKmC,GAAG;YAClC,MAAMC,SAAA,GAAY,MAAMH,KAAA,CAAMI,IAAI;YAClC7B,MAAA,CAAO1B,SAAS,CAACS,UAAU,CAACwB,kBAAkB,CAACuB,WAAW,CACxDF,SAAA,EACApC,IAAA,CAAKuC,QAAQ;UAEjB;QAEJ;MACF;MACA,KAAKd,GAAA;IACP;IACAvC,IAAA,EAAMA,IAAA;IACNC,WAAA,EAAaA,WAAA;IACbC,QAAA,EAAUA,QAAA;IACVC,cAAA,EAAgBA,cAAA;IAChBC,UAAA,EAAYA,UAAA;IACZE,QAAA,EAAUA;KAtDLW,GAAA;AA0Db","ignoreList":[]}
1
+ {"version":3,"file":"Code.js","names":["CodeField","useFormFields","React","useMemo","CodeComponent","autoComplete","field","forceRender","languages","js","plaintext","ts","path","permissions","readOnly","renderedBlocks","schemaPath","typescript","validate","languageField","fields","language","value","initialValue","label","props","type","admin","editorOptions","editorProps","defaultPath","undefined","key","name","_jsx","onMount","_editor","monaco","editor","defineTheme","base","colors","inherit","rules","typescriptDefaults","setCompilerOptions","allowNonTsExtensions","allowJs","allowSyntheticDefaultImports","esModuleInterop","jsx","JsxEmit","moduleResolution","ModuleResolutionKind","NodeJs","noEmit","paths","reactNamespace","target","ScriptTarget","typeRoots","setDiagnosticsOptions","noSemanticValidation","enableSemanticValidation","noSyntaxValidation","run","fetchTypes","Array","isArray","length","Promise","all","map","types","fetch","url","typesText","text","addExtraLib","filePath"],"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Code.tsx"],"sourcesContent":["'use client'\n\nimport type { CodeFieldClient, CodeFieldClientProps } from 'payload'\n\nimport { CodeField, useFormFields } from '@payloadcms/ui'\nimport React, { useMemo } from 'react'\n\nexport type AdditionalCodeComponentProps = {\n /**\n * @default first key of the `languages` prop\n */\n defaultLanguage?: string\n /**\n * @default\n * {\n * js: 'JavaScript',\n * plaintext: 'Plain Text',\n * ts: 'TypeScript',\n * }\n */\n languages?: Record<string, string>\n /**\n * Override the name of the block.\n *\n * @default 'Code'\n */\n slug?: string\n /**\n * Configure typescript settings for the editor\n */\n typescript?: {\n /**\n * By default, the editor will not perform semantic validation. This means that\n * while syntax errors will be highlighted, other issues like missing imports or incorrect\n * types will not be.\n *\n * @default false\n */\n enableSemanticValidation?: boolean\n /**\n * Additional types to fetch and include in the editor for autocompletion.\n *\n * For example, to include types for payload, you would set this to\n *\n * [{ url: 'https://unpkg.com/payload@latest/dist/index.d.ts', filePath: 'file:///node_modules/payload/index.d.ts' }]\n */\n fetchTypes?: Array<{\n filePath: string\n url: string\n }>\n /**\n * @default undefined\n */\n paths?: Record<string, string[]>\n /**\n * @default \"ESNext\"\n */\n target?: string\n /**\n * @default ['node_modules/@types']\n */\n typeRoots?: string[]\n }\n}\n\nexport const CodeComponent: React.FC<AdditionalCodeComponentProps & CodeFieldClientProps> = ({\n autoComplete,\n field,\n forceRender,\n languages = {\n js: 'JavaScript',\n plaintext: 'Plain Text',\n ts: 'TypeScript',\n },\n path,\n permissions,\n readOnly,\n renderedBlocks,\n schemaPath,\n typescript,\n validate,\n}) => {\n const languageField = useFormFields(([fields]) => fields['language'])\n\n const language: string =\n (languageField?.value as string) || (languageField?.initialValue as string) || 'typescript'\n\n const label = languages[language]\n\n const props: CodeFieldClient = useMemo<CodeFieldClient>(\n () => ({\n ...field,\n type: 'code',\n admin: {\n ...field.admin,\n editorOptions: {},\n editorProps: {\n // If typescript is set, @monaco-editor/react needs to set the URI to a .ts or .tsx file when it calls createModel().\n // This is done through the `defaultPath` prop.\n defaultPath: language === 'ts' ? 'file.tsx' : undefined,\n },\n language,\n },\n }),\n [field, language],\n )\n\n const key = `${field.name}-${language}-${label}`\n\n return (\n props && (\n <CodeField\n autoComplete={autoComplete}\n field={props}\n forceRender={forceRender}\n key={key}\n onMount={(_editor, monaco) => {\n monaco.editor.defineTheme('vs-dark', {\n base: 'vs-dark',\n colors: {\n 'editor.background': '#222222',\n },\n inherit: true,\n rules: [],\n })\n\n monaco.editor.defineTheme('vs', {\n base: 'vs',\n colors: {\n 'editor.background': '#f5f5f5',\n },\n inherit: true,\n rules: [],\n })\n monaco.languages.typescript.typescriptDefaults.setCompilerOptions({\n allowNonTsExtensions: true,\n // Set module resolution to NodeJs to enable autocompletion\n allowJs: true,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n jsx: monaco.languages.typescript.JsxEmit.React,\n moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,\n noEmit: true,\n paths: typescript?.paths,\n reactNamespace: 'React',\n target: monaco.languages.typescript.ScriptTarget[\n typescript?.target ?? ('ESNext' as any)\n ] as any,\n typeRoots: typescript?.typeRoots ?? ['node_modules/@types'],\n })\n\n monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({\n noSemanticValidation: typescript?.enableSemanticValidation ? false : true,\n noSyntaxValidation: false,\n })\n\n const run = async () => {\n if (\n typescript?.fetchTypes &&\n Array.isArray(typescript.fetchTypes) &&\n typescript.fetchTypes.length > 0\n ) {\n await Promise.all(\n typescript.fetchTypes.map(async (type) => {\n const types = await fetch(type.url)\n const typesText = await types.text()\n monaco.languages.typescript.typescriptDefaults.addExtraLib(\n typesText,\n type.filePath,\n )\n }),\n )\n }\n }\n void run()\n }}\n path={path}\n permissions={permissions}\n readOnly={readOnly}\n renderedBlocks={renderedBlocks}\n schemaPath={schemaPath}\n validate={validate}\n />\n )\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,SAAS,EAAEC,aAAa,QAAQ;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C,SAAA,GAAY,MAAMH,KAAA,CAAMI,IAAI;YAClCxC,MAAA,CAAO7B,SAAS,CAACS,UAAU,CAAC2B,kBAAkB,CAACkC,WAAW,CACxDF,SAAA,EACAlD,IAAA,CAAKqD,QAAQ;UAEjB;QAEJ;MACF;MACA,KAAKd,GAAA;IACP;IACArD,IAAA,EAAMA,IAAA;IACNC,WAAA,EAAaA,WAAA;IACbC,QAAA,EAAUA,QAAA;IACVC,cAAA,EAAgBA,cAAA;IAChBC,UAAA,EAAYA,UAAA;IACZE,QAAA,EAAUA;KAlELc,GAAA;AAsEb","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/server/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAqU1C,CAAA"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/server/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,gBAAgB,CA8U1C,CAAA"}