@payloadcms/richtext-lexical 3.55.0-internal.f8c92b5 → 3.56.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/exports/client/Field-SOED2PIU.js +2 -0
  2. package/dist/exports/client/{Field-Q3PTZQ75.js.map → Field-SOED2PIU.js.map} +3 -3
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-FSKAVN4P.js +2 -0
  5. package/dist/exports/client/{chunk-CYLMY5ZJ.js.map → chunk-FSKAVN4P.js.map} +2 -2
  6. package/dist/exports/client/chunk-KZKGNMS3.js +12 -0
  7. package/dist/exports/client/{chunk-YCH4JNUH.js.map → chunk-KZKGNMS3.js.map} +2 -2
  8. package/dist/exports/client/{component-3PENNOM3.js → component-M3U253XK.js} +2 -2
  9. package/dist/exports/client/index.d.ts +0 -2
  10. package/dist/exports/client/index.d.ts.map +1 -1
  11. package/dist/exports/client/index.js +10 -10
  12. package/dist/exports/client/index.js.map +4 -4
  13. package/dist/exports/server/rsc.d.ts +0 -1
  14. package/dist/exports/server/rsc.d.ts.map +1 -1
  15. package/dist/exports/server/rsc.js +0 -1
  16. package/dist/exports/server/rsc.js.map +1 -1
  17. package/dist/features/blocks/client/component/BlockContent.js +10 -8
  18. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  19. package/dist/features/converters/lexicalToHtml/async/converters/upload.js +1 -1
  20. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  21. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +1 -1
  22. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  23. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  24. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +39 -124
  25. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  26. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +8 -6
  27. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  28. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +3 -3
  29. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  30. package/dist/features/relationship/client/plugins/index.js +37 -20
  31. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  32. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +53 -28
  33. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
  34. package/dist/features/textState/feature.client.js +3 -1
  35. package/dist/features/textState/feature.client.js.map +1 -1
  36. package/dist/features/textState/feature.server.d.ts.map +1 -1
  37. package/dist/features/textState/feature.server.js +3 -1
  38. package/dist/features/textState/feature.server.js.map +1 -1
  39. package/dist/features/textState/i18n.d.ts +3 -0
  40. package/dist/features/textState/i18n.d.ts.map +1 -0
  41. package/dist/features/textState/i18n.js +108 -0
  42. package/dist/features/textState/i18n.js.map +1 -0
  43. package/dist/features/toolbars/shared/ToolbarButton/index.js +37 -35
  44. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  45. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +30 -20
  46. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  47. package/dist/field/bundled.css +1 -1
  48. package/dist/index.d.ts +1 -2
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +1 -2
  51. package/dist/index.js.map +1 -1
  52. package/dist/lexical/LexicalEditor.js +35 -22
  53. package/dist/lexical/LexicalEditor.js.map +1 -1
  54. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +15 -7
  55. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  56. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +15 -7
  57. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  58. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +141 -75
  59. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  60. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  61. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +3 -1
  62. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  63. package/dist/lexical/ui/ContentEditable.js +11 -2
  64. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  65. package/dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.d.ts +2 -0
  66. package/dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.d.ts.map +1 -0
  67. package/dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.js +2 -0
  68. package/dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.js.map +1 -0
  69. package/dist/nodeTypes.d.ts +1 -13
  70. package/dist/nodeTypes.d.ts.map +1 -1
  71. package/dist/nodeTypes.js +1 -4
  72. package/dist/nodeTypes.js.map +1 -1
  73. package/package.json +26 -21
  74. package/dist/exports/client/Field-Q3PTZQ75.js +0 -2
  75. package/dist/exports/client/chunk-CYLMY5ZJ.js +0 -2
  76. package/dist/exports/client/chunk-YCH4JNUH.js +0 -12
  77. package/dist/field/RenderLexical/renderLexical.d.ts +0 -38
  78. package/dist/field/RenderLexical/renderLexical.d.ts.map +0 -1
  79. package/dist/field/RenderLexical/renderLexical.js +0 -96
  80. package/dist/field/RenderLexical/renderLexical.js.map +0 -1
  81. package/dist/field/RenderLexical/useRenderEditor.d.ts +0 -15
  82. package/dist/field/RenderLexical/useRenderEditor.d.ts.map +0 -1
  83. package/dist/field/RenderLexical/useRenderEditor.js +0 -159
  84. package/dist/field/RenderLexical/useRenderEditor.js.map +0 -1
  85. package/dist/utilities/buildEditorState.d.ts +0 -11
  86. package/dist/utilities/buildEditorState.d.ts.map +0 -1
  87. package/dist/utilities/buildEditorState.js +0 -76
  88. package/dist/utilities/buildEditorState.js.map +0 -1
  89. /package/dist/exports/client/{component-3PENNOM3.js.map → component-M3U253XK.js.map} +0 -0
@@ -1,5 +1,4 @@
1
1
  export { RscEntryLexicalCell } from '../../cell/rscEntry.js';
2
2
  export { LexicalDiffComponent } from '../../field/Diff/index.js';
3
- export { _internal_renderLexical } from '../../field/RenderLexical/renderLexical.js';
4
3
  export { RscEntryLexicalField } from '../../field/rscEntry.js';
5
4
  //# sourceMappingURL=rsc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../../src/exports/server/rsc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAA;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA"}
1
+ {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../../src/exports/server/rsc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA"}
@@ -1,5 +1,4 @@
1
1
  export { RscEntryLexicalCell } from '../../cell/rscEntry.js';
2
2
  export { LexicalDiffComponent } from '../../field/Diff/index.js';
3
- export { _internal_renderLexical } from '../../field/RenderLexical/renderLexical.js';
4
3
  export { RscEntryLexicalField } from '../../field/rscEntry.js';
5
4
  //# sourceMappingURL=rsc.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rsc.js","names":["RscEntryLexicalCell","LexicalDiffComponent","_internal_renderLexical","RscEntryLexicalField"],"sources":["../../../src/exports/server/rsc.ts"],"sourcesContent":["export { RscEntryLexicalCell } from '../../cell/rscEntry.js'\nexport { LexicalDiffComponent } from '../../field/Diff/index.js'\nexport { _internal_renderLexical } from '../../field/RenderLexical/renderLexical.js'\nexport { RscEntryLexicalField } from '../../field/rscEntry.js'\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,uBAAuB,QAAQ;AACxC,SAASC,oBAAoB,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"rsc.js","names":["RscEntryLexicalCell","LexicalDiffComponent","RscEntryLexicalField"],"sources":["../../../src/exports/server/rsc.ts"],"sourcesContent":["export { RscEntryLexicalCell } from '../../cell/rscEntry.js'\nexport { LexicalDiffComponent } from '../../field/Diff/index.js'\nexport { RscEntryLexicalField } from '../../field/rscEntry.js'\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ","ignoreList":[]}
@@ -29,8 +29,9 @@ export const BlockContent = props => {
29
29
  const hasSubmitted = useFormSubmitted();
30
30
  const fieldHasErrors = hasSubmitted && errorCount > 0;
31
31
  let t0;
32
+ let t1;
32
33
  if ($[0] !== Collapsible || $[1] !== errorCount || $[2] !== fieldHasErrors) {
33
- t0 = props_0 => _jsx(Collapsible, {
34
+ t1 = props_0 => _jsx(Collapsible, {
34
35
  editButton: props_0.editButton,
35
36
  errorCount,
36
37
  fieldHasErrors,
@@ -41,14 +42,15 @@ export const BlockContent = props => {
41
42
  $[0] = Collapsible;
42
43
  $[1] = errorCount;
43
44
  $[2] = fieldHasErrors;
44
- $[3] = t0;
45
+ $[3] = t1;
45
46
  } else {
46
- t0 = $[3];
47
+ t1 = $[3];
47
48
  }
49
+ t0 = t1;
48
50
  const CollapsibleWithErrorProps = t0;
49
- let t1;
51
+ let t2;
50
52
  if ($[4] !== BlockDrawer || $[5] !== CollapsibleWithErrorProps || $[6] !== CustomBlock || $[7] !== EditButton || $[8] !== RemoveButton || $[9] !== formSchema || $[10] !== initialState || $[11] !== nodeKey) {
51
- t1 = CustomBlock ? _jsxs(BlockComponentContext, {
53
+ t2 = CustomBlock ? _jsxs(BlockComponentContext, {
52
54
  value: {
53
55
  BlockCollapsible: CollapsibleWithErrorProps,
54
56
  EditButton,
@@ -75,10 +77,10 @@ export const BlockContent = props => {
75
77
  $[9] = formSchema;
76
78
  $[10] = initialState;
77
79
  $[11] = nodeKey;
78
- $[12] = t1;
80
+ $[12] = t2;
79
81
  } else {
80
- t1 = $[12];
82
+ t2 = $[12];
81
83
  }
82
- return t1;
84
+ return t2;
83
85
  };
84
86
  //# sourceMappingURL=BlockContent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BlockContent.js","names":["c","_c","RenderFields","useFormSubmitted","React","createContext","useMemo","BlockComponentContext","initialState","useBlockComponentContext","use","BlockContent","props","$","BlockDrawer","Collapsible","CustomBlock","EditButton","errorCount","formSchema","nodeKey","RemoveButton","hasSubmitted","fieldHasErrors","t0","props_0","_jsx","editButton","Label","removeButton","children","CollapsibleWithErrorProps","t1","_jsxs","value","BlockCollapsible","fields","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions"],"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, FormState } from 'payload'\n\nimport { RenderFields, useFormSubmitted } from '@payloadcms/ui'\nimport React, { createContext, useMemo } from 'react'\n\ntype Props = {\n baseClass: string\n BlockDrawer: React.FC\n Collapsible: React.FC<{\n children?: React.ReactNode\n editButton?: boolean\n errorCount?: number\n fieldHasErrors?: boolean\n /**\n * Override the default label with a custom label\n */\n Label?: React.ReactNode\n removeButton?: boolean\n }>\n CustomBlock: React.ReactNode\n EditButton: React.FC\n errorCount: number\n formSchema: ClientField[]\n initialState: false | FormState | undefined\n\n nodeKey: string\n RemoveButton: React.FC\n}\n\ntype BlockComponentContextType = {\n BlockCollapsible?: React.FC<{\n children?: React.ReactNode\n editButton?: boolean\n /**\n * Override the default label with a custom label\n */\n Label?: React.ReactNode\n removeButton?: boolean\n }>\n EditButton?: React.FC\n initialState: false | FormState | undefined\n\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst BlockComponentContext = createContext<BlockComponentContextType>({\n initialState: false,\n})\n\nexport const useBlockComponentContext = () => React.use(BlockComponentContext)\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<Props> = (props) => {\n const {\n BlockDrawer,\n Collapsible,\n CustomBlock,\n EditButton,\n errorCount,\n formSchema,\n initialState,\n nodeKey,\n RemoveButton,\n } = props\n\n const hasSubmitted = useFormSubmitted()\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n\n const CollapsibleWithErrorProps = useMemo(\n () =>\n (props: {\n children?: React.ReactNode\n editButton?: boolean\n\n /**\n * Override the default label with a custom label\n */\n Label?: React.ReactNode\n removeButton?: boolean\n }) => (\n <Collapsible\n editButton={props.editButton}\n errorCount={errorCount}\n fieldHasErrors={fieldHasErrors}\n Label={props.Label}\n removeButton={props.removeButton}\n >\n {props.children}\n </Collapsible>\n ),\n [Collapsible, fieldHasErrors, errorCount],\n )\n\n return CustomBlock ? (\n <BlockComponentContext\n value={{\n BlockCollapsible: CollapsibleWithErrorProps,\n EditButton,\n initialState,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n <BlockDrawer />\n </BlockComponentContext>\n ) : (\n <CollapsibleWithErrorProps>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n />\n </CollapsibleWithErrorProps>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,YAAY,EAAEC,gBAAgB,QAAQ;AAC/C,OAAOC,KAAA,IAASC,aAAa,EAAEC,OAAO,QAAQ;A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;QAAAY,OAAA;QAAAC;MAAA;MAAAS,QAAA,GAOnBd,WAAA,EACDU,IAAA,CAACZ,WAAA;IAAA,C,IAGHY,IAAA,CAACK,yBAAA;MAAAD,QAAA,EACCJ,IAAA,CAAAxB,YAAA;QAAAkC,MAAA,EACUjB,UAAA;QAAAkB,WAAA;QAAAC,eAAA,EAEQ;QAAAC,UAAA,EACJ;QAAAC,gBAAA,EACK;QAAAC,WAAA;MAAA,C;;;;;;;;;;;;;;SApBhBT,E;CAyBT","ignoreList":[]}
1
+ {"version":3,"file":"BlockContent.js","names":["c","_c","RenderFields","useFormSubmitted","React","createContext","useMemo","BlockComponentContext","initialState","useBlockComponentContext","use","BlockContent","props","$","BlockDrawer","Collapsible","CustomBlock","EditButton","errorCount","formSchema","nodeKey","RemoveButton","hasSubmitted","fieldHasErrors","t0","t1","props_0","_jsx","editButton","Label","removeButton","children","CollapsibleWithErrorProps","t2","_jsxs","value","BlockCollapsible","fields","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions"],"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, FormState } from 'payload'\n\nimport { RenderFields, useFormSubmitted } from '@payloadcms/ui'\nimport React, { createContext, useMemo } from 'react'\n\ntype Props = {\n baseClass: string\n BlockDrawer: React.FC\n Collapsible: React.FC<{\n children?: React.ReactNode\n editButton?: boolean\n errorCount?: number\n fieldHasErrors?: boolean\n /**\n * Override the default label with a custom label\n */\n Label?: React.ReactNode\n removeButton?: boolean\n }>\n CustomBlock: React.ReactNode\n EditButton: React.FC\n errorCount: number\n formSchema: ClientField[]\n initialState: false | FormState | undefined\n\n nodeKey: string\n RemoveButton: React.FC\n}\n\ntype BlockComponentContextType = {\n BlockCollapsible?: React.FC<{\n children?: React.ReactNode\n editButton?: boolean\n /**\n * Override the default label with a custom label\n */\n Label?: React.ReactNode\n removeButton?: boolean\n }>\n EditButton?: React.FC\n initialState: false | FormState | undefined\n\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst BlockComponentContext = createContext<BlockComponentContextType>({\n initialState: false,\n})\n\nexport const useBlockComponentContext = () => React.use(BlockComponentContext)\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<Props> = (props) => {\n const {\n BlockDrawer,\n Collapsible,\n CustomBlock,\n EditButton,\n errorCount,\n formSchema,\n initialState,\n nodeKey,\n RemoveButton,\n } = props\n\n const hasSubmitted = useFormSubmitted()\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n\n const CollapsibleWithErrorProps = useMemo(\n () =>\n (props: {\n children?: React.ReactNode\n editButton?: boolean\n\n /**\n * Override the default label with a custom label\n */\n Label?: React.ReactNode\n removeButton?: boolean\n }) => (\n <Collapsible\n editButton={props.editButton}\n errorCount={errorCount}\n fieldHasErrors={fieldHasErrors}\n Label={props.Label}\n removeButton={props.removeButton}\n >\n {props.children}\n </Collapsible>\n ),\n [Collapsible, fieldHasErrors, errorCount],\n )\n\n return CustomBlock ? (\n <BlockComponentContext\n value={{\n BlockCollapsible: CollapsibleWithErrorProps,\n EditButton,\n initialState,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n <BlockDrawer />\n </BlockComponentContext>\n ) : (\n <CollapsibleWithErrorProps>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n />\n </CollapsibleWithErrorProps>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,YAAY,EAAEC,gBAAgB,QAAQ;AAC/C,OAAOC,KAAA,IAASC,aAAa,EAAEC,OAAO,QAAQ;AA2C9C,MAAMC,qBAAA,gBAAwBF,aAAA,CAAyC;EACrEG,YAAA,EAAc;AAChB;AAEA,OAAO,MAAMC,wBAAA,GAA2BA,CAAA,KAAML,KAAA,CAA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GHa,IAAA,CAACK,yBAAA;MAAAD,QAAA,EACCJ,IAAA,CAAAzB,YAAA;QAAAmC,MAAA,EACUlB,UAAA;QAAAmB,WAAA;QAAAC,eAAA,EAEQ;QAAAC,UAAA,EACJ;QAAAC,gBAAA,EACK;QAAAC,WAAA;MAAA,C;;;;;;;;;;;;;;SApBhBT,E;CAyBT","ignoreList":[]}
@@ -60,7 +60,7 @@ export const UploadHTMLConverterAsync = {
60
60
  width="${uploadDoc.width}"
61
61
  />
62
62
  `;
63
- return `<picture${providedStyleTag}>${pictureHTML}</picture$>`;
63
+ return `<picture${providedStyleTag}>${pictureHTML}</picture>`;
64
64
  }
65
65
  };
66
66
  //# sourceMappingURL=upload.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","names":["UploadHTMLConverterAsync","upload","node","populate","providedStyleTag","uploadNode","uploadDoc","undefined","value","id","collectionSlug","relationTo","url","mimeType","startsWith","filename","sizes","Object","keys","length","height","width","pictureHTML","size","imageSize","filesize"],"sources":["../../../../../../src/features/converters/lexicalToHtml/async/converters/upload.ts"],"sourcesContent":["import type { FileData, FileSizeImproved, TypeWithID } from 'payload'\n\nimport type { SerializedUploadNode } from '../../../../../nodeTypes.js'\nimport type { UploadDataImproved } from '../../../../upload/server/nodes/UploadNode.js'\nimport type { HTMLConvertersAsync } from '../types.js'\n\nexport const UploadHTMLConverterAsync: HTMLConvertersAsync<SerializedUploadNode> = {\n upload: async ({ node, populate, providedStyleTag }) => {\n const uploadNode = node as UploadDataImproved\n\n let uploadDoc: (FileData & TypeWithID) | undefined = undefined\n\n // If there's no valid upload data, populate return an empty string\n if (typeof uploadNode.value !== 'object') {\n if (!populate) {\n return ''\n }\n uploadDoc = await populate<FileData & TypeWithID>({\n id: uploadNode.value,\n collectionSlug: uploadNode.relationTo,\n })\n } else {\n uploadDoc = uploadNode.value as unknown as FileData & TypeWithID\n }\n\n if (!uploadDoc) {\n return ''\n }\n\n const url = uploadDoc.url\n\n // 1) If upload is NOT an image, return a link\n if (!uploadDoc.mimeType.startsWith('image')) {\n return `<a${providedStyleTag} href=\"${url}\" rel=\"noopener noreferrer\">${uploadDoc.filename}</a$>`\n }\n\n // 2) If image has no different sizes, return a simple <img />\n if (!uploadDoc.sizes || !Object.keys(uploadDoc.sizes).length) {\n return `\n <img${providedStyleTag}\n alt=\"${uploadDoc.filename}\"\n height=\"${uploadDoc.height}\"\n src=\"${url}\"\n width=\"${uploadDoc.width}\"\n />\n `\n }\n\n // 3) If image has different sizes, build a <picture> element with <source> tags\n let pictureHTML = ''\n\n for (const size in uploadDoc.sizes) {\n const imageSize = uploadDoc.sizes[size] as FileSizeImproved\n\n if (\n !imageSize ||\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n\n pictureHTML += `\n <source\n media=\"(max-width: ${imageSize.width}px)\"\n srcset=\"${imageSize.url}\"\n type=\"${imageSize.mimeType}\"\n />\n `\n }\n\n pictureHTML += `\n <img\n alt=\"${uploadDoc.filename}\"\n height=\"${uploadDoc.height}\"\n src=\"${url}\"\n width=\"${uploadDoc.width}\"\n />\n `\n\n return `<picture${providedStyleTag}>${pictureHTML}</picture$>`\n },\n}\n"],"mappings":"AAMA,OAAO,MAAMA,wBAAA,GAAsE;EACjFC,MAAA,EAAQ,MAAAA,CAAO;IAAEC,IAAI;IAAEC,QAAQ;IAAEC;EAAgB,CAAE;IACjD,MAAMC,UAAA,GAAaH,IAAA;IAEnB,IAAII,SAAA,GAAiDC,SAAA;IAErD;IACA,IAAI,OAAOF,UAAA,CAAWG,KAAK,KAAK,UAAU;MACxC,IAAI,CAACL,QAAA,EAAU;QACb,OAAO;MACT;MACAG,SAAA,GAAY,MAAMH,QAAA,CAAgC;QAChDM,EAAA,EAAIJ,UAAA,CAAWG,KAAK;QACpBE,cAAA,EAAgBL,UAAA,CAAWM;MAC7B;IACF,OAAO;MACLL,SAAA,GAAYD,UAAA,CAAWG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upload.js","names":["UploadHTMLConverterAsync","upload","node","populate","providedStyleTag","uploadNode","uploadDoc","undefined","value","id","collectionSlug","relationTo","url","mimeType","startsWith","filename","sizes","Object","keys","length","height","width","pictureHTML","size","imageSize","filesize"],"sources":["../../../../../../src/features/converters/lexicalToHtml/async/converters/upload.ts"],"sourcesContent":["import type { FileData, FileSizeImproved, TypeWithID } from 'payload'\n\nimport type { SerializedUploadNode } from '../../../../../nodeTypes.js'\nimport type { UploadDataImproved } from '../../../../upload/server/nodes/UploadNode.js'\nimport type { HTMLConvertersAsync } from '../types.js'\n\nexport const UploadHTMLConverterAsync: HTMLConvertersAsync<SerializedUploadNode> = {\n upload: async ({ node, populate, providedStyleTag }) => {\n const uploadNode = node as UploadDataImproved\n\n let uploadDoc: (FileData & TypeWithID) | undefined = undefined\n\n // If there's no valid upload data, populate return an empty string\n if (typeof uploadNode.value !== 'object') {\n if (!populate) {\n return ''\n }\n uploadDoc = await populate<FileData & TypeWithID>({\n id: uploadNode.value,\n collectionSlug: uploadNode.relationTo,\n })\n } else {\n uploadDoc = uploadNode.value as unknown as FileData & TypeWithID\n }\n\n if (!uploadDoc) {\n return ''\n }\n\n const url = uploadDoc.url\n\n // 1) If upload is NOT an image, return a link\n if (!uploadDoc.mimeType.startsWith('image')) {\n return `<a${providedStyleTag} href=\"${url}\" rel=\"noopener noreferrer\">${uploadDoc.filename}</a$>`\n }\n\n // 2) If image has no different sizes, return a simple <img />\n if (!uploadDoc.sizes || !Object.keys(uploadDoc.sizes).length) {\n return `\n <img${providedStyleTag}\n alt=\"${uploadDoc.filename}\"\n height=\"${uploadDoc.height}\"\n src=\"${url}\"\n width=\"${uploadDoc.width}\"\n />\n `\n }\n\n // 3) If image has different sizes, build a <picture> element with <source> tags\n let pictureHTML = ''\n\n for (const size in uploadDoc.sizes) {\n const imageSize = uploadDoc.sizes[size] as FileSizeImproved\n\n if (\n !imageSize ||\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n\n pictureHTML += `\n <source\n media=\"(max-width: ${imageSize.width}px)\"\n srcset=\"${imageSize.url}\"\n type=\"${imageSize.mimeType}\"\n />\n `\n }\n\n pictureHTML += `\n <img\n alt=\"${uploadDoc.filename}\"\n height=\"${uploadDoc.height}\"\n src=\"${url}\"\n width=\"${uploadDoc.width}\"\n />\n `\n\n return `<picture${providedStyleTag}>${pictureHTML}</picture>`\n },\n}\n"],"mappings":"AAMA,OAAO,MAAMA,wBAAA,GAAsE;EACjFC,MAAA,EAAQ,MAAAA,CAAO;IAAEC,IAAI;IAAEC,QAAQ;IAAEC;EAAgB,CAAE;IACjD,MAAMC,UAAA,GAAaH,IAAA;IAEnB,IAAII,SAAA,GAAiDC,SAAA;IAErD;IACA,IAAI,OAAOF,UAAA,CAAWG,KAAK,KAAK,UAAU;MACxC,IAAI,CAACL,QAAA,EAAU;QACb,OAAO;MACT;MACAG,SAAA,GAAY,MAAMH,QAAA,CAAgC;QAChDM,EAAA,EAAIJ,UAAA,CAAWG,KAAK;QACpBE,cAAA,EAAgBL,UAAA,CAAWM;MAC7B;IACF,OAAO;MACLL,SAAA,GAAYD,UAAA,CAAWG,KAAK;IAC9B;IAEA,IAAI,CAACF,SAAA,EAAW;MACd,OAAO;IACT;IAEA,MAAMM,GAAA,GAAMN,SAAA,CAAUM,GAAG;IAEzB;IACA,IAAI,CAACN,SAAA,CAAUO,QAAQ,CAACC,UAAU,CAAC,UAAU;MAC3C,OAAO,KAAKV,gBAAA,UAA0BQ,GAAA,+BAAkCN,SAAA,CAAUS,QAAQ,OAAO;IACnG;IAEA;IACA,IAAI,CAACT,SAAA,CAAUU,KAAK,IAAI,CAACC,MAAA,CAAOC,IAAI,CAACZ,SAAA,CAAUU,KAAK,EAAEG,MAAM,EAAE;MAC5D,OAAO;cACCf,gBAAA;iBACGE,SAAA,CAAUS,QAAQ;oBACfT,SAAA,CAAUc,MAAM;iBACnBR,GAAA;mBACEN,SAAA,CAAUe,KAAK;;OAE3B;IACH;IAEA;IACA,IAAIC,WAAA,GAAc;IAElB,KAAK,MAAMC,IAAA,IAAQjB,SAAA,CAAUU,KAAK,EAAE;MAClC,MAAMQ,SAAA,GAAYlB,SAAA,CAAUU,KAAK,CAACO,IAAA,CAAK;MAEvC,IACE,CAACC,SAAA,IACD,CAACA,SAAA,CAAUH,KAAK,IAChB,CAACG,SAAA,CAAUJ,MAAM,IACjB,CAACI,SAAA,CAAUX,QAAQ,IACnB,CAACW,SAAA,CAAUC,QAAQ,IACnB,CAACD,SAAA,CAAUT,QAAQ,IACnB,CAACS,SAAA,CAAUZ,GAAG,EACd;QACA;MACF;MAEAU,WAAA,IAAe;;+BAEUE,SAAA,CAAUH,KAAK;oBAC1BG,SAAA,CAAUZ,GAAG;kBACfY,SAAA,CAAUX,QAAQ;;OAE7B;IACH;IAEAS,WAAA,IAAe;;eAEJhB,SAAA,CAAUS,QAAQ;kBACfT,SAAA,CAAUc,MAAM;eACnBR,GAAA;iBACEN,SAAA,CAAUe,KAAK;;KAE3B;IAED,OAAO,WAAWjB,gBAAA,IAAoBkB,WAAA,YAAuB;EAC/D;AACF","ignoreList":[]}
@@ -53,7 +53,7 @@ export const UploadHTMLConverter = {
53
53
  width="${uploadDoc.width}"
54
54
  />
55
55
  `;
56
- return `<picture${providedStyleTag}>${pictureHTML}</picture$>`;
56
+ return `<picture${providedStyleTag}>${pictureHTML}</picture>`;
57
57
  }
58
58
  };
59
59
  //# sourceMappingURL=upload.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","names":["UploadHTMLConverter","upload","node","providedStyleTag","uploadNode","uploadDoc","undefined","value","url","mimeType","startsWith","filename","sizes","Object","keys","length","height","width","pictureHTML","size","imageSize","filesize"],"sources":["../../../../../../src/features/converters/lexicalToHtml/sync/converters/upload.ts"],"sourcesContent":["import type { FileData, FileSizeImproved, TypeWithID } from 'payload'\n\nimport type { SerializedUploadNode } from '../../../../../nodeTypes.js'\nimport type { UploadDataImproved } from '../../../../upload/server/nodes/UploadNode.js'\nimport type { HTMLConverters } from '../types.js'\n\nexport const UploadHTMLConverter: HTMLConverters<SerializedUploadNode> = {\n upload: ({ node, providedStyleTag }) => {\n const uploadNode = node as UploadDataImproved\n\n let uploadDoc: (FileData & TypeWithID) | undefined = undefined\n\n // If there's no valid upload data, populate return an empty string\n if (typeof uploadNode.value !== 'object') {\n return ''\n } else {\n uploadDoc = uploadNode.value as unknown as FileData & TypeWithID\n }\n\n if (!uploadDoc) {\n return ''\n }\n\n const url = uploadDoc.url\n\n // 1) If upload is NOT an image, return a link\n if (!uploadDoc.mimeType.startsWith('image')) {\n return `<a${providedStyleTag} href=\"${url}\" rel=\"noopener noreferrer\">${uploadDoc.filename}</a$>`\n }\n\n // 2) If image has no different sizes, return a simple <img />\n if (!uploadDoc.sizes || !Object.keys(uploadDoc.sizes).length) {\n return `\n <img${providedStyleTag}\n alt=\"${uploadDoc.filename}\"\n height=\"${uploadDoc.height}\"\n src=\"${url}\"\n width=\"${uploadDoc.width}\"\n />\n `\n }\n\n // 3) If image has different sizes, build a <picture> element with <source> tags\n let pictureHTML = ''\n\n for (const size in uploadDoc.sizes) {\n const imageSize = uploadDoc.sizes[size] as FileSizeImproved\n\n if (\n !imageSize ||\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n\n pictureHTML += `\n <source\n media=\"(max-width: ${imageSize.width}px)\"\n srcset=\"${imageSize.url}\"\n type=\"${imageSize.mimeType}\"\n />\n `\n }\n\n pictureHTML += `\n <img\n alt=\"${uploadDoc.filename}\"\n height=\"${uploadDoc.height}\"\n src=\"${url}\"\n width=\"${uploadDoc.width}\"\n />\n `\n\n return `<picture${providedStyleTag}>${pictureHTML}</picture$>`\n },\n}\n"],"mappings":"AAMA,OAAO,MAAMA,mBAAA,GAA4D;EACvEC,MAAA,EAAQA,CAAC;IAAEC,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IAAe;;eAEJb,SAAA,CAAUM,QAAQ;kBACfN,SAAA,CAAUW,MAAM;eACnBR,GAAA;iBACEH,SAAA,CAAUY,KAAK;;KAE3B;IAED,OAAO,WAAWd,gBAAA,IAAoBe,WAAA,aAAwB;EAChE;AACF","ignoreList":[]}
1
+ {"version":3,"file":"upload.js","names":["UploadHTMLConverter","upload","node","providedStyleTag","uploadNode","uploadDoc","undefined","value","url","mimeType","startsWith","filename","sizes","Object","keys","length","height","width","pictureHTML","size","imageSize","filesize"],"sources":["../../../../../../src/features/converters/lexicalToHtml/sync/converters/upload.ts"],"sourcesContent":["import type { FileData, FileSizeImproved, TypeWithID } from 'payload'\n\nimport type { SerializedUploadNode } from '../../../../../nodeTypes.js'\nimport type { UploadDataImproved } from '../../../../upload/server/nodes/UploadNode.js'\nimport type { HTMLConverters } from '../types.js'\n\nexport const UploadHTMLConverter: HTMLConverters<SerializedUploadNode> = {\n upload: ({ node, providedStyleTag }) => {\n const uploadNode = node as UploadDataImproved\n\n let uploadDoc: (FileData & TypeWithID) | undefined = undefined\n\n // If there's no valid upload data, populate return an empty string\n if (typeof uploadNode.value !== 'object') {\n return ''\n } else {\n uploadDoc = uploadNode.value as unknown as FileData & TypeWithID\n }\n\n if (!uploadDoc) {\n return ''\n }\n\n const url = uploadDoc.url\n\n // 1) If upload is NOT an image, return a link\n if (!uploadDoc.mimeType.startsWith('image')) {\n return `<a${providedStyleTag} href=\"${url}\" rel=\"noopener noreferrer\">${uploadDoc.filename}</a$>`\n }\n\n // 2) If image has no different sizes, return a simple <img />\n if (!uploadDoc.sizes || !Object.keys(uploadDoc.sizes).length) {\n return `\n <img${providedStyleTag}\n alt=\"${uploadDoc.filename}\"\n height=\"${uploadDoc.height}\"\n src=\"${url}\"\n width=\"${uploadDoc.width}\"\n />\n `\n }\n\n // 3) If image has different sizes, build a <picture> element with <source> tags\n let pictureHTML = ''\n\n for (const size in uploadDoc.sizes) {\n const imageSize = uploadDoc.sizes[size] as FileSizeImproved\n\n if (\n !imageSize ||\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n\n pictureHTML += `\n <source\n media=\"(max-width: ${imageSize.width}px)\"\n srcset=\"${imageSize.url}\"\n type=\"${imageSize.mimeType}\"\n />\n `\n }\n\n pictureHTML += `\n <img\n alt=\"${uploadDoc.filename}\"\n height=\"${uploadDoc.height}\"\n src=\"${url}\"\n width=\"${uploadDoc.width}\"\n />\n `\n\n return `<picture${providedStyleTag}>${pictureHTML}</picture>`\n },\n}\n"],"mappings":"AAMA,OAAO,MAAMA,mBAAA,GAA4D;EACvEC,MAAA,EAAQA,CAAC;IAAEC,IAAI;IAAEC;EAAgB,CAAE;IACjC,MAAMC,UAAA,GAAaF,IAAA;IAEnB,IAAIG,SAAA,GAAiDC,SAAA;IAErD;IACA,IAAI,OAAOF,UAAA,CAAWG,KAAK,KAAK,UAAU;MACxC,OAAO;IACT,OAAO;MACLF,SAAA,GAAYD,UAAA,CAAWG,KAAK;IAC9B;IAEA,IAAI,CAACF,SAAA,EAAW;MACd,OAAO;IACT;IAEA,MAAMG,GAAA,GAAMH,SAAA,CAAUG,GAAG;IAEzB;IACA,IAAI,CAACH,SAAA,CAAUI,QAAQ,CAACC,UAAU,CAAC,UAAU;MAC3C,OAAO,KAAKP,gBAAA,UAA0BK,GAAA,+BAAkCH,SAAA,CAAUM,QAAQ,OAAO;IACnG;IAEA;IACA,IAAI,CAACN,SAAA,CAAUO,KAAK,IAAI,CAACC,MAAA,CAAOC,IAAI,CAACT,SAAA,CAAUO,KAAK,EAAEG,MAAM,EAAE;MAC5D,OAAO;cACCZ,gBAAA;iBACGE,SAAA,CAAUM,QAAQ;oBACfN,SAAA,CAAUW,MAAM;iBACnBR,GAAA;mBACEH,SAAA,CAAUY,KAAK;;OAE3B;IACH;IAEA;IACA,IAAIC,WAAA,GAAc;IAElB,KAAK,MAAMC,IAAA,IAAQd,SAAA,CAAUO,KAAK,EAAE;MAClC,MAAMQ,SAAA,GAAYf,SAAA,CAAUO,KAAK,CAACO,IAAA,CAAK;MAEvC,IACE,CAACC,SAAA,IACD,CAACA,SAAA,CAAUH,KAAK,IAChB,CAACG,SAAA,CAAUJ,MAAM,IACjB,CAACI,SAAA,CAAUX,QAAQ,IACnB,CAACW,SAAA,CAAUC,QAAQ,IACnB,CAACD,SAAA,CAAUT,QAAQ,IACnB,CAACS,SAAA,CAAUZ,GAAG,EACd;QACA;MACF;MAEAU,WAAA,IAAe;;+BAEUE,SAAA,CAAUH,KAAK;oBAC1BG,SAAA,CAAUZ,GAAG;kBACfY,SAAA,CAAUX,QAAQ;;OAE7B;IACH;IAEAS,WAAA,IAAe;;eAEJb,SAAA,CAAUM,QAAQ;kBACfN,SAAA,CAAUW,MAAM;eACnBR,GAAA;iBACEH,SAAA,CAAUY,KAAK;;KAE3B;IAED,OAAO,WAAWd,gBAAA,IAAoBe,WAAA,YAAuB;EAC/D;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/experimental_table/client/plugins/TableActionMenuPlugin/index.tsx"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAE3E,OAAO,cAAc,CAAA;AAmvBrB,eAAO,MAAM,qBAAqB,EAAE,yBAQnC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/experimental_table/client/plugins/TableActionMenuPlugin/index.tsx"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAE3E,OAAO,cAAc,CAAA;AA6oBrB,eAAO,MAAM,qBAAqB,EAAE,yBAQnC,CAAA"}
@@ -4,10 +4,10 @@ import { c as _c } from "react/compiler-runtime";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
6
6
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
7
- import { $computeTableMapSkipCellCheck, $deleteTableColumn__EXPERIMENTAL, $deleteTableRow__EXPERIMENTAL, $getNodeTriplet, $getTableCellNodeFromLexicalNode, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $insertTableColumn__EXPERIMENTAL, $insertTableRow__EXPERIMENTAL, $isTableCellNode, $isTableSelection, $unmergeCell, getTableElement, getTableObserverFromTableElement, TableCellHeaderStates, TableCellNode } from '@lexical/table';
7
+ import { $computeTableMapSkipCellCheck, $deleteTableColumnAtSelection, $deleteTableRowAtSelection, $getNodeTriplet, $getTableCellNodeFromLexicalNode, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $insertTableColumnAtSelection, $insertTableRowAtSelection, $isTableCellNode, $isTableSelection, $mergeCells, $unmergeCell, getTableElement, getTableObserverFromTableElement, TableCellHeaderStates, TableCellNode } from '@lexical/table';
8
8
  import { mergeRegister } from '@lexical/utils';
9
9
  import { useScrollInfo } from '@payloadcms/ui';
10
- import { $createParagraphNode, $getSelection, $isElementNode, $isParagraphNode, $isRangeSelection, $isTextNode, $setSelection, COMMAND_PRIORITY_CRITICAL, getDOMSelection, isDOMNode, SELECTION_CHANGE_COMMAND } from 'lexical';
10
+ import { $getSelection, $isElementNode, $isRangeSelection, $isTextNode, $setSelection, COMMAND_PRIORITY_CRITICAL, getDOMSelection, isDOMNode, SELECTION_CHANGE_COMMAND } from 'lexical';
11
11
  import * as React from 'react';
12
12
  import { useCallback, useEffect, useRef, useState } from 'react';
13
13
  import { createPortal } from 'react-dom';
@@ -27,16 +27,6 @@ function $canUnmerge() {
27
27
  const [cell] = $getNodeTriplet(selection.anchor);
28
28
  return cell.__colSpan > 1 || cell.__rowSpan > 1;
29
29
  }
30
- function $cellContainsEmptyParagraph(cell) {
31
- if (cell.getChildrenSize() !== 1) {
32
- return false;
33
- }
34
- const firstChild = cell.getFirstChildOrThrow();
35
- if (!$isParagraphNode(firstChild) || !firstChild.isEmpty()) {
36
- return false;
37
- }
38
- return true;
39
- }
40
30
  function $selectLastDescendant(node) {
41
31
  const lastDescendant = node.getLastDescendant();
42
32
  if ($isTextNode(lastDescendant)) {
@@ -145,88 +135,13 @@ function TableActionMenu({
145
135
  const mergeTableCellsAtSelection = () => {
146
136
  editor.update(() => {
147
137
  const selection_0 = $getSelection();
148
- if ($isTableSelection(selection_0)) {
149
- // Get all selected cells and compute the total area
150
- const nodes = selection_0.getNodes();
151
- const tableCells = nodes.filter($isTableCellNode);
152
- if (tableCells.length === 0) {
153
- return;
154
- }
155
- // Find the table node
156
- const tableNode_0 = $getTableNodeFromLexicalNodeOrThrow(tableCells[0]);
157
- const [gridMap] = $computeTableMapSkipCellCheck(tableNode_0, null, null);
158
- // Find the boundaries of the selection including merged cells
159
- let minRow = Infinity;
160
- let maxRow = -Infinity;
161
- let minCol = Infinity;
162
- let maxCol = -Infinity;
163
- // First pass: find the actual boundaries considering merged cells
164
- const processedCells = new Set();
165
- for (const row of gridMap) {
166
- for (const mapCell of row) {
167
- if (!mapCell || !mapCell.cell) {
168
- continue;
169
- }
170
- const cellKey = mapCell.cell.getKey();
171
- if (processedCells.has(cellKey)) {
172
- continue;
173
- }
174
- if (tableCells.some(cell => cell.is(mapCell.cell))) {
175
- processedCells.add(cellKey);
176
- // Get the actual position of this cell in the grid
177
- const cellStartRow = mapCell.startRow;
178
- const cellStartCol = mapCell.startColumn;
179
- const cellRowSpan = mapCell.cell.__rowSpan || 1;
180
- const cellColSpan = mapCell.cell.__colSpan || 1;
181
- // Update boundaries considering the cell's actual position and span
182
- minRow = Math.min(minRow, cellStartRow);
183
- maxRow = Math.max(maxRow, cellStartRow + cellRowSpan - 1);
184
- minCol = Math.min(minCol, cellStartCol);
185
- maxCol = Math.max(maxCol, cellStartCol + cellColSpan - 1);
186
- }
187
- }
188
- }
189
- // Validate boundaries
190
- if (minRow === Infinity || minCol === Infinity) {
191
- return;
192
- }
193
- // The total span of the merged cell
194
- const totalRowSpan = maxRow - minRow + 1;
195
- const totalColSpan = maxCol - minCol + 1;
196
- // Use the top-left cell as the target cell
197
- const targetCellMap = gridMap?.[minRow]?.[minCol];
198
- if (!targetCellMap?.cell) {
199
- return;
200
- }
201
- const targetCell = targetCellMap.cell;
202
- // Set the spans for the target cell
203
- targetCell.setColSpan(totalColSpan);
204
- targetCell.setRowSpan(totalRowSpan);
205
- // Move content from other cells to the target cell
206
- const seenCells = new Set([targetCell.getKey()]);
207
- // Second pass: merge content and remove other cells
208
- for (let row_0 = minRow; row_0 <= maxRow; row_0++) {
209
- for (let col = minCol; col <= maxCol; col++) {
210
- const mapCell_0 = gridMap?.[row_0]?.[col];
211
- if (!mapCell_0?.cell) {
212
- continue;
213
- }
214
- const currentCell = mapCell_0.cell;
215
- const key = currentCell.getKey();
216
- if (!seenCells.has(key)) {
217
- seenCells.add(key);
218
- const isEmpty = $cellContainsEmptyParagraph(currentCell);
219
- if (!isEmpty) {
220
- targetCell.append(...currentCell.getChildren());
221
- }
222
- currentCell.remove();
223
- }
224
- }
225
- }
226
- // Ensure target cell has content
227
- if (targetCell.getChildrenSize() === 0) {
228
- targetCell.append($createParagraphNode());
229
- }
138
+ if (!$isTableSelection(selection_0)) {
139
+ return;
140
+ }
141
+ const nodes = selection_0.getNodes();
142
+ const tableCells = nodes.filter($isTableCellNode);
143
+ const targetCell = $mergeCells(tableCells);
144
+ if (targetCell) {
230
145
  $selectLastDescendant(targetCell);
231
146
  onClose();
232
147
  }
@@ -240,7 +155,7 @@ function TableActionMenu({
240
155
  const insertTableRowAtSelection = useCallback(shouldInsertAfter => {
241
156
  editor.update(() => {
242
157
  for (let i = 0; i < selectionCounts.rows; i++) {
243
- $insertTableRow__EXPERIMENTAL(shouldInsertAfter);
158
+ $insertTableRowAtSelection(shouldInsertAfter);
244
159
  }
245
160
  onClose();
246
161
  });
@@ -248,47 +163,47 @@ function TableActionMenu({
248
163
  const insertTableColumnAtSelection = useCallback(shouldInsertAfter_0 => {
249
164
  editor.update(() => {
250
165
  for (let i_0 = 0; i_0 < selectionCounts.columns; i_0++) {
251
- $insertTableColumn__EXPERIMENTAL(shouldInsertAfter_0);
166
+ $insertTableColumnAtSelection(shouldInsertAfter_0);
252
167
  }
253
168
  onClose();
254
169
  });
255
170
  }, [editor, onClose, selectionCounts.columns]);
256
171
  const deleteTableRowAtSelection = useCallback(() => {
257
172
  editor.update(() => {
258
- $deleteTableRow__EXPERIMENTAL();
173
+ $deleteTableRowAtSelection();
259
174
  onClose();
260
175
  });
261
176
  }, [editor, onClose]);
262
177
  const deleteTableAtSelection = useCallback(() => {
263
178
  editor.update(() => {
264
- const tableNode_1 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
265
- tableNode_1.remove();
179
+ const tableNode_0 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
180
+ tableNode_0.remove();
266
181
  clearTableSelection();
267
182
  onClose();
268
183
  });
269
184
  }, [editor, tableCellNode, clearTableSelection, onClose]);
270
185
  const deleteTableColumnAtSelection = useCallback(() => {
271
186
  editor.update(() => {
272
- $deleteTableColumn__EXPERIMENTAL();
187
+ $deleteTableColumnAtSelection();
273
188
  onClose();
274
189
  });
275
190
  }, [editor, onClose]);
276
191
  const toggleTableRowIsHeader = useCallback(() => {
277
192
  editor.update(() => {
278
- const tableNode_2 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
193
+ const tableNode_1 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
279
194
  const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode);
280
- const [gridMap_0] = $computeTableMapSkipCellCheck(tableNode_2, null, null);
195
+ const [gridMap] = $computeTableMapSkipCellCheck(tableNode_1, null, null);
281
196
  const rowCells = new Set();
282
197
  const newStyle = tableCellNode.getHeaderStyles() ^ TableCellHeaderStates.ROW;
283
- if (gridMap_0[tableRowIndex]) {
284
- for (let col_0 = 0; col_0 < gridMap_0[tableRowIndex].length; col_0++) {
285
- const mapCell_1 = gridMap_0[tableRowIndex][col_0];
286
- if (!mapCell_1?.cell) {
198
+ if (gridMap[tableRowIndex]) {
199
+ for (let col = 0; col < gridMap[tableRowIndex].length; col++) {
200
+ const mapCell = gridMap[tableRowIndex][col];
201
+ if (!mapCell?.cell) {
287
202
  continue;
288
203
  }
289
- if (!rowCells.has(mapCell_1.cell)) {
290
- rowCells.add(mapCell_1.cell);
291
- mapCell_1.cell.setHeaderStyles(newStyle, TableCellHeaderStates.ROW);
204
+ if (!rowCells.has(mapCell.cell)) {
205
+ rowCells.add(mapCell.cell);
206
+ mapCell.cell.setHeaderStyles(newStyle, TableCellHeaderStates.ROW);
292
207
  }
293
208
  }
294
209
  }
@@ -298,20 +213,20 @@ function TableActionMenu({
298
213
  }, [editor, tableCellNode, clearTableSelection, onClose]);
299
214
  const toggleTableColumnIsHeader = useCallback(() => {
300
215
  editor.update(() => {
301
- const tableNode_3 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
216
+ const tableNode_2 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
302
217
  const tableColumnIndex = $getTableColumnIndexFromTableCellNode(tableCellNode);
303
- const [gridMap_1] = $computeTableMapSkipCellCheck(tableNode_3, null, null);
218
+ const [gridMap_0] = $computeTableMapSkipCellCheck(tableNode_2, null, null);
304
219
  const columnCells = new Set();
305
220
  const newStyle_0 = tableCellNode.getHeaderStyles() ^ TableCellHeaderStates.COLUMN;
306
- if (gridMap_1) {
307
- for (let row_1 = 0; row_1 < gridMap_1.length; row_1++) {
308
- const mapCell_2 = gridMap_1?.[row_1]?.[tableColumnIndex];
309
- if (!mapCell_2?.cell) {
221
+ if (gridMap_0) {
222
+ for (let row = 0; row < gridMap_0.length; row++) {
223
+ const mapCell_0 = gridMap_0?.[row]?.[tableColumnIndex];
224
+ if (!mapCell_0?.cell) {
310
225
  continue;
311
226
  }
312
- if (!columnCells.has(mapCell_2.cell)) {
313
- columnCells.add(mapCell_2.cell);
314
- mapCell_2.cell.setHeaderStyles(newStyle_0, TableCellHeaderStates.COLUMN);
227
+ if (!columnCells.has(mapCell_0.cell)) {
228
+ columnCells.add(mapCell_0.cell);
229
+ mapCell_0.cell.setHeaderStyles(newStyle_0, TableCellHeaderStates.COLUMN);
315
230
  }
316
231
  }
317
232
  }
@@ -322,9 +237,9 @@ function TableActionMenu({
322
237
  const toggleRowStriping = useCallback(() => {
323
238
  editor.update(() => {
324
239
  if (tableCellNode.isAttached()) {
325
- const tableNode_4 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
326
- if (tableNode_4) {
327
- tableNode_4.setRowStriping(!tableNode_4.getRowStriping());
240
+ const tableNode_3 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
241
+ if (tableNode_3) {
242
+ tableNode_3.setRowStriping(!tableNode_3.getRowStriping());
328
243
  }
329
244
  }
330
245
  clearTableSelection();
@@ -334,9 +249,9 @@ function TableActionMenu({
334
249
  const toggleFirstColumnFreeze = useCallback(() => {
335
250
  editor.update(() => {
336
251
  if (tableCellNode.isAttached()) {
337
- const tableNode_5 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
338
- if (tableNode_5) {
339
- tableNode_5.setFrozenColumns(tableNode_5.getFrozenColumns() === 0 ? 1 : 0);
252
+ const tableNode_4 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
253
+ if (tableNode_4) {
254
+ tableNode_4.setFrozenColumns(tableNode_4.getFrozenColumns() === 0 ? 1 : 0);
340
255
  }
341
256
  }
342
257
  clearTableSelection();