@payloadcms/richtext-lexical 3.0.0-beta.65 → 3.0.0-beta.66

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 (103) hide show
  1. package/dist/exports/client/Field-6VQ73D3D.js +2 -0
  2. package/dist/exports/client/Field-6VQ73D3D.js.map +7 -0
  3. package/dist/exports/client/RelationshipComponent-FFJCVTWM.js +2 -0
  4. package/dist/exports/client/RelationshipComponent-FFJCVTWM.js.map +7 -0
  5. package/dist/exports/client/bundled.css +1 -1
  6. package/dist/exports/client/chunk-EBB2CEB6.js +2 -0
  7. package/dist/exports/client/chunk-EBB2CEB6.js.map +7 -0
  8. package/dist/exports/client/{chunk-LGMNC5KQ.js → chunk-HO42U3IJ.js} +2 -2
  9. package/dist/exports/client/chunk-JELGBZLY.js +2 -0
  10. package/dist/exports/client/chunk-JELGBZLY.js.map +7 -0
  11. package/dist/exports/client/component-TYPMHBL7.js +2 -0
  12. package/dist/exports/client/component-TYPMHBL7.js.map +7 -0
  13. package/dist/exports/client/componentInline-FQNXWTOE.js +2 -0
  14. package/dist/exports/client/componentInline-FQNXWTOE.js.map +7 -0
  15. package/dist/exports/client/index.js +7 -7
  16. package/dist/exports/client/index.js.map +4 -4
  17. package/dist/features/blocks/component/BlockContent.d.ts +3 -2
  18. package/dist/features/blocks/component/BlockContent.d.ts.map +1 -1
  19. package/dist/features/blocks/component/BlockContent.js +5 -2
  20. package/dist/features/blocks/component/BlockContent.js.map +1 -1
  21. package/dist/features/blocks/component/index.d.ts +0 -4
  22. package/dist/features/blocks/component/index.d.ts.map +1 -1
  23. package/dist/features/blocks/component/index.js +6 -2
  24. package/dist/features/blocks/component/index.js.map +1 -1
  25. package/dist/features/blocks/componentInline/index.d.ts +10 -0
  26. package/dist/features/blocks/componentInline/index.d.ts.map +1 -0
  27. package/dist/features/blocks/componentInline/index.js +133 -0
  28. package/dist/features/blocks/componentInline/index.js.map +1 -0
  29. package/dist/features/blocks/feature.client.d.ts +6 -1
  30. package/dist/features/blocks/feature.client.d.ts.map +1 -1
  31. package/dist/features/blocks/feature.client.js +70 -8
  32. package/dist/features/blocks/feature.client.js.map +1 -1
  33. package/dist/features/blocks/feature.server.d.ts +2 -1
  34. package/dist/features/blocks/feature.server.d.ts.map +1 -1
  35. package/dist/features/blocks/feature.server.js +99 -34
  36. package/dist/features/blocks/feature.server.js.map +1 -1
  37. package/dist/features/blocks/graphQLPopulationPromise.d.ts +3 -2
  38. package/dist/features/blocks/graphQLPopulationPromise.d.ts.map +1 -1
  39. package/dist/features/blocks/graphQLPopulationPromise.js +2 -2
  40. package/dist/features/blocks/graphQLPopulationPromise.js.map +1 -1
  41. package/dist/features/blocks/i18n.d.ts.map +1 -1
  42. package/dist/features/blocks/i18n.js +192 -0
  43. package/dist/features/blocks/i18n.js.map +1 -1
  44. package/dist/features/blocks/nodes/BlocksNode.d.ts.map +1 -1
  45. package/dist/features/blocks/nodes/BlocksNode.js +0 -1
  46. package/dist/features/blocks/nodes/BlocksNode.js.map +1 -1
  47. package/dist/features/blocks/nodes/InlineBlocksNode.d.ts +39 -0
  48. package/dist/features/blocks/nodes/InlineBlocksNode.d.ts.map +1 -0
  49. package/dist/features/blocks/nodes/InlineBlocksNode.js +93 -0
  50. package/dist/features/blocks/nodes/InlineBlocksNode.js.map +1 -0
  51. package/dist/features/blocks/plugin/commands.d.ts +5 -0
  52. package/dist/features/blocks/plugin/commands.d.ts.map +1 -1
  53. package/dist/features/blocks/plugin/commands.js +2 -0
  54. package/dist/features/blocks/plugin/commands.js.map +1 -1
  55. package/dist/features/blocks/plugin/index.d.ts.map +1 -1
  56. package/dist/features/blocks/plugin/index.js +76 -7
  57. package/dist/features/blocks/plugin/index.js.map +1 -1
  58. package/dist/features/blocks/validate.d.ts +3 -2
  59. package/dist/features/blocks/validate.d.ts.map +1 -1
  60. package/dist/features/blocks/validate.js +2 -2
  61. package/dist/features/blocks/validate.js.map +1 -1
  62. package/dist/features/relationship/nodes/components/RelationshipComponent.d.ts +0 -1
  63. package/dist/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
  64. package/dist/features/relationship/nodes/components/RelationshipComponent.js +2 -3
  65. package/dist/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
  66. package/dist/field/index.js +8 -8
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js.map +1 -1
  69. package/dist/lexical/LexicalProvider.js +2 -2
  70. package/dist/lexical/LexicalProvider.js.map +1 -1
  71. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +4 -4
  72. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  73. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  74. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +0 -1
  75. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  76. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +1 -20
  77. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  78. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +2 -2
  79. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  80. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  81. package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  82. package/dist/lexical/plugins/SlashMenu/index.js +43 -41
  83. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  84. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -1
  85. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  86. package/dist/lexical/ui/icons/InlineBlocks/index.d.ts +3 -0
  87. package/dist/lexical/ui/icons/InlineBlocks/index.d.ts.map +1 -0
  88. package/dist/lexical/ui/icons/InlineBlocks/index.js +20 -0
  89. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -0
  90. package/package.json +9 -9
  91. package/dist/exports/client/Field-5KHQLTCU.js +0 -2
  92. package/dist/exports/client/Field-5KHQLTCU.js.map +0 -7
  93. package/dist/exports/client/RelationshipComponent-EJB6LBDR.js +0 -2
  94. package/dist/exports/client/RelationshipComponent-EJB6LBDR.js.map +0 -7
  95. package/dist/exports/client/chunk-SVDDFJRT.js +0 -2
  96. package/dist/exports/client/chunk-SVDDFJRT.js.map +0 -7
  97. package/dist/exports/client/component-Z5R2PHH3.js +0 -2
  98. package/dist/exports/client/component-Z5R2PHH3.js.map +0 -7
  99. package/dist/features/blocks/drawer/index.d.ts +0 -9
  100. package/dist/features/blocks/drawer/index.d.ts.map +0 -1
  101. package/dist/features/blocks/drawer/index.js +0 -78
  102. package/dist/features/blocks/drawer/index.js.map +0 -1
  103. /package/dist/exports/client/{chunk-LGMNC5KQ.js.map → chunk-HO42U3IJ.js.map} +0 -0
@@ -1,78 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
4
- import { BlocksDrawer, formatDrawerSlug, useEditDepth, useModal, useTranslation } from '@payloadcms/ui';
5
- import { $getNodeByKey, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical';
6
- import React, { useCallback, useEffect, useState } from 'react';
7
- import { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js';
8
- import { $createBlockNode } from '../nodes/BlocksNode.js';
9
- import { INSERT_BLOCK_COMMAND } from '../plugin/commands.js';
10
- const baseClass = 'lexical-blocks-drawer';
11
- export const INSERT_BLOCK_WITH_DRAWER_COMMAND = createCommand('INSERT_BLOCK_WITH_DRAWER_COMMAND');
12
- const insertBlock = ({ blockType, editor, replaceNodeKey })=>{
13
- if (!replaceNodeKey) {
14
- editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
15
- id: null,
16
- blockName: '',
17
- blockType
18
- });
19
- } else {
20
- editor.update(()=>{
21
- const node = $getNodeByKey(replaceNodeKey);
22
- if (node) {
23
- node.replace($createBlockNode({
24
- id: null,
25
- blockName: '',
26
- blockType
27
- }));
28
- }
29
- });
30
- }
31
- };
32
- export const BlocksDrawerComponent = ()=>{
33
- const [editor] = useLexicalComposerContext();
34
- const { editorConfig, uuid } = useEditorConfigContext();
35
- const [replaceNodeKey, setReplaceNodeKey] = useState(null);
36
- const editDepth = useEditDepth();
37
- const { t } = useTranslation();
38
- const { openModal } = useModal();
39
- const labels = {
40
- plural: t('fields:blocks') || 'Blocks',
41
- singular: t('fields:block') || 'Block'
42
- };
43
- const addRow = useCallback((rowIndex, blockType)=>{
44
- insertBlock({
45
- blockType,
46
- editor,
47
- replaceNodeKey
48
- });
49
- }, [
50
- editor,
51
- replaceNodeKey
52
- ]);
53
- const drawerSlug = formatDrawerSlug({
54
- slug: `lexical-rich-text-blocks-` + uuid,
55
- depth: editDepth
56
- });
57
- const reducedBlocks = editorConfig?.resolvedFeatureMap?.get('blocks')?.sanitizedClientFeatureProps?.reducedBlocks;
58
- useEffect(()=>{
59
- return editor.registerCommand(INSERT_BLOCK_WITH_DRAWER_COMMAND, (payload)=>{
60
- setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null);
61
- openModal(drawerSlug);
62
- return true;
63
- }, COMMAND_PRIORITY_EDITOR);
64
- }, [
65
- editor,
66
- drawerSlug,
67
- openModal
68
- ]);
69
- return /*#__PURE__*/ _jsx(BlocksDrawer, {
70
- addRow: addRow,
71
- addRowIndex: 0,
72
- blocks: reducedBlocks,
73
- drawerSlug: drawerSlug,
74
- labels: labels
75
- });
76
- };
77
-
78
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/features/blocks/drawer/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand, LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport {\n BlocksDrawer,\n formatDrawerSlug,\n useEditDepth,\n useModal,\n useTranslation,\n} from '@payloadcms/ui'\nimport { $getNodeByKey, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport type { ClientComponentProps } from '../../typesClient.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { $createBlockNode } from '../nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from '../plugin/commands.js'\nconst baseClass = 'lexical-blocks-drawer'\n\nexport const INSERT_BLOCK_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_BLOCK_WITH_DRAWER_COMMAND')\n\nconst insertBlock = ({\n blockType,\n editor,\n replaceNodeKey,\n}: {\n blockType: string\n editor: LexicalEditor\n replaceNodeKey: null | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType,\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace(\n $createBlockNode({\n id: null,\n blockName: '',\n blockType,\n }),\n )\n }\n })\n }\n}\n\nexport const BlocksDrawerComponent: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const { editorConfig, uuid } = useEditorConfigContext()\n\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n const editDepth = useEditDepth()\n const { t } = useTranslation()\n const { openModal } = useModal()\n\n const labels = {\n plural: t('fields:blocks') || 'Blocks',\n singular: t('fields:block') || 'Block',\n }\n\n const addRow = useCallback(\n (rowIndex: number, blockType: string) => {\n insertBlock({\n blockType,\n editor,\n replaceNodeKey,\n })\n },\n [editor, replaceNodeKey],\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-rich-text-blocks-` + uuid,\n depth: editDepth,\n })\n\n const reducedBlocks = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.sanitizedClientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_BLOCK_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openModal(drawerSlug)\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, drawerSlug, openModal])\n\n return (\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={0}\n blocks={reducedBlocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n )\n}\n"],"names":["useLexicalComposerContext","BlocksDrawer","formatDrawerSlug","useEditDepth","useModal","useTranslation","$getNodeByKey","COMMAND_PRIORITY_EDITOR","createCommand","React","useCallback","useEffect","useState","useEditorConfigContext","$createBlockNode","INSERT_BLOCK_COMMAND","baseClass","INSERT_BLOCK_WITH_DRAWER_COMMAND","insertBlock","blockType","editor","replaceNodeKey","dispatchCommand","id","blockName","update","node","replace","BlocksDrawerComponent","editorConfig","uuid","setReplaceNodeKey","editDepth","t","openModal","labels","plural","singular","addRow","rowIndex","drawerSlug","slug","depth","reducedBlocks","resolvedFeatureMap","get","sanitizedClientFeatureProps","registerCommand","payload","nodeKey","addRowIndex","blocks"],"mappings":"AAAA;;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SACEC,YAAY,EACZC,gBAAgB,EAChBC,YAAY,EACZC,QAAQ,EACRC,cAAc,QACT,iBAAgB;AACvB,SAASC,aAAa,EAAEC,uBAAuB,EAAEC,aAAa,QAAQ,UAAS;AAC/E,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAK/D,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,SA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