@payloadcms/richtext-lexical 3.60.0-internal.40d58c0 → 3.60.0-internal.c130254

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 (96) hide show
  1. package/dist/exports/client/Field-YHS7VMOE.js +2 -0
  2. package/dist/exports/client/Field-YHS7VMOE.js.map +7 -0
  3. package/dist/exports/client/{chunk-IBFFIWII.js → chunk-ADWHGDDR.js} +2 -2
  4. package/dist/exports/client/{chunk-IBFFIWII.js.map → chunk-ADWHGDDR.js.map} +2 -2
  5. package/dist/exports/client/componentInline-MIPTDFRK.js +2 -0
  6. package/dist/exports/client/index.js +12 -12
  7. package/dist/exports/client/index.js.map +4 -4
  8. package/dist/features/blockquote/server/index.d.ts +3 -4
  9. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  10. package/dist/features/blockquote/server/index.js.map +1 -1
  11. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +4 -4
  12. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  13. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  14. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +4 -4
  15. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  16. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  17. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.d.ts +10 -1
  18. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.d.ts.map +1 -1
  19. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.js +10 -1
  20. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.js.map +1 -1
  21. package/dist/features/converters/lexicalToHtml_deprecated/field/index.d.ts.map +1 -1
  22. package/dist/features/converters/lexicalToHtml_deprecated/field/index.js.map +1 -1
  23. package/dist/features/converters/lexicalToHtml_deprecated/index.d.ts +2 -1
  24. package/dist/features/converters/lexicalToHtml_deprecated/index.d.ts.map +1 -1
  25. package/dist/features/converters/lexicalToHtml_deprecated/index.js +2 -1
  26. package/dist/features/converters/lexicalToHtml_deprecated/index.js.map +1 -1
  27. package/dist/features/experimental_table/server/index.d.ts +5 -10
  28. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  29. package/dist/features/experimental_table/server/index.js.map +1 -1
  30. package/dist/features/heading/server/index.d.ts +3 -4
  31. package/dist/features/heading/server/index.d.ts.map +1 -1
  32. package/dist/features/heading/server/index.js.map +1 -1
  33. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +3 -4
  34. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  35. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  36. package/dist/features/link/nodes/types.d.ts +6 -6
  37. package/dist/features/link/nodes/types.d.ts.map +1 -1
  38. package/dist/features/link/nodes/types.js.map +1 -1
  39. package/dist/features/lists/checklist/client/index.d.ts.map +1 -1
  40. package/dist/features/lists/checklist/client/index.js +4 -2
  41. package/dist/features/lists/checklist/client/index.js.map +1 -1
  42. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  43. package/dist/features/lists/checklist/server/index.js +3 -2
  44. package/dist/features/lists/checklist/server/index.js.map +1 -1
  45. package/dist/features/lists/orderedList/client/index.d.ts.map +1 -1
  46. package/dist/features/lists/orderedList/client/index.js +5 -3
  47. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  48. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  49. package/dist/features/lists/orderedList/server/index.js +3 -2
  50. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  51. package/dist/features/lists/plugin/index.d.ts +6 -7
  52. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  53. package/dist/features/lists/plugin/index.js.map +1 -1
  54. package/dist/features/lists/shared/shouldRegisterListBaseNodes.d.ts +2 -0
  55. package/dist/features/lists/shared/shouldRegisterListBaseNodes.d.ts.map +1 -0
  56. package/dist/features/lists/shared/shouldRegisterListBaseNodes.js +14 -0
  57. package/dist/features/lists/shared/shouldRegisterListBaseNodes.js.map +1 -0
  58. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +3 -4
  59. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  60. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  61. package/dist/features/textState/feature.client.js +9 -7
  62. package/dist/features/textState/feature.client.js.map +1 -1
  63. package/dist/features/textState/textState.d.ts +11 -5
  64. package/dist/features/textState/textState.d.ts.map +1 -1
  65. package/dist/features/textState/textState.js +6 -3
  66. package/dist/features/textState/textState.js.map +1 -1
  67. package/dist/features/typesServer.d.ts +4 -4
  68. package/dist/features/typesServer.d.ts.map +1 -1
  69. package/dist/features/typesServer.js.map +1 -1
  70. package/dist/features/upload/server/nodes/UploadNode.d.ts +3 -4
  71. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  72. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  73. package/dist/field/RenderLexical/index.d.ts +2 -1
  74. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  75. package/dist/field/RenderLexical/index.js.map +1 -1
  76. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  77. package/dist/lexical/LexicalEditor.js +2 -1
  78. package/dist/lexical/LexicalEditor.js.map +1 -1
  79. package/dist/lexical/plugins/ClipboardPlugin/index.d.ts +2 -0
  80. package/dist/lexical/plugins/ClipboardPlugin/index.d.ts.map +1 -0
  81. package/dist/lexical/plugins/ClipboardPlugin/index.js +64 -0
  82. package/dist/lexical/plugins/ClipboardPlugin/index.js.map +1 -0
  83. package/dist/nodeTypes.d.ts +31 -14
  84. package/dist/nodeTypes.d.ts.map +1 -1
  85. package/dist/nodeTypes.js.map +1 -1
  86. package/dist/types.d.ts +2 -1
  87. package/dist/types.d.ts.map +1 -1
  88. package/dist/types.js.map +1 -1
  89. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  90. package/dist/utilities/buildEditorState.js +1 -0
  91. package/dist/utilities/buildEditorState.js.map +1 -1
  92. package/package.json +7 -6
  93. package/dist/exports/client/Field-CJFETHA3.js +0 -2
  94. package/dist/exports/client/Field-CJFETHA3.js.map +0 -7
  95. package/dist/exports/client/componentInline-ZHQ2OTFH.js +0 -2
  96. /package/dist/exports/client/{componentInline-ZHQ2OTFH.js.map → componentInline-MIPTDFRK.js.map} +0 -0
@@ -1,5 +1,6 @@
1
- import type { SerializedElementNode, SerializedLexicalNode, Spread } from 'lexical';
1
+ import type { SerializedElementNode, SerializedLexicalNode } from 'lexical';
2
2
  import type { DefaultDocumentIDType, JsonValue } from 'payload';
3
+ import type { StronglyTypedElementNode } from '../../../nodeTypes.js';
3
4
  export type LinkFields = {
4
5
  [key: string]: JsonValue;
5
6
  doc?: {
@@ -13,15 +14,14 @@ export type LinkFields = {
13
14
  newTab: boolean;
14
15
  url?: string;
15
16
  };
16
- export type SerializedLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = Spread<{
17
+ export type SerializedLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {
17
18
  fields: LinkFields;
18
19
  /**
19
20
  * @todo make required in 4.0 and type AutoLinkNode differently
20
21
  */
21
22
  id?: string;
22
- type: 'link';
23
- }, SerializedElementNode<T>>;
23
+ } & StronglyTypedElementNode<SerializedElementNode, 'link', T>;
24
24
  export type SerializedAutoLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {
25
- type: 'autolink';
26
- } & Omit<SerializedLinkNode<T>, 'id' | 'type'>;
25
+ fields: LinkFields;
26
+ } & StronglyTypedElementNode<SerializedElementNode, 'autolink', T>;
27
27
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/features/link/nodes/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACnF,OAAO,KAAK,EA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S,CAAA;IACxB,GAAG,CAAC,EAAE;QACJ,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EACD;YAEE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;YACxB,EAAE,EAAE,qBAAqB,CAAA;SAC1B,GACD,qBAAqB,CAAA;KAC1B,GAAG,IAAI,CAAA;IACR,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC/B,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IAAI;IACxF,MAAM,EAAE,UAAU,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,GAAG,wBAAwB,CAAC,qBAAqB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;AAE9D,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IAAI;IAC5F,MAAM,EAAE,UAAU,CAAA;CACnB,GAAG,wBAAwB,CAAC,qBAAqB,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/features/link/nodes/types.ts"],"sourcesContent":["import type { SerializedElementNode, SerializedLexicalNode, Spread } from 'lexical'\nimport type { DefaultDocumentIDType, JsonValue } from 'payload'\n\nexport type LinkFields = {\n [key: string]: JsonValue\n doc?: {\n relationTo: string\n value:\n | {\n // Actual doc data, populated in afterRead hook\n [key: string]: JsonValue\n id: DefaultDocumentIDType\n }\n | DefaultDocumentIDType\n } | null\n linkType: 'custom' | 'internal'\n newTab: boolean\n url?: string\n}\n\nexport type SerializedLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = Spread<\n {\n fields: LinkFields\n /**\n * @todo make required in 4.0 and type AutoLinkNode differently\n */\n id?: string // optional if AutoLinkNode\n type: 'link'\n },\n SerializedElementNode<T>\n>\nexport type SerializedAutoLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n type: 'autolink'\n} & Omit<SerializedLinkNode<T>, 'id' | 'type'>\n"],"mappings":"AA+BA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/features/link/nodes/types.ts"],"sourcesContent":["import type { SerializedElementNode, SerializedLexicalNode } from 'lexical'\nimport type { DefaultDocumentIDType, JsonValue } from 'payload'\n\nimport type { StronglyTypedElementNode } from '../../../nodeTypes.js'\n\nexport type LinkFields = {\n [key: string]: JsonValue\n doc?: {\n relationTo: string\n value:\n | {\n // Actual doc data, populated in afterRead hook\n [key: string]: JsonValue\n id: DefaultDocumentIDType\n }\n | DefaultDocumentIDType\n } | null\n linkType: 'custom' | 'internal'\n newTab: boolean\n url?: string\n}\n\nexport type SerializedLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n fields: LinkFields\n /**\n * @todo make required in 4.0 and type AutoLinkNode differently\n */\n id?: string // optional if AutoLinkNode\n} & StronglyTypedElementNode<SerializedElementNode, 'link', T>\n\nexport type SerializedAutoLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n fields: LinkFields\n} & StronglyTypedElementNode<SerializedElementNode, 'autolink', T>\n"],"mappings":"AA8BA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/lists/checklist/client/index.tsx"],"names":[],"mappings":"AAwDA,eAAO,MAAM,sBAAsB,uFA8CjC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/lists/checklist/client/index.tsx"],"names":[],"mappings":"AAyDA,eAAO,MAAM,sBAAsB,uFA4CjC,CAAA"}
@@ -6,6 +6,7 @@ import { ChecklistIcon } from '../../../../lexical/ui/icons/Checklist/index.js';
6
6
  import { createClientFeature } from '../../../../utilities/createClientFeature.js';
7
7
  import { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js';
8
8
  import { LexicalListPlugin } from '../../plugin/index.js';
9
+ import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
9
10
  import { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js';
10
11
  import { CHECK_LIST } from '../markdownTransformers.js';
11
12
  import { LexicalCheckListPlugin } from './plugin/index.js';
@@ -54,7 +55,8 @@ export const ChecklistFeatureClient = createClientFeature(({
54
55
  Component: LexicalCheckListPlugin,
55
56
  position: 'normal'
56
57
  }];
57
- if (!featureProviderMap.has('unorderedList') && !featureProviderMap.has('orderedList')) {
58
+ const shouldRegister = shouldRegisterListBaseNodes('checklist', featureProviderMap);
59
+ if (shouldRegister) {
58
60
  plugins.push({
59
61
  Component: LexicalListPlugin,
60
62
  position: 'normal'
@@ -62,7 +64,7 @@ export const ChecklistFeatureClient = createClientFeature(({
62
64
  }
63
65
  return {
64
66
  markdownTransformers: [CHECK_LIST],
65
- nodes: featureProviderMap.has('unorderedList') || featureProviderMap.has('orderedList') ? [] : [ListNode, ListItemNode],
67
+ nodes: shouldRegister ? [ListNode, ListItemNode] : [],
66
68
  plugins,
67
69
  slashMenu: {
68
70
  groups: [slashMenuListGroupWithItems([{
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$isListNode","INSERT_CHECK_LIST_COMMAND","ListItemNode","ListNode","$isRangeSelection","ChecklistIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","slashMenuListGroupWithItems","CHECK_LIST","LexicalCheckListPlugin","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","ChecklistFeatureClient","featureProviderMap","plugins","Component","position","has","push","markdownTransformers","nodes","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/checklist/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_CHECK_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\nimport type { ClientFeature } from '../../../typesClient.js'\n\nimport { ChecklistIcon } from '../../../../lexical/ui/icons/Checklist/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\nimport { CHECK_LIST } from '../markdownTransformers.js'\nimport { LexicalCheckListPlugin } from './plugin/index.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: ChecklistIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'check') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'check') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'check') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'checklist',\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined)\n },\n order: 12,\n },\n ]),\n]\n\nexport const ChecklistFeatureClient = createClientFeature(({ featureProviderMap }) => {\n const plugins: ClientFeature<undefined>['plugins'] = [\n {\n Component: LexicalCheckListPlugin,\n position: 'normal',\n },\n ]\n\n if (!featureProviderMap.has('unorderedList') && !featureProviderMap.has('orderedList')) {\n plugins.push({\n Component: LexicalListPlugin,\n position: 'normal',\n })\n }\n\n return {\n markdownTransformers: [CHECK_LIST],\n nodes:\n featureProviderMap.has('unorderedList') || featureProviderMap.has('orderedList')\n ? []\n : [ListNode, ListItemNode],\n plugins,\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: ChecklistIcon,\n key: 'checklist',\n keywords: ['check list', 'check', 'checklist', 'cl'],\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n})\n"],"mappings":"AAAA;;AACA,SAASA,WAAW,EAAEC,yBAAyB,EAAEC,YAAY,EAAEC,QAAQ,QAAQ;AAC/E,SAASC,iBAAiB,QAAQ;AAKlC,SAASC,aAAa,QAAQ;AAC9B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,QAAQ;AAEvC,MAAMC,aAAA,GAAgC,CACpCL,iCAAA,CAAkC,CAChC;EACEM,cAAA,EAAgBR,aAAA;EAChBS,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAI,CAACX,iBAAA,CAAkBW,SAAA,GAAY;MACjC,OAAO;IACT;IACA,KAAK,MAAMC,IAAA,IAAQD,SAAA,CAAUE,QAAQ,IAAI;MACvC,IAAIjB,WAAA,CAAYgB,IAAA,KAASA,IAAA,CAAKE,WAAW,OAAO,SAAS;QACvD;MACF;MAEA,MAAMC,MAAA,GAASH,IAAA,CAAKI,SAAS;MAE7B,IAAIpB,WAAA,CAAYmB,MAAA,KAAWA,MAAA,CAAOD,WAAW,OAAO,SAAS;QAC3D;MACF;MAEA,MAAMG,YAAA,GAAeF,MAAA,EAAQC,SAAA;MAC7B;MACA,IAAIpB,WAAA,CAAYqB,YAAA,KAAiBA,YAAA,CAAaH,WAAW,OAAO,SAAS;QACvE;MACF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AAc;MACZH,MAAA,EAAQ7B;IACV;IACAiC,aAAA,EAAe;MACbJ,MAAA,EAAQ7B;IACV;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$isListNode","INSERT_CHECK_LIST_COMMAND","ListItemNode","ListNode","$isRangeSelection","ChecklistIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","shouldRegisterListBaseNodes","slashMenuListGroupWithItems","CHECK_LIST","LexicalCheckListPlugin","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","ChecklistFeatureClient","featureProviderMap","plugins","Component","position","shouldRegister","push","markdownTransformers","nodes","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/checklist/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_CHECK_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\nimport type { ClientFeature } from '../../../typesClient.js'\n\nimport { ChecklistIcon } from '../../../../lexical/ui/icons/Checklist/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\nimport { CHECK_LIST } from '../markdownTransformers.js'\nimport { LexicalCheckListPlugin } from './plugin/index.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: ChecklistIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'check') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'check') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'check') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'checklist',\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined)\n },\n order: 12,\n },\n ]),\n]\n\nexport const ChecklistFeatureClient = createClientFeature(({ featureProviderMap }) => {\n const plugins: ClientFeature<undefined>['plugins'] = [\n {\n Component: LexicalCheckListPlugin,\n position: 'normal',\n },\n ]\n\n const shouldRegister = shouldRegisterListBaseNodes('checklist', featureProviderMap)\n if (shouldRegister) {\n plugins.push({\n Component: LexicalListPlugin,\n position: 'normal',\n })\n }\n\n return {\n markdownTransformers: [CHECK_LIST],\n nodes: shouldRegister ? [ListNode, ListItemNode] : [],\n plugins,\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: ChecklistIcon,\n key: 'checklist',\n keywords: ['check list', 'check', 'checklist', 'cl'],\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n})\n"],"mappings":"AAAA;;AACA,SAASA,WAAW,EAAEC,yBAAyB,EAAEC,YAAY,EAAEC,QAAQ,QAAQ;AAC/E,SAASC,iBAAiB,QAAQ;AAKlC,SAASC,aAAa,QAAQ;AAC9B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,UAAU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B,QAAA,EAAU;IACZ;EACF;EAEA,OAAO;IACLG,oBAAA,EAAsB,CAAC5B,UAAA,CAAW;IAClC6B,KAAA,EAAOH,cAAA,GAAiB,CAAClC,QAAA,EAAUD,YAAA,CAAa,GAAG,EAAE;IACrDgC,OAAA;IACAO,SAAA,EAAW;MACTC,MAAA,EAAQ,CACNhC,2BAAA,CAA4B,CAC1B;QACEiC,IAAA,EAAMtC,aAAA;QACNkB,GAAA,EAAK;QACLqB,QAAA,EAAU,CAAC,cAAc,SAAS,aAAa,KAAK;QACpDpB,KAAA,EAAOA,CAAC;UAAEC;QAAI,CAAE;UACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;QAChB;QACAC,QAAA,EAAUA,CAAC;UAAEC;QAAM,CAAE;UACnBA,MAAA,CAAOC,eAAe,CAAC5B,yBAAA,EAA2B6B,SAAA;QACpD;MACF,EACD;IAEL;IACAe,YAAA,EAAc;MACZH,MAAA,EAAQ7B;IACV;IACAiC,aAAA,EAAe;MACbJ,MAAA,EAAQ7B;IACV;EACF;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/lists/checklist/server/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,kGA0B3B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/lists/checklist/server/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,gBAAgB,kGAyB3B,CAAA"}
@@ -2,6 +2,7 @@ import { ListItemNode, ListNode } from '@lexical/list';
2
2
  import { createServerFeature } from '../../../../utilities/createServerFeature.js';
3
3
  import { createNode } from '../../../typeUtilities.js';
4
4
  import { ListHTMLConverter, ListItemHTMLConverter } from '../../htmlConverter.js';
5
+ import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
5
6
  import { CHECK_LIST } from '../markdownTransformers.js';
6
7
  import { i18n } from './i18n.js';
7
8
  export const ChecklistFeature = createServerFeature({
@@ -12,7 +13,7 @@ export const ChecklistFeature = createServerFeature({
12
13
  ClientFeature: '@payloadcms/richtext-lexical/client#ChecklistFeatureClient',
13
14
  i18n,
14
15
  markdownTransformers: [CHECK_LIST],
15
- nodes: featureProviderMap.has('unorderedList') || featureProviderMap.has('orderedList') ? [] : [createNode({
16
+ nodes: shouldRegisterListBaseNodes('checklist', featureProviderMap) ? [createNode({
16
17
  converters: {
17
18
  html: ListHTMLConverter
18
19
  },
@@ -22,7 +23,7 @@ export const ChecklistFeature = createServerFeature({
22
23
  html: ListItemHTMLConverter
23
24
  },
24
25
  node: ListItemNode
25
- })]
26
+ })] : []
26
27
  };
27
28
  },
28
29
  key: 'checklist'
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ListItemNode","ListNode","createServerFeature","createNode","ListHTMLConverter","ListItemHTMLConverter","CHECK_LIST","i18n","ChecklistFeature","feature","featureProviderMap","ClientFeature","markdownTransformers","nodes","has","converters","html","node","key"],"sources":["../../../../../src/features/lists/checklist/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { ListHTMLConverter, ListItemHTMLConverter } from '../../htmlConverter.js'\nimport { CHECK_LIST } from '../markdownTransformers.js'\nimport { i18n } from './i18n.js'\n\nexport const ChecklistFeature = createServerFeature({\n feature: ({ featureProviderMap }) => {\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#ChecklistFeatureClient',\n i18n,\n markdownTransformers: [CHECK_LIST],\n nodes:\n featureProviderMap.has('unorderedList') || featureProviderMap.has('orderedList')\n ? []\n : [\n createNode({\n converters: {\n html: ListHTMLConverter as any, // ListHTMLConverter uses a different generic type than ListNode[exportJSON], thus we need to cast as any\n },\n node: ListNode,\n }),\n createNode({\n converters: {\n html: ListItemHTMLConverter as any,\n },\n node: ListItemNode,\n }),\n ],\n }\n },\n key: 'checklist',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AAEvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ;AACzD,SAASC,UAAU,QAAQ;AAC3B,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,gBAAA,GAAmBN,mBAAA,CAAoB;EAClDO,OAAA,EAASA,CAAC;IAAEC;EAAkB,CAAE;IAC9B,OAAO;MACLC,aAAA,EAAe;MACfJ,IAAA;MACAK,oBAAA,EAAsB,CAACN,UAAA,CAAW;MAClCO,KAAA,EACEH,kBAAA,CAAmBI,GAAG,CAAC,oBAAoBJ,kBAAA,CAAmBI,GAAG,CAAC,iBAC9D,EAAE,GACF,CACEX,UAAA,CAAW;QACTY,UAAA,EAAY;UACVC,IAAA,EAAMZ;QACR;QACAa,IAAA,EAAMhB;MACR,IACAE,UAAA,CAAW;QACTY,UAAA,EAAY;UACVC,IAAA,EAAMX;QACR;QACAY,IAAA,EAAMjB;MACR;IAEV;EACF;EACAkB,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["ListItemNode","ListNode","createServerFeature","createNode","ListHTMLConverter","ListItemHTMLConverter","shouldRegisterListBaseNodes","CHECK_LIST","i18n","ChecklistFeature","feature","featureProviderMap","ClientFeature","markdownTransformers","nodes","converters","html","node","key"],"sources":["../../../../../src/features/lists/checklist/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { ListHTMLConverter, ListItemHTMLConverter } from '../../htmlConverter.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { CHECK_LIST } from '../markdownTransformers.js'\nimport { i18n } from './i18n.js'\n\nexport const ChecklistFeature = createServerFeature({\n feature: ({ featureProviderMap }) => {\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#ChecklistFeatureClient',\n i18n,\n markdownTransformers: [CHECK_LIST],\n nodes: shouldRegisterListBaseNodes('checklist', featureProviderMap)\n ? [\n createNode({\n converters: {\n html: ListHTMLConverter as any, // ListHTMLConverter uses a different generic type than ListNode[exportJSON], thus we need to cast as any\n },\n node: ListNode,\n }),\n createNode({\n converters: {\n html: ListItemHTMLConverter as any,\n },\n node: ListItemNode,\n }),\n ]\n : [],\n }\n },\n key: 'checklist',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AAEvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ;AACzD,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,UAAU,QAAQ;AAC3B,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,gBAAA,GAAmBP,mBAAA,CAAoB;EAClDQ,OAAA,EAASA,CAAC;IAAEC;EAAkB,CAAE;IAC9B,OAAO;MACLC,aAAA,EAAe;MACfJ,IAAA;MACAK,oBAAA,EAAsB,CAACN,UAAA,CAAW;MAClCO,KAAA,EAAOR,2BAAA,CAA4B,aAAaK,kBAAA,IAC5C,CACER,UAAA,CAAW;QACTY,UAAA,EAAY;UACVC,IAAA,EAAMZ;QACR;QACAa,IAAA,EAAMhB;MACR,IACAE,UAAA,CAAW;QACTY,UAAA,EAAY;UACVC,IAAA,EAAMX;QACR;QACAY,IAAA,EAAMjB;MACR,GACD,GACD;IACN;EACF;EACAkB,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/lists/orderedList/client/index.tsx"],"names":[],"mappings":"AAsDA,eAAO,MAAM,wBAAwB,uFAoCnC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/lists/orderedList/client/index.tsx"],"names":[],"mappings":"AAuDA,eAAO,MAAM,wBAAwB,uFAqCnC,CAAA"}
@@ -6,6 +6,7 @@ import { OrderedListIcon } from '../../../../lexical/ui/icons/OrderedList/index.
6
6
  import { createClientFeature } from '../../../../utilities/createClientFeature.js';
7
7
  import { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js';
8
8
  import { LexicalListPlugin } from '../../plugin/index.js';
9
+ import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
9
10
  import { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js';
10
11
  import { ORDERED_LIST } from '../markdownTransformer.js';
11
12
  const toolbarGroups = [toolbarTextDropdownGroupWithItems([{
@@ -49,13 +50,14 @@ const toolbarGroups = [toolbarTextDropdownGroupWithItems([{
49
50
  export const OrderedListFeatureClient = createClientFeature(({
50
51
  featureProviderMap
51
52
  }) => {
53
+ const shouldRegister = shouldRegisterListBaseNodes('ordered', featureProviderMap);
52
54
  return {
53
55
  markdownTransformers: [ORDERED_LIST],
54
- nodes: featureProviderMap.has('orderedList') ? [] : [ListNode, ListItemNode],
55
- plugins: featureProviderMap.has('orderedList') ? [] : [{
56
+ nodes: shouldRegister ? [ListNode, ListItemNode] : [],
57
+ plugins: shouldRegister ? [{
56
58
  Component: LexicalListPlugin,
57
59
  position: 'normal'
58
- }],
60
+ }] : [],
59
61
  slashMenu: {
60
62
  groups: [slashMenuListGroupWithItems([{
61
63
  Icon: OrderedListIcon,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$isListNode","INSERT_ORDERED_LIST_COMMAND","ListItemNode","ListNode","$isRangeSelection","OrderedListIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","slashMenuListGroupWithItems","ORDERED_LIST","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","OrderedListFeatureClient","featureProviderMap","markdownTransformers","nodes","has","plugins","Component","position","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/orderedList/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_ORDERED_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\n\nimport { OrderedListIcon } from '../../../../lexical/ui/icons/OrderedList/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\nimport { ORDERED_LIST } from '../markdownTransformer.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: OrderedListIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'number') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'number') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'number') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'orderedList',\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n order: 10,\n },\n ]),\n]\n\nexport const OrderedListFeatureClient = createClientFeature(({ featureProviderMap }) => {\n return {\n markdownTransformers: [ORDERED_LIST],\n nodes: featureProviderMap.has('orderedList') ? [] : [ListNode, ListItemNode],\n plugins: featureProviderMap.has('orderedList')\n ? []\n : [\n {\n Component: LexicalListPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: OrderedListIcon,\n key: 'orderedList',\n keywords: ['ordered list', 'ol'],\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n})\n"],"mappings":"AAAA;;AACA,SAASA,WAAW,EAAEC,2BAA2B,EAAEC,YAAY,EAAEC,QAAQ,QAAQ;AACjF,SAASC,iBAAiB,QAAQ;AAIlC,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,YAAY,QAAQ;AAE7B,MAAMC,aAAA,GAAgC,CACpCJ,iCAAA,CAAkC,CAChC;EACEK,cAAA,EAAgBP,eAAA;EAChBQ,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAI,CAACV,iBAAA,CAAkBU,SAAA,GAAY;MACjC,OAAO;IACT;IACA,KAAK,MAAMC,IAAA,IAAQD,SAAA,CAAUE,QAAQ,IAAI;MACvC,IAAIhB,WAAA,CAAYe,IAAA,KAASA,IAAA,CAAKE,WAAW,OAAO,UAAU;QACxD;MACF;MAEA,MAAMC,MAAA,GAASH,IAAA,CAAKI,SAAS;MAE7B,IAAInB,WAAA,CAAYkB,MAAA,KAAWA,MAAA,CAAOD,WAAW,OAAO,UAAU;QAC5D;MACF;MAEA,MAAMG,YAAA,GAAeF,MAAA,EAAQC,SAAA;MAC7B;MACA,IAAInB,WAAA,CAAYoB,YAAA,KAAiBA,YAAA,CAAaH,WAAW,OAAO,UAAU;QACxE;MACF;MAEA,OAAO;IACT;IACA,OAAO;EACT;EACAI,GAAA,EAAK;EACLC,KAAA,EAAOA,CAAC;IAAEC;EAAI,CAAE;IACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;EAChB;EACAC,QAAA,EAAUA,CAAC;IAAEC;EAAM,CAAE;IACnBA,MAAA,CAAOC,eAAe,CAAC1B,2BAAA,EAA6B2B,SAAA;EACtD;EACAC,KAAA,EAAO;AACT,EACD,EACF;AAED,OAAO,MAAMC,wBAAA,GAA2BxB,mBAAA,CAAoB,CAAC;EAAEyB;AAAkB,CAAE;EACjF,OAAO;IACLC,oBAAA,EAAsB,CAACtB,YAAA,CAAa;IACpCuB,KAAA,EAAOF,kBAAA,CAAmBG,GAAG,CAAC,iBAAiB,EAAE,GAAG,CAAC/B,QAAA,EAAUD,YAAA,CAAa;IAC5EiC,OAAA,EAASJ,kBAAA,CAAmBG,GAAG,CAAC,iBAC5B,EAAE,GACF,CACE;MACEE,SAAA,EAAW5B,iBAAA;MACX6B,QAAA,EAAU;IACZ,EACD;IACLC,SAAA,EAAW;MACTC,MAAA,EAAQ,CACN9B,2BAAA,CAA4B,CAC1B;QACE+B,IAAA,EAAMnC,eAAA;QACNgB,GAAA,EAAK;QACLoB,QAAA,EAAU,CAAC,gBAAgB,KAAK;QAChCnB,KAAA,EAAOA,CAAC;UAAEC;QAAI,CAAE;UACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;QAChB;QACAC,QAAA,EAAUA,CAAC;UAAEC;QAAM,CAAE;UACnBA,MAAA,CAAOC,eAAe,CAAC1B,2BAAA,EAA6B2B,SAAA;QACtD;MACF,EACD;IAEL;IACAc,YAAA,EAAc;MACZH,MAAA,EAAQ5B;IACV;IACAgC,aAAA,EAAe;MACbJ,MAAA,EAAQ5B;IACV;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$isListNode","INSERT_ORDERED_LIST_COMMAND","ListItemNode","ListNode","$isRangeSelection","OrderedListIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","shouldRegisterListBaseNodes","slashMenuListGroupWithItems","ORDERED_LIST","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","OrderedListFeatureClient","featureProviderMap","shouldRegister","markdownTransformers","nodes","plugins","Component","position","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/orderedList/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_ORDERED_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\n\nimport { OrderedListIcon } from '../../../../lexical/ui/icons/OrderedList/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\nimport { ORDERED_LIST } from '../markdownTransformer.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: OrderedListIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'number') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'number') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'number') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'orderedList',\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n order: 10,\n },\n ]),\n]\n\nexport const OrderedListFeatureClient = createClientFeature(({ featureProviderMap }) => {\n const shouldRegister = shouldRegisterListBaseNodes('ordered', featureProviderMap)\n return {\n markdownTransformers: [ORDERED_LIST],\n nodes: shouldRegister ? [ListNode, ListItemNode] : [],\n plugins: shouldRegister\n ? [\n {\n Component: LexicalListPlugin,\n position: 'normal',\n },\n ]\n : [],\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: OrderedListIcon,\n key: 'orderedList',\n keywords: ['ordered list', 'ol'],\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n})\n"],"mappings":"AAAA;;AACA,SAASA,WAAW,EAAEC,2BAA2B,EAAEC,YAAY,EAAEC,QAAQ,QAAQ;AACjF,SAASC,iBAAiB,QAAQ;AAIlC,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,YAAY,QAAQ;AAE7B,MAAMC,aAAA,GAAgC,CACpCL,iCAAA,CAAkC,CAChC;EACEM,cAAA,EAAgBR,eAAA;EAChBS,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAI,CAACX,iBAAA,CAAkBW,SAAA,GAAY;MACjC,OAAO;IACT;IACA,KAAK,MAAMC,IAAA,IAAQD,SAAA,CAAUE,QAAQ,IAAI;MACvC,IAAIjB,WAAA,CAAYgB,IAAA,KAASA,IAAA,CAAKE,WAAW,OAAO,UAAU;QACxD;MACF;MAEA,MAAMC,MAAA,GAASH,IAAA,CAAKI,SAAS;MAE7B,IAAIpB,WAAA,CAAYmB,MAAA,KAAWA,MAAA,CAAOD,WAAW,OAAO,UAAU;QAC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bJ,MAAA,EAAQ5B;IACV;EACF;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/lists/orderedList/server/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,kBAAkB,kGAyB7B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/lists/orderedList/server/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,kBAAkB,kGAyB7B,CAAA"}
@@ -2,6 +2,7 @@ import { ListItemNode, ListNode } from '@lexical/list';
2
2
  import { createServerFeature } from '../../../../utilities/createServerFeature.js';
3
3
  import { createNode } from '../../../typeUtilities.js';
4
4
  import { ListHTMLConverter, ListItemHTMLConverter } from '../../htmlConverter.js';
5
+ import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
5
6
  import { ORDERED_LIST } from '../markdownTransformer.js';
6
7
  import { i18n } from './i18n.js';
7
8
  export const OrderedListFeature = createServerFeature({
@@ -12,7 +13,7 @@ export const OrderedListFeature = createServerFeature({
12
13
  ClientFeature: '@payloadcms/richtext-lexical/client#OrderedListFeatureClient',
13
14
  i18n,
14
15
  markdownTransformers: [ORDERED_LIST],
15
- nodes: featureProviderMap.has('unorderedList') ? [] : [createNode({
16
+ nodes: shouldRegisterListBaseNodes('ordered', featureProviderMap) ? [createNode({
16
17
  converters: {
17
18
  html: ListHTMLConverter
18
19
  },
@@ -22,7 +23,7 @@ export const OrderedListFeature = createServerFeature({
22
23
  html: ListItemHTMLConverter
23
24
  },
24
25
  node: ListItemNode
25
- })]
26
+ })] : []
26
27
  };
27
28
  },
28
29
  key: 'orderedList'
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ListItemNode","ListNode","createServerFeature","createNode","ListHTMLConverter","ListItemHTMLConverter","ORDERED_LIST","i18n","OrderedListFeature","feature","featureProviderMap","ClientFeature","markdownTransformers","nodes","has","converters","html","node","key"],"sources":["../../../../../src/features/lists/orderedList/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { ListHTMLConverter, ListItemHTMLConverter } from '../../htmlConverter.js'\nimport { ORDERED_LIST } from '../markdownTransformer.js'\nimport { i18n } from './i18n.js'\n\nexport const OrderedListFeature = createServerFeature({\n feature: ({ featureProviderMap }) => {\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#OrderedListFeatureClient',\n i18n,\n markdownTransformers: [ORDERED_LIST],\n nodes: featureProviderMap.has('unorderedList')\n ? []\n : [\n createNode({\n converters: {\n html: ListHTMLConverter as any, // ListHTMLConverter uses a different generic type than ListNode[exportJSON], thus we need to cast as any\n },\n node: ListNode,\n }),\n createNode({\n converters: {\n html: ListItemHTMLConverter as any,\n },\n node: ListItemNode,\n }),\n ],\n }\n },\n key: 'orderedList',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AAEvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ;AACzD,SAASC,YAAY,QAAQ;AAC7B,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,kBAAA,GAAqBN,mBAAA,CAAoB;EACpDO,OAAA,EAASA,CAAC;IAAEC;EAAkB,CAAE;IAC9B,OAAO;MACLC,aAAA,EAAe;MACfJ,IAAA;MACAK,oBAAA,EAAsB,CAACN,YAAA,CAAa;MACpCO,KAAA,EAAOH,kBAAA,CAAmBI,GAAG,CAAC,mBAC1B,EAAE,GACF,CACEX,UAAA,CAAW;QACTY,UAAA,EAAY;UACVC,IAAA,EAAMZ;QACR;QACAa,IAAA,EAAMhB;MACR,IACAE,UAAA,CAAW;QACTY,UAAA,EAAY;UACVC,IAAA,EAAMX;QACR;QACAY,IAAA,EAAMjB;MACR;IAER;EACF;EACAkB,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["ListItemNode","ListNode","createServerFeature","createNode","ListHTMLConverter","ListItemHTMLConverter","shouldRegisterListBaseNodes","ORDERED_LIST","i18n","OrderedListFeature","feature","featureProviderMap","ClientFeature","markdownTransformers","nodes","converters","html","node","key"],"sources":["../../../../../src/features/lists/orderedList/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { ListHTMLConverter, ListItemHTMLConverter } from '../../htmlConverter.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { ORDERED_LIST } from '../markdownTransformer.js'\nimport { i18n } from './i18n.js'\n\nexport const OrderedListFeature = createServerFeature({\n feature: ({ featureProviderMap }) => {\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#OrderedListFeatureClient',\n i18n,\n markdownTransformers: [ORDERED_LIST],\n nodes: shouldRegisterListBaseNodes('ordered', featureProviderMap)\n ? [\n createNode({\n converters: {\n html: ListHTMLConverter as any, // ListHTMLConverter uses a different generic type than ListNode[exportJSON], thus we need to cast as any\n },\n node: ListNode,\n }),\n createNode({\n converters: {\n html: ListItemHTMLConverter as any,\n },\n node: ListItemNode,\n }),\n ]\n : [],\n }\n },\n key: 'orderedList',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AAEvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ;AACzD,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,YAAY,QAAQ;AAC7B,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,kBAAA,GAAqBP,mBAAA,CAAoB;EACpDQ,OAAA,EAASA,CAAC;IAAEC;EAAkB,CAAE;IAC9B,OAAO;MACLC,aAAA,EAAe;MACfJ,IAAA;MACAK,oBAAA,EAAsB,CAACN,YAAA,CAAa;MACpCO,KAAA,EAAOR,2BAAA,CAA4B,WAAWK,kBAAA,IAC1C,CACER,UAAA,CAAW;QACTY,UAAA,EAAY;UACVC,IAAA,EAAMZ;QACR;QACAa,IAAA,EAAMhB;MACR,IACAE,UAAA,CAAW;QACTY,UAAA,EAAY;UACVC,IAAA,EAAMX;QACR;QACAY,IAAA,EAAMjB;MACR,GACD,GACD;IACN;EACF;EACAkB,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1,13 +1,12 @@
1
1
  import type { SerializedListItemNode as _SerializedListItemNode, SerializedListNode as _SerializedListNode } from '@lexical/list';
2
- import type { Spread } from 'lexical';
2
+ import type { SerializedLexicalNode } from 'lexical';
3
+ import type { StronglyTypedElementNode } from '../../../nodeTypes.js';
3
4
  import type { PluginComponent } from '../../typesClient.js';
4
- export type SerializedListItemNode = Spread<{
5
+ export type SerializedListItemNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {
5
6
  checked?: boolean;
6
- type: 'listitem';
7
- }, _SerializedListItemNode>;
8
- export type SerializedListNode = Spread<{
7
+ } & StronglyTypedElementNode<_SerializedListItemNode, 'listitem', T>;
8
+ export type SerializedListNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {
9
9
  checked?: boolean;
10
- type: 'list';
11
- }, _SerializedListNode>;
10
+ } & StronglyTypedElementNode<_SerializedListNode, 'list', T>;
12
11
  export declare const LexicalListPlugin: PluginComponent<undefined>;
13
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/lists/plugin/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,IAAI,uBAAuB,EACjD,kBAAkB,IAAI,mBAAmB,EAC1C,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAKrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,MAAM,MAAM,sBAAsB,GAAG,MAAM,CACzC;IACE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;CACjB,EACD,uBAAuB,CACxB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,CACrC;IACE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb,EACD,mBAAmB,CACpB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAAC,SAAS,CAExD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/lists/plugin/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,IAAI,uBAAuB,EACjD,kBAAkB,IAAI,mBAAmB,EAC1C,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAKpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IAAI;IAC5F,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,wBAAwB,CAAC,uBAAuB,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA;AAEpE,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IAAI;IACxF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,wBAAwB,CAAC,mBAAmB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;AAE5D,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAAC,SAAS,CAExD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ListPlugin","React","LexicalListPlugin","_jsx"],"sources":["../../../../src/features/lists/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type {\n SerializedListItemNode as _SerializedListItemNode,\n SerializedListNode as _SerializedListNode,\n} from '@lexical/list'\nimport type { Spread } from 'lexical'\n\nimport { ListPlugin } from '@lexical/react/LexicalListPlugin.js'\nimport React from 'react'\n\nimport type { PluginComponent } from '../../typesClient.js'\n\nexport type SerializedListItemNode = Spread<\n {\n checked?: boolean\n type: 'listitem'\n },\n _SerializedListItemNode\n>\n\nexport type SerializedListNode = Spread<\n {\n checked?: boolean\n type: 'list'\n },\n _SerializedListNode\n>\n\nexport const LexicalListPlugin: PluginComponent<undefined> = () => {\n return <ListPlugin />\n}\n"],"mappings":"AAAA;;;AAOA,SAASA,UAAU,QAAQ;AAC3B,OAAOC,KAAA,MAAW;AAoBlB,OAAO,MAAMC,iBAAA,GAAgDA,CAAA;EAC3D,oBAAOC,IAAA,CAACH,UAAA;AACV","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["ListPlugin","React","LexicalListPlugin","_jsx"],"sources":["../../../../src/features/lists/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type {\n SerializedListItemNode as _SerializedListItemNode,\n SerializedListNode as _SerializedListNode,\n} from '@lexical/list'\nimport type { SerializedLexicalNode } from 'lexical'\n\nimport { ListPlugin } from '@lexical/react/LexicalListPlugin.js'\nimport React from 'react'\n\nimport type { StronglyTypedElementNode } from '../../../nodeTypes.js'\nimport type { PluginComponent } from '../../typesClient.js'\n\nexport type SerializedListItemNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n checked?: boolean\n} & StronglyTypedElementNode<_SerializedListItemNode, 'listitem', T>\n\nexport type SerializedListNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n checked?: boolean\n} & StronglyTypedElementNode<_SerializedListNode, 'list', T>\n\nexport const LexicalListPlugin: PluginComponent<undefined> = () => {\n return <ListPlugin />\n}\n"],"mappings":"AAAA;;;AAOA,SAASA,UAAU,QAAQ;AAC3B,OAAOC,KAAA,MAAW;AAalB,OAAO,MAAMC,iBAAA,GAAgDA,CAAA;EAC3D,oBAAOC,IAAA,CAACH,UAAA;AACV","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export declare function shouldRegisterListBaseNodes(type: 'checklist' | 'ordered', featureProviderMap: Map<string, unknown>): boolean;
2
+ //# sourceMappingURL=shouldRegisterListBaseNodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shouldRegisterListBaseNodes.d.ts","sourceRoot":"","sources":["../../../../src/features/lists/shared/shouldRegisterListBaseNodes.ts"],"names":[],"mappings":"AAEA,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,WAazC"}
@@ -0,0 +1,14 @@
1
+ // Priority order: unordered > ordered > checklist.
2
+ // That's why we don't include unordered among the parameter options. It registers by default.
3
+ export function shouldRegisterListBaseNodes(type, featureProviderMap) {
4
+ if (type === 'ordered') {
5
+ // OrderedList only registers if UnorderedList is NOT present
6
+ return !featureProviderMap.has('unorderedList');
7
+ }
8
+ if (type === 'checklist') {
9
+ // Checklist only registers if neither UnorderedList nor OrderedList are present
10
+ return !featureProviderMap.has('unorderedList') && !featureProviderMap.has('orderedList');
11
+ }
12
+ return false;
13
+ }
14
+ //# sourceMappingURL=shouldRegisterListBaseNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shouldRegisterListBaseNodes.js","names":["shouldRegisterListBaseNodes","type","featureProviderMap","has"],"sources":["../../../../src/features/lists/shared/shouldRegisterListBaseNodes.ts"],"sourcesContent":["// Priority order: unordered > ordered > checklist.\n// That's why we don't include unordered among the parameter options. It registers by default.\nexport function shouldRegisterListBaseNodes(\n type: 'checklist' | 'ordered',\n featureProviderMap: Map<string, unknown>,\n) {\n if (type === 'ordered') {\n // OrderedList only registers if UnorderedList is NOT present\n return !featureProviderMap.has('unorderedList')\n }\n\n if (type === 'checklist') {\n // Checklist only registers if neither UnorderedList nor OrderedList are present\n return !featureProviderMap.has('unorderedList') && !featureProviderMap.has('orderedList')\n }\n\n return false\n}\n"],"mappings":"AAAA;AACA;AACA,OAAO,SAASA,4BACdC,IAA6B,EAC7BC,kBAAwC;EAExC,IAAID,IAAA,KAAS,WAAW;IACtB;IACA,OAAO,CAACC,kBAAA,CAAmBC,GAAG,CAAC;EACjC;EAEA,IAAIF,IAAA,KAAS,aAAa;IACxB;IACA,OAAO,CAACC,kBAAA,CAAmBC,GAAG,CAAC,oBAAoB,CAACD,kBAAA,CAAmBC,GAAG,CAAC;EAC7E;EAEA,OAAO;AACT","ignoreList":[]}
@@ -1,17 +1,16 @@
1
1
  import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
2
- import type { DOMConversionMap, DOMExportOutput, EditorConfig, ElementFormatType, LexicalEditor, LexicalNode, NodeKey, Spread } from 'lexical';
2
+ import type { DOMConversionMap, DOMExportOutput, EditorConfig, ElementFormatType, LexicalEditor, LexicalNode, NodeKey } from 'lexical';
3
3
  import type { CollectionSlug, DataFromCollectionSlug } from 'payload';
4
4
  import type { JSX } from 'react';
5
5
  import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
6
+ import type { StronglyTypedLeafNode } from '../../../../nodeTypes.js';
6
7
  export type RelationshipData = {
7
8
  [TCollectionSlug in CollectionSlug]: {
8
9
  relationTo: TCollectionSlug;
9
10
  value: DataFromCollectionSlug<TCollectionSlug> | number | string;
10
11
  };
11
12
  }[CollectionSlug];
12
- export type SerializedRelationshipNode = Omit<{
13
- type: 'relationship';
14
- } & Spread<RelationshipData, Omit<SerializedDecoratorBlockNode, 'type'>>, 'children'>;
13
+ export type SerializedRelationshipNode = RelationshipData & StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'relationship'>;
15
14
  export declare class RelationshipServerNode extends DecoratorBlockNode {
16
15
  __data: RelationshipData;
17
16
  constructor({ data, format, key, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAEhF,MAAM,MAAM,gBAAgB,GAAG;KAC5B,eAAe,IAAI,cAAc,GAAG;QACnC,UAAU,EAAE,eAAe,CAAA;QAC3B,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACjE;CACF,CAAC,cAAc,CAAC,CAAA;AAEjB,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C;IACE,IAAI,EAAE,cAAc,CAAA;CACrB,GAAG,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC,EACxE,UAAU,CACX,CAAA;AAgBD,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,MAAM,EAAE,gBAAgB,CAAA;gBAEZ,EACV,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;QACD,IAAI,EAAE,gBAAgB,CAAA;QACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;QAC1B,GAAG,CAAC,EAAE,OAAO,CAAA;KACd;WAKe,KAAK,CAAC,IAAI,EAAE,sBAAsB,GAAG,sBAAsB;WAQ3D,OAAO,IAAI,MAAM;WAIjB,SAAS,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;WAiBpD,UAAU,CAAC,cAAc,EAAE,0BAA0B,GAAG,sBAAsB;IAc9F,MAAM,CAAC,QAAQ,IAAI,KAAK;IAIf,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAIpE,SAAS,IAAI,eAAe;IAa5B,UAAU,IAAI,0BAA0B;IASjD,OAAO,IAAI,gBAAgB;IAIlB,cAAc,IAAI,MAAM;IAIjC,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAItC;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,gBAAgB,GAAG,sBAAsB,CAI5F;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,sBAAsB,GAAG,SAAS,GAC5D,IAAI,IAAI,sBAAsB,CAEhC"}
1
+ {"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACR,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAEhF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAErE,MAAM,MAAM,gBAAgB,GAAG;KAC5B,eAAe,IAAI,cAAc,GAAG;QACnC,UAAU,EAAE,eAAe,CAAA;QAC3B,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACjE;CACF,CAAC,cAAc,CAAC,CAAA;AAEjB,MAAM,MAAM,0BAA0B,GAAG,gBAAgB,GACvD,qBAAqB,CAAC,4BAA4B,EAAE,cAAc,CAAC,CAAA;AAgBrE,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,MAAM,EAAE,gBAAgB,CAAA;gBAEZ,EACV,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;QACD,IAAI,EAAE,gBAAgB,CAAA;QACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;QAC1B,GAAG,CAAC,EAAE,OAAO,CAAA;KACd;WAKe,KAAK,CAAC,IAAI,EAAE,sBAAsB,GAAG,sBAAsB;WAQ3D,OAAO,IAAI,MAAM;WAIjB,SAAS,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;WAiBpD,UAAU,CAAC,cAAc,EAAE,0BAA0B,GAAG,sBAAsB;IAc9F,MAAM,CAAC,QAAQ,IAAI,KAAK;IAIf,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAIpE,SAAS,IAAI,eAAe;IAa5B,UAAU,IAAI,0BAA0B;IASjD,OAAO,IAAI,gBAAgB;IAIlB,cAAc,IAAI,MAAM;IAIjC,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAItC;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,gBAAgB,GAAG,sBAAsB,CAI5F;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,sBAAsB,GAAG,SAAS,GAC5D,IAAI,IAAI,sBAAsB,CAEhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipNode.js","names":["DecoratorBlockNode","$relationshipElementToServerNode","domNode","id","getAttribute","relationTo","node","$createServerRelationshipNode","value","RelationshipServerNode","__data","constructor","data","format","key","clone","__format","__key","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","isInline","decorate","_editor","_config","exportDOM","element","document","createElement","setAttribute","String","text","createTextNode","getTextContent","append","exportJSON","getData","type","getLatest","setData","writable","getWritable","$isServerRelationshipNode"],"sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { CollectionSlug, DataFromCollectionSlug } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\nexport type SerializedRelationshipNode = Omit<\n {\n type: 'relationship'\n } & Spread<RelationshipData, Omit<SerializedDecoratorBlockNode, 'type'>>,\n 'children'\n>\n\nfunction $relationshipElementToServerNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createServerRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipServerNode extends DecoratorBlockNode {\n __data: RelationshipData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: RelationshipData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static override clone(node: RelationshipServerNode): RelationshipServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'relationship'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: $relationshipElementToServerNode,\n priority: 2,\n }\n },\n }\n }\n\n static override importJSON(serializedNode: SerializedRelationshipNode): RelationshipServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createServerRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override decorate(_editor: LexicalEditor, _config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n element.setAttribute(\n 'data-lexical-relationship-id',\n String(typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value),\n )\n element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo)\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedRelationshipNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'relationship',\n version: 2,\n }\n }\n\n getData(): RelationshipData {\n return this.getLatest().__data\n }\n\n override getTextContent(): string {\n return `${this.__data?.relationTo} relation to ${typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value}`\n }\n\n setData(data: RelationshipData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n}\n\nexport function $createServerRelationshipNode(data: RelationshipData): RelationshipServerNode {\n return new RelationshipServerNode({\n data,\n })\n}\n\nexport function $isServerRelationshipNode(\n node: LexicalNode | null | RelationshipServerNode | undefined,\n): node is RelationshipServerNode {\n return node instanceof RelationshipServerNode\n}\n"],"mappings":"AAeA,SAASA,kBAAkB,QAAQ;AAgBnC,SAASC,iCAAiCC,OAAuB;EAC/D,MAAMC,EAAA,GAAKD,OAAA,CAAQE,YAAY,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D,QAAA,CAAStC,MAAM,GAAGE,IAAA;EACpB;AACF;AAEA,OAAO,SAASL,8BAA8BK,IAAsB;EAClE,OAAO,IAAIH,sBAAA,CAAuB;IAChCG;EACF;AACF;AAEA,OAAO,SAASsC,0BACd5C,IAA6D;EAE7D,OAAOA,IAAA,YAAgBG,sBAAA;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"RelationshipNode.js","names":["DecoratorBlockNode","$relationshipElementToServerNode","domNode","id","getAttribute","relationTo","node","$createServerRelationshipNode","value","RelationshipServerNode","__data","constructor","data","format","key","clone","__format","__key","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","isInline","decorate","_editor","_config","exportDOM","element","document","createElement","setAttribute","String","text","createTextNode","getTextContent","append","exportJSON","getData","type","getLatest","setData","writable","getWritable","$isServerRelationshipNode"],"sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n} from 'lexical'\nimport type { CollectionSlug, DataFromCollectionSlug } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\nexport type SerializedRelationshipNode = RelationshipData &\n StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'relationship'>\n\nfunction $relationshipElementToServerNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createServerRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipServerNode extends DecoratorBlockNode {\n __data: RelationshipData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: RelationshipData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static override clone(node: RelationshipServerNode): RelationshipServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'relationship'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: $relationshipElementToServerNode,\n priority: 2,\n }\n },\n }\n }\n\n static override importJSON(serializedNode: SerializedRelationshipNode): RelationshipServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createServerRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override decorate(_editor: LexicalEditor, _config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n element.setAttribute(\n 'data-lexical-relationship-id',\n String(typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value),\n )\n element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo)\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedRelationshipNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'relationship',\n version: 2,\n }\n }\n\n getData(): RelationshipData {\n return this.getLatest().__data\n }\n\n override getTextContent(): string {\n return `${this.__data?.relationTo} relation to ${typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value}`\n }\n\n setData(data: RelationshipData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n}\n\nexport function $createServerRelationshipNode(data: RelationshipData): RelationshipServerNode {\n return new RelationshipServerNode({\n data,\n })\n}\n\nexport function $isServerRelationshipNode(\n node: LexicalNode | null | RelationshipServerNode | undefined,\n): node is RelationshipServerNode {\n return node instanceof RelationshipServerNode\n}\n"],"mappings":"AAcA,SAASA,kBAAkB,QAAQ;AAcnC,SAASC,iCAAiCC,OAAuB;EAC/D,MAAMC,EAAA,GAAKD,OAAA,CAAQE,YAAY,CAAC;EAChC,MAAMC,UAAA,GAAaH,OAAA,CAAQE,YAAY,CAAC;EAExC,IAAID,EAAA,IAAM,QAAQE,UAAA,IAAc,MAAM;IACpC,MAAMC,IAAA,GAAOC,6BAAA,CAA8B;MACzCF,UAAA;MACAG,KAAA,EAAOL;IACT;IACA,OAAO;MAAEG;IAAK;EAChB;EACA,OAAO;AACT;AAEA,OAAO,MAAMG,sBAAA,SAA+BT,kBAAA;EAC1CU,MAAA;EAEAC,YAAY;IACVC,IAAI;IACJC,MAAM;IACNC;EAAG,CAKJ,EAAE;IACD,KAAK,CAACD,MAAA,EAAQC,GAAA;IACd,IAAI,CAACJ,MAAM,GAAGE,IAAA;EAChB;EAEA,OAAgBG,MAAMT,IAA4B,EAA0B;IAC1E,OAAO,IAAI,IAAI,CAAC;MACdM,IAAA,EAAMN,IAAA,CAAKI,MAAM;MACjBG,MAAA,EAAQP,IAAA,CAAKU,QAAQ;MACrBF,GAAA,EAAKR,IAAA,CAAKW;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,UAAA,EAAqD;IACnE,OAAO;MACLC,GAAA,EAAMlB,OAAA;QACJ,IACE,CAACA,OAAA,CAAQmB,YAAY,CAAC,2CACtB,CAACnB,OAAA,CAAQmB,YAAY,CAA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IAAA,EAAM;MACNnB,OAAA,EAAS;IACX;EACF;EAEAkB,QAAA,EAA4B;IAC1B,OAAO,IAAI,CAACE,SAAS,GAAGpC,MAAM;EAChC;EAES+B,eAAA,EAAyB;IAChC,OAAO,GAAG,IAAI,CAAC/B,MAAM,EAAEL,UAAA,gBAA0B,OAAO,IAAI,CAACK,MAAM,EAAEF,KAAA,KAAU,WAAW,IAAI,CAACE,MAAM,EAAEF,KAAA,EAAOL,EAAA,GAAK,IAAI,CAACO,MAAM,EAAEF,KAAA,EAAO;EACzI;EAEAuC,QAAQnC,IAAsB,EAAQ;IACpC,MAAMoC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAAStC,MAAM,GAAGE,IAAA;EACpB;AACF;AAEA,OAAO,SAASL,8BAA8BK,IAAsB;EAClE,OAAO,IAAIH,sBAAA,CAAuB;IAChCG;EACF;AACF;AAEA,OAAO,SAASsC,0BACd5C,IAA6D;EAE7D,OAAOA,IAAA,YAAgBG,sBAAA;AACzB","ignoreList":[]}
@@ -4,7 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import { TextStateIcon } from '../../lexical/ui/icons/TextState/index.js';
5
5
  import { createClientFeature } from '../../utilities/createClientFeature.js';
6
6
  import { registerTextStates, setTextState, StatePlugin } from './textState.js';
7
- const toolbarGroups = props => {
7
+ const toolbarGroups = (props, stateMap) => {
8
8
  const items = [];
9
9
  for (const stateKey in props.state) {
10
10
  const key = props.state[stateKey];
@@ -19,7 +19,7 @@ const toolbarGroups = props => {
19
19
  onSelect: ({
20
20
  editor
21
21
  }) => {
22
- setTextState(editor, stateKey, stateValue);
22
+ setTextState(editor, stateMap, stateKey, stateValue);
23
23
  }
24
24
  });
25
25
  }
@@ -34,7 +34,7 @@ const toolbarGroups = props => {
34
34
  editor
35
35
  }) => {
36
36
  for (const stateKey in props.state) {
37
- setTextState(editor, stateKey, undefined);
37
+ setTextState(editor, stateMap, stateKey, undefined);
38
38
  }
39
39
  },
40
40
  order: 1
@@ -54,17 +54,19 @@ const toolbarGroups = props => {
54
54
  export const TextStateFeatureClient = createClientFeature(({
55
55
  props
56
56
  }) => {
57
- registerTextStates(props.state);
57
+ const stateMap = registerTextStates(props.state);
58
58
  return {
59
59
  plugins: [{
60
- Component: StatePlugin,
60
+ Component: () => StatePlugin({
61
+ stateMap
62
+ }),
61
63
  position: 'normal'
62
64
  }],
63
65
  toolbarFixed: {
64
- groups: toolbarGroups(props)
66
+ groups: toolbarGroups(props, stateMap)
65
67
  },
66
68
  toolbarInline: {
67
- groups: toolbarGroups(props)
69
+ groups: toolbarGroups(props, stateMap)
68
70
  }
69
71
  };
70
72
  });
@@ -1 +1 @@
1
- {"version":3,"file":"feature.client.js","names":["TextStateIcon","createClientFeature","registerTextStates","setTextState","StatePlugin","toolbarGroups","props","items","stateKey","state","key","stateValue","meta","push","ChildComponent","_jsx","css","label","onSelect","editor","clearStyle","i18n","t","undefined","order","type","color","TextStateFeatureClient","plugins","Component","position","toolbarFixed","groups","toolbarInline"],"sources":["../../../src/features/textState/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ToolbarDropdownGroup, ToolbarGroup } from '../toolbars/types.js'\nimport type { TextStateFeatureProps } from './feature.server.js'\n\nimport { TextStateIcon } from '../../lexical/ui/icons/TextState/index.js'\nimport { createClientFeature } from '../../utilities/createClientFeature.js'\nimport { registerTextStates, setTextState, StatePlugin } from './textState.js'\n\nconst toolbarGroups = (props: TextStateFeatureProps): ToolbarGroup[] => {\n const items: ToolbarDropdownGroup['items'] = []\n\n for (const stateKey in props.state) {\n const key = props.state[stateKey]!\n for (const stateValue in key) {\n const meta = key[stateValue]!\n items.push({\n ChildComponent: () => <TextStateIcon css={meta.css} />,\n key: stateValue,\n label: meta.label,\n onSelect: ({ editor }) => {\n setTextState(editor, stateKey, stateValue)\n },\n })\n }\n }\n\n const clearStyle: ToolbarDropdownGroup['items'] = [\n {\n ChildComponent: () => <TextStateIcon />,\n key: `clear-style`,\n label: ({ i18n }) => i18n.t('lexical:textState:defaultStyle'),\n onSelect: ({ editor }) => {\n for (const stateKey in props.state) {\n setTextState(editor, stateKey, undefined)\n }\n },\n order: 1,\n },\n ]\n\n return [\n {\n type: 'dropdown',\n ChildComponent: () => <TextStateIcon css={{ color: 'var(--theme-elevation-600)' }} />,\n items: [...clearStyle, ...items],\n key: 'textState',\n order: 30,\n },\n ]\n}\n\nexport const TextStateFeatureClient = createClientFeature<TextStateFeatureProps>(({ props }) => {\n registerTextStates(props.state)\n return {\n plugins: [\n {\n Component: StatePlugin,\n position: 'normal',\n },\n ],\n toolbarFixed: {\n groups: toolbarGroups(props),\n },\n toolbarInline: {\n groups: toolbarGroups(props),\n },\n }\n})\n"],"mappings":"AAAA;;;AAKA,SAASA,aAAa,QAAQ;AAC9B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,kBAAkB,EAAEC,YAAY,EAAEC,WAAW,QAAQ;AAE9D,MAAMC,aAAA,GAAiBC,KAAA;EACrB,MAAMC,KAAA,GAAuC,EAAE;EAE/C,KAAK,MAAMC,QAAA,IAAYF,KAAA,CAAMG,KAAK,EAAE;IAClC,MAAMC,GAAA,GAAMJ,KAAA,CAAMG,KAAK,CAACD,QAAA,CAAS;IACjC,KAAK,MAAMG,UAAA,IAAcD,GAAA,EAAK;MAC5B,MAAME,IAAA,GAAOF,GAAG,CAACC,UAAA,CAAW;MAC5BJ,KAAA,CAAMM,IAAI,CAAC;QACTC,cAAA,EAAgBA,CAAA,kBAAMC,IAAA,CAACf,aAAA;UAAcgB,GAAA,EAAKJ,IAAA,CAAKI;;QAC/CN,GAAA,EAAKC,UAAA;QACLM,KAAA,EAAOL,IAAA,CAAKK,KAAK;QACjBC,QAAA,EAAUA,CAAC;UAAEC;QAAM,CAAE;UACnBhB,YAAA,CAAagB,MAAA,EAAQX,QAAA,EAAUG,UAAA;QACjC;MACF;IACF;EACF;EAEA,MAAMS,UAAA,GAA4C,CAChD;IACEN,cAAA,EAAgBA,CAAA,kBAAMC,IAAA,CAACf,aAAA;IACvBU,GAAA,EAAK,aAAa;IAClBO,KAAA,EAAOA,CAAC;MAAEI;IAAI,CAAE,KAAKA,IAAA,CAAKC,CAAC,CAAC;IAC5BJ,QAAA,EAAUA,CAAC;MAAEC;IAAM,CAAE;MACnB,KAAK,MAAMX,QAAA,IAAYF,KAAA,CAAMG,KAAK,EAAE;QAClCN,YAAA,CAAagB,MAAA,EAAQX,QAAA,EAAUe,SAAA;MACjC;IACF;IACAC,KAAA,EAAO;EACT,EACD;EAED,OAAO,CACL;IACEC,IAAA,EAAM;IACNX,cAAA,EAAgBA,CAAA,kBAAMC,IAAA,CAACf,aAAA;MAAcgB,GAAA,EAAK;QAAEU,KAAA,EAAO;MAA6B;;IAChFnB,KAAA,EAAO,C,GAAIa,UAAA,E,GAAeb,KAAA,CAAM;IAChCG,GAAA,EAAK;IACLc,KAAA,EAAO;EACT,EACD;AACH;AAEA,OAAO,MAAMG,sBAAA,GAAyB1B,mBAAA,CAA2C,CAAC;EAAEK;AAAK,CAAE;EACzFJ,kBAAA,CAAmBI,KAAA,CAAMG,KAAK;EAC9B,OAAO;IACLmB,OAAA,EAAS,CACP;MACEC,SAAA,EAAWzB,WAAA;MACX0B,QAAA,EAAU;IACZ,EACD;IACDC,YAAA,EAAc;MACZC,MAAA,EAAQ3B,aAAA,CAAcC,KAAA;IACxB;IACA2B,aAAA,EAAe;MACbD,MAAA,EAAQ3B,aAAA,CAAcC,KAAA;IACxB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"feature.client.js","names":["TextStateIcon","createClientFeature","registerTextStates","setTextState","StatePlugin","toolbarGroups","props","stateMap","items","stateKey","state","key","stateValue","meta","push","ChildComponent","_jsx","css","label","onSelect","editor","clearStyle","i18n","t","undefined","order","type","color","TextStateFeatureClient","plugins","Component","position","toolbarFixed","groups","toolbarInline"],"sources":["../../../src/features/textState/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ToolbarDropdownGroup, ToolbarGroup } from '../toolbars/types.js'\nimport type { TextStateFeatureProps } from './feature.server.js'\n\nimport { TextStateIcon } from '../../lexical/ui/icons/TextState/index.js'\nimport { createClientFeature } from '../../utilities/createClientFeature.js'\nimport { registerTextStates, setTextState, type StateMap, StatePlugin } from './textState.js'\n\nconst toolbarGroups = (props: TextStateFeatureProps, stateMap: StateMap): ToolbarGroup[] => {\n const items: ToolbarDropdownGroup['items'] = []\n\n for (const stateKey in props.state) {\n const key = props.state[stateKey]!\n for (const stateValue in key) {\n const meta = key[stateValue]!\n items.push({\n ChildComponent: () => <TextStateIcon css={meta.css} />,\n key: stateValue,\n label: meta.label,\n onSelect: ({ editor }) => {\n setTextState(editor, stateMap, stateKey, stateValue)\n },\n })\n }\n }\n\n const clearStyle: ToolbarDropdownGroup['items'] = [\n {\n ChildComponent: () => <TextStateIcon />,\n key: `clear-style`,\n label: ({ i18n }) => i18n.t('lexical:textState:defaultStyle'),\n onSelect: ({ editor }) => {\n for (const stateKey in props.state) {\n setTextState(editor, stateMap, stateKey, undefined)\n }\n },\n order: 1,\n },\n ]\n\n return [\n {\n type: 'dropdown',\n ChildComponent: () => <TextStateIcon css={{ color: 'var(--theme-elevation-600)' }} />,\n items: [...clearStyle, ...items],\n key: 'textState',\n order: 30,\n },\n ]\n}\n\nexport const TextStateFeatureClient = createClientFeature<TextStateFeatureProps>(({ props }) => {\n const stateMap = registerTextStates(props.state)\n return {\n plugins: [\n {\n Component: () => StatePlugin({ stateMap }),\n position: 'normal',\n },\n ],\n toolbarFixed: {\n groups: toolbarGroups(props, stateMap),\n },\n toolbarInline: {\n groups: toolbarGroups(props, stateMap),\n },\n }\n})\n"],"mappings":"AAAA;;;AAKA,SAASA,aAAa,QAAQ;AAC9B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,kBAAkB,EAAEC,YAAY,EAAiBC,WAAW,QAAQ;AAE7E,MAAMC,aAAA,GAAgBA,CAACC,KAAA,EAA8BC,QAAA;EACnD,MAAMC,KAAA,GAAuC,EAAE;EAE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AA2C,CAAC;EAAEK;AAAK,CAAE;EACzF,MAAMC,QAAA,GAAWL,kBAAA,CAAmBI,KAAA,CAAMI,KAAK;EAC/C,OAAO;IACLmB,OAAA,EAAS,CACP;MACEC,SAAA,EAAWA,CAAA,KAAM1B,WAAA,CAAY;QAAEG;MAAS;MACxCwB,QAAA,EAAU;IACZ,EACD;IACDC,YAAA,EAAc;MACZC,MAAA,EAAQ5B,aAAA,CAAcC,KAAA,EAAOC,QAAA;IAC/B;IACA2B,aAAA,EAAe;MACbD,MAAA,EAAQ5B,aAAA,CAAcC,KAAA,EAAOC,QAAA;IAC/B;EACF;AACF","ignoreList":[]}
@@ -1,6 +1,12 @@
1
- import type { LexicalEditor } from 'lexical';
2
- import { type TextStateFeatureProps } from './feature.server.js';
3
- export declare function registerTextStates(state: TextStateFeatureProps['state']): void;
4
- export declare function setTextState(editor: LexicalEditor, stateKey: string, value: string | undefined): void;
5
- export declare function StatePlugin(): null;
1
+ import type { LexicalEditor, StateConfig } from 'lexical';
2
+ import { type StateValues, type TextStateFeatureProps } from './feature.server.js';
3
+ export type StateMap = Map<string, {
4
+ stateConfig: StateConfig<string, string | undefined>;
5
+ stateValues: StateValues;
6
+ }>;
7
+ export declare function registerTextStates(state: TextStateFeatureProps['state']): StateMap;
8
+ export declare function setTextState(editor: LexicalEditor, stateMap: StateMap, stateKey: string, value: string | undefined): void;
9
+ export declare function StatePlugin({ stateMap }: {
10
+ stateMap: StateMap;
11
+ }): null;
6
12
  //# sourceMappingURL=textState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"textState.d.ts","sourceRoot":"","sources":["../../../src/features/textState/textState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAe,MAAM,SAAS,CAAA;AAOzD,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAUlF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,QASvE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,QAU9F;AAED,wBAAgB,WAAW,SA8C1B"}
1
+ {"version":3,"file":"textState.d.ts","sourceRoot":"","sources":["../../../src/features/textState/textState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAOzD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAElF,MAAM,MAAM,QAAQ,GAAG,GAAG,CACxB,MAAM,EACN;IACE,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IACpD,WAAW,EAAE,WAAW,CAAA;CACzB,CACF,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,YAYvE;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GAAG,SAAS,QAW1B;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,QA8C/D"}
@@ -2,8 +2,8 @@ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext
2
2
  import { $forEachSelectedTextNode } from '@lexical/selection';
3
3
  import { $getNodeByKey, $getState, $setState, createState, TextNode } from 'lexical';
4
4
  import { useEffect } from 'react';
5
- const stateMap = new Map();
6
5
  export function registerTextStates(state) {
6
+ const stateMap = new Map();
7
7
  for (const stateKey in state) {
8
8
  const stateValues = state[stateKey];
9
9
  const stateConfig = createState(stateKey, {
@@ -14,8 +14,9 @@ export function registerTextStates(state) {
14
14
  stateValues
15
15
  });
16
16
  }
17
+ return stateMap;
17
18
  }
18
- export function setTextState(editor, stateKey, value) {
19
+ export function setTextState(editor, stateMap, stateKey, value) {
19
20
  editor.update(() => {
20
21
  $forEachSelectedTextNode(textNode => {
21
22
  const stateMapEntry = stateMap.get(stateKey);
@@ -26,7 +27,9 @@ export function setTextState(editor, stateKey, value) {
26
27
  });
27
28
  });
28
29
  }
29
- export function StatePlugin() {
30
+ export function StatePlugin({
31
+ stateMap
32
+ }) {
30
33
  const [editor] = useLexicalComposerContext();
31
34
  useEffect(() => {
32
35
  return editor.registerMutationListener(TextNode, mutatedNodes => {