@payloadcms/richtext-lexical 3.61.0-internal.c252d14 → 3.61.0-internal.dd40839

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 (183) hide show
  1. package/dist/cell/rscEntry.d.ts +2 -10
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js +1 -2
  4. package/dist/cell/rscEntry.js.map +1 -1
  5. package/dist/exports/client/Field-5VLZM7KJ.js +2 -0
  6. package/dist/exports/client/Field-5VLZM7KJ.js.map +7 -0
  7. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js +2 -0
  8. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js.map +7 -0
  9. package/dist/exports/client/bundled.css +1 -1
  10. package/dist/exports/client/chunk-52JG5GGJ.js +2 -0
  11. package/dist/exports/client/chunk-52JG5GGJ.js.map +7 -0
  12. package/dist/exports/client/chunk-U4AOQOHA.js +12 -0
  13. package/dist/exports/client/chunk-U4AOQOHA.js.map +7 -0
  14. package/dist/exports/client/component-5YLBQB5B.js +2 -0
  15. package/dist/exports/client/component-5YLBQB5B.js.map +7 -0
  16. package/dist/exports/client/componentInline-QEXUNJU4.js +2 -0
  17. package/dist/exports/client/index.js +22 -22
  18. package/dist/exports/client/index.js.map +3 -3
  19. package/dist/exports/react/index.d.ts +1 -1
  20. package/dist/exports/react/index.d.ts.map +1 -1
  21. package/dist/exports/react/index.js.map +1 -1
  22. package/dist/features/blocks/client/component/BlockContent.js +1 -1
  23. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  24. package/dist/features/blocks/client/component/index.d.ts +1 -0
  25. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  26. package/dist/features/blocks/client/component/index.js +23 -20
  27. package/dist/features/blocks/client/component/index.js.map +1 -1
  28. package/dist/features/blocks/client/componentInline/index.d.ts +2 -1
  29. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  30. package/dist/features/blocks/client/componentInline/index.js +6 -6
  31. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  32. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  33. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  34. package/dist/features/blocks/client/nodes/BlocksNode.js +5 -3
  35. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  36. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -2
  37. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  38. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +5 -3
  39. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  40. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +2 -1
  41. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  42. package/dist/features/blocks/server/nodes/BlocksNode.js +9 -2
  43. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  44. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +1 -1
  45. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  46. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +6 -5
  47. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  48. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -14
  49. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  50. package/dist/features/converters/lexicalToJSX/Component/index.js +4 -2
  51. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  52. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +16 -1
  53. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  54. package/dist/features/converters/lexicalToJSX/converter/index.js +76 -4
  55. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  56. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +14 -10
  57. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  58. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  59. package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -1
  60. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  61. package/dist/features/link/nodes/AutoLinkNode.js +1 -1
  62. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  63. package/dist/features/link/nodes/LinkNode.js +1 -1
  64. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  65. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  66. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +4 -4
  67. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  68. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  69. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +4 -4
  70. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  71. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  72. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  73. package/dist/features/relationship/client/components/RelationshipComponent.js +2 -2
  74. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  75. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  76. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  77. package/dist/features/relationship/client/nodes/RelationshipNode.js +3 -2
  78. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  79. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +2 -1
  80. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  81. package/dist/features/relationship/server/nodes/RelationshipNode.js +9 -2
  82. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  83. package/dist/features/typesServer.d.ts +2 -2
  84. package/dist/features/typesServer.d.ts.map +1 -1
  85. package/dist/features/typesServer.js.map +1 -1
  86. package/dist/features/upload/client/component/index.d.ts +1 -0
  87. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  88. package/dist/features/upload/client/component/index.js +2 -2
  89. package/dist/features/upload/client/component/index.js.map +1 -1
  90. package/dist/features/upload/client/nodes/UploadNode.d.ts +2 -2
  91. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  92. package/dist/features/upload/client/nodes/UploadNode.js +2 -1
  93. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  94. package/dist/features/upload/client/plugin/index.js +2 -2
  95. package/dist/features/upload/client/plugin/index.js.map +1 -1
  96. package/dist/features/upload/server/nodes/UploadNode.d.ts +2 -1
  97. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  98. package/dist/features/upload/server/nodes/UploadNode.js +6 -0
  99. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  100. package/dist/field/Field.d.ts.map +1 -1
  101. package/dist/field/Field.js +50 -38
  102. package/dist/field/Field.js.map +1 -1
  103. package/dist/field/RichTextViewProvider.d.ts +84 -0
  104. package/dist/field/RichTextViewProvider.d.ts.map +1 -0
  105. package/dist/field/RichTextViewProvider.js +92 -0
  106. package/dist/field/RichTextViewProvider.js.map +1 -0
  107. package/dist/field/ViewSelector.d.ts +4 -0
  108. package/dist/field/ViewSelector.d.ts.map +1 -0
  109. package/dist/field/ViewSelector.js +89 -0
  110. package/dist/field/ViewSelector.js.map +1 -0
  111. package/dist/field/bundled.css +1 -1
  112. package/dist/field/index.d.ts.map +1 -1
  113. package/dist/field/index.js +63 -41
  114. package/dist/field/index.js.map +1 -1
  115. package/dist/field/rscEntry.d.ts +2 -3
  116. package/dist/field/rscEntry.d.ts.map +1 -1
  117. package/dist/field/rscEntry.js +15 -1
  118. package/dist/field/rscEntry.js.map +1 -1
  119. package/dist/index.d.ts +1 -1
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +9 -24
  122. package/dist/index.js.map +1 -1
  123. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  124. package/dist/lexical/LexicalEditor.js +2 -1
  125. package/dist/lexical/LexicalEditor.js.map +1 -1
  126. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  127. package/dist/lexical/LexicalProvider.js +12 -3
  128. package/dist/lexical/LexicalProvider.js.map +1 -1
  129. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  130. package/dist/lexical/config/client/loader.js +2 -4
  131. package/dist/lexical/config/client/loader.js.map +1 -1
  132. package/dist/lexical/nodes/index.d.ts +12 -2
  133. package/dist/lexical/nodes/index.d.ts.map +1 -1
  134. package/dist/lexical/nodes/index.js +195 -2
  135. package/dist/lexical/nodes/index.js.map +1 -1
  136. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +2 -0
  137. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -0
  138. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +48 -0
  139. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -0
  140. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  141. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +1 -1
  142. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  143. package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
  144. package/dist/lexical/theme/EditorTheme.js +3 -39
  145. package/dist/lexical/theme/EditorTheme.js.map +1 -1
  146. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  147. package/dist/lexical/ui/ContentEditable.js +16 -9
  148. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  149. package/dist/types.d.ts +138 -4
  150. package/dist/types.d.ts.map +1 -1
  151. package/dist/types.js.map +1 -1
  152. package/dist/utilities/editorConfigFactory.js +1 -1
  153. package/dist/utilities/editorConfigFactory.js.map +1 -1
  154. package/dist/utilities/generateImportMap.d.ts +2 -0
  155. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  156. package/dist/utilities/generateImportMap.js +6 -13
  157. package/dist/utilities/generateImportMap.js.map +1 -1
  158. package/dist/{getDefaultSanitizedEditorConfig.d.ts → utilities/getDefaultSanitizedEditorConfig.d.ts} +1 -1
  159. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -0
  160. package/dist/{getDefaultSanitizedEditorConfig.js → utilities/getDefaultSanitizedEditorConfig.js} +2 -2
  161. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -0
  162. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  163. package/dist/utilities/initLexicalFeatures.js +12 -13
  164. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  165. package/dist/validate/hasText.d.ts +6 -1
  166. package/dist/validate/hasText.d.ts.map +1 -1
  167. package/dist/validate/hasText.js +10 -4
  168. package/dist/validate/hasText.js.map +1 -1
  169. package/package.json +7 -7
  170. package/dist/exports/client/Field-YYMTSGSP.js +0 -2
  171. package/dist/exports/client/Field-YYMTSGSP.js.map +0 -7
  172. package/dist/exports/client/RelationshipComponent-JXQOFHXF.js +0 -2
  173. package/dist/exports/client/RelationshipComponent-JXQOFHXF.js.map +0 -7
  174. package/dist/exports/client/chunk-ADWHGDDR.js +0 -2
  175. package/dist/exports/client/chunk-ADWHGDDR.js.map +0 -7
  176. package/dist/exports/client/chunk-AFXLIYGL.js +0 -12
  177. package/dist/exports/client/chunk-AFXLIYGL.js.map +0 -7
  178. package/dist/exports/client/component-WT25HAJA.js +0 -2
  179. package/dist/exports/client/component-WT25HAJA.js.map +0 -7
  180. package/dist/exports/client/componentInline-MIPTDFRK.js +0 -2
  181. package/dist/getDefaultSanitizedEditorConfig.d.ts.map +0 -1
  182. package/dist/getDefaultSanitizedEditorConfig.js.map +0 -1
  183. /package/dist/exports/client/{componentInline-MIPTDFRK.js.map → componentInline-QEXUNJU4.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","names":["loadClientFeatures","config","featureClientImportMap","featureClientSchemaMap","field","schemaPath","unSanitizedEditorConfig","featureProvider","features","clientFeatureProps","featureKey","order","undefined","Error","sort","a","b","featureProviderMap","Map","feature","set","resolvedFeatures","loaded","key"],"sources":["../../../../src/lexical/config/client/loader.ts"],"sourcesContent":["'use client'\n\nimport type { ClientConfig, RichTextFieldClient } from 'payload'\n\nimport type {\n ClientFeatureProviderMap,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n} from '../../../features/typesClient.js'\nimport type { FeatureClientSchemaMap } from '../../../types.js'\nimport type { ClientEditorConfig } from '../types.js'\n\n/**\n * This function expects client functions to ALREADY be ordered & dependencies checked on the server\n * @param unSanitizedEditorConfig\n */\nexport function loadClientFeatures({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n field,\n schemaPath,\n unSanitizedEditorConfig,\n}: {\n config: ClientConfig\n featureClientImportMap: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n field?: RichTextFieldClient\n schemaPath: string\n unSanitizedEditorConfig: ClientEditorConfig\n}): ResolvedClientFeatureMap {\n for (const featureProvider of unSanitizedEditorConfig.features) {\n if (\n !featureProvider?.clientFeatureProps?.featureKey ||\n featureProvider?.clientFeatureProps?.order === undefined ||\n featureProvider?.clientFeatureProps?.order === null\n ) {\n throw new Error(\n 'A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.',\n )\n }\n }\n\n // sort unSanitizedEditorConfig.features by order\n unSanitizedEditorConfig.features = unSanitizedEditorConfig.features.sort(\n (a, b) => a.clientFeatureProps.order - b.clientFeatureProps.order,\n )\n\n const featureProviderMap: ClientFeatureProviderMap = new Map()\n for (const feature of unSanitizedEditorConfig.features) {\n featureProviderMap.set(feature.clientFeatureProps.featureKey, feature)\n }\n\n const resolvedFeatures: ResolvedClientFeatureMap = new Map()\n\n // Make sure all dependencies declared in the respective features exist\n let loaded = 0\n for (const featureProvider of unSanitizedEditorConfig.features) {\n const feature: Partial<ResolvedClientFeature<any>> =\n typeof featureProvider.feature === 'function'\n ? featureProvider.feature({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n featureProviderMap,\n field,\n resolvedFeatures,\n schemaPath,\n unSanitizedEditorConfig,\n })\n : featureProvider.feature\n\n feature.key = featureProvider.clientFeatureProps.featureKey\n feature.order = loaded\n\n resolvedFeatures.set(\n featureProvider.clientFeatureProps.featureKey,\n feature as ResolvedClientFeature<any>,\n )\n\n loaded++\n }\n\n return resolvedFeatures\n}\n"],"mappings":"AAAA;;AAYA;;;;AAIA,OAAO,SAASA,mBAAmB;EACjCC,MAAM;EACNC,sBAAsB;EACtBC,sBAAsB;EACtBC,KAAK;EACLC,UAAU;EACVC;AAAuB,CAQxB;EACC,KAAK,MAAMC,eAAA,IAAmBD,uBAAA,CAAwBE,QAAQ,EAAE;IAC9D,IACE,CAACD,eAAA,EAAiBE,kBAAA,EAAoBC,UAAA,IACtCH,eAAA,EAAiBE,kBAAA,EAAoBE,KAAA,KAAUC,SAAA,IAC/CL,eAAA,EAAiBE,kBAAA,EAAoBE,KAAA,KAAU,MAC/C;MACA,MAAM,IAAIE,KAAA,CACR;IAEJ;EACF;EAEA;EACAP,uBAAA,CAAwBE,QAAQ,GAAGF,uBAAA,CAAwBE,QAAQ,CAACM,IAAI,CACtE,CAACC,CAAA,EAAGC,CAAA,KAAMD,CAAA,CAAEN,kBAAkB,CAACE,KAAK,GAAGK,CAAA,CAAEP,kBAAkB,CAACE,KAAK;EAGnE,MAAMM,kBAAA,GAA+C,IAAIC,GAAA;EACzD,KAAK,MAAMC,OAAA,IAAWb,uBAAA,CAAwBE,QAAQ,EAAE;IACtDS,kBAAA,CAAmBG,GAAG,CAACD,OAAA,CAAQV,kBAAkB,CAACC,UAAU,EAAES,OAAA;EAChE;EAEA,MAAME,gBAAA,GAA6C,IAAIH,GAAA;EAEvD;EACA,IAAII,MAAA,GAAS;EACb,KAAK,MAAMf,eAAA,IAAmBD,uBAAA,CAAwBE,QAAQ,EAAE;IAC9D,MAAMW,OAAA,GACJ,OAAOZ,eAAA,CAAgBY,OAAO,KAAK,aAC/BZ,eAAA,CAAgBY,OAAO,CAAC;MACtBlB,MAAA;MACAC,sBAAA;MACAC,sBAAA;MACAc,kBAAA;MACAb,KAAA;MACAiB,gBAAA;MACAhB,UAAA;MACAC;IACF,KACAC,eAAA,CAAgBY,OAAO;IAE7BA,OAAA,CAAQI,GAAG,GAAGhB,eAAA,CAAgBE,kBAAkB,CAACC,UAAU;IAC3DS,OAAA,CAAQR,KAAK,GAAGW,MAAA;IAEhBD,gBAAA,CAAiBD,GAAG,CAClBb,eAAA,CAAgBE,kBAAkB,CAACC,UAAU,EAC7CS,OAAA;IAGFG,MAAA;EACF;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"loader.js","names":["loadClientFeatures","config","featureClientImportMap","featureClientSchemaMap","field","schemaPath","unSanitizedEditorConfig","featureProviderMap","Map","featureProvider","features","clientFeatureProps","featureKey","order","undefined","Error","set","sort","a","b","resolvedFeatures","loaded","feature","key"],"sources":["../../../../src/lexical/config/client/loader.ts"],"sourcesContent":["'use client'\n\nimport type { ClientConfig, RichTextFieldClient } from 'payload'\n\nimport type {\n ClientFeatureProviderMap,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n} from '../../../features/typesClient.js'\nimport type { FeatureClientSchemaMap } from '../../../types.js'\nimport type { ClientEditorConfig } from '../types.js'\n\n/**\n * This function expects client functions to ALREADY be ordered & dependencies checked on the server\n * @param unSanitizedEditorConfig\n */\nexport function loadClientFeatures({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n field,\n schemaPath,\n unSanitizedEditorConfig,\n}: {\n config: ClientConfig\n featureClientImportMap: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n field?: RichTextFieldClient\n schemaPath: string\n unSanitizedEditorConfig: ClientEditorConfig\n}): ResolvedClientFeatureMap {\n const featureProviderMap: ClientFeatureProviderMap = new Map()\n\n for (const featureProvider of unSanitizedEditorConfig.features) {\n if (\n !featureProvider?.clientFeatureProps?.featureKey ||\n featureProvider?.clientFeatureProps?.order === undefined ||\n featureProvider?.clientFeatureProps?.order === null\n ) {\n throw new Error(\n 'A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.',\n )\n }\n featureProviderMap.set(featureProvider.clientFeatureProps.featureKey, featureProvider)\n }\n\n // sort unSanitizedEditorConfig.features by order\n unSanitizedEditorConfig.features = unSanitizedEditorConfig.features.sort(\n (a, b) => a.clientFeatureProps.order - b.clientFeatureProps.order,\n )\n\n const resolvedFeatures: ResolvedClientFeatureMap = new Map()\n\n // Make sure all dependencies declared in the respective features exist\n let loaded = 0\n for (const featureProvider of unSanitizedEditorConfig.features) {\n const feature: Partial<ResolvedClientFeature<any>> =\n typeof featureProvider.feature === 'function'\n ? featureProvider.feature({\n config,\n featureClientImportMap,\n featureClientSchemaMap,\n featureProviderMap,\n field,\n resolvedFeatures,\n schemaPath,\n unSanitizedEditorConfig,\n })\n : featureProvider.feature\n\n feature.key = featureProvider.clientFeatureProps.featureKey\n feature.order = loaded\n\n resolvedFeatures.set(\n featureProvider.clientFeatureProps.featureKey,\n feature as ResolvedClientFeature<any>,\n )\n\n loaded++\n }\n\n return resolvedFeatures\n}\n"],"mappings":"AAAA;;AAYA;;;;AAIA,OAAO,SAASA,mBAAmB;EACjCC,MAAM;EACNC,sBAAsB;EACtBC,sBAAsB;EACtBC,KAAK;EACLC,UAAU;EACVC;AAAuB,CAQxB;EACC,MAAMC,kBAAA,GAA+C,IAAIC,GAAA;EAEzD,KAAK,MAAMC,eAAA,IAAmBH,uBAAA,CAAwBI,QAAQ,EAAE;IAC9D,IACE,CAACD,eAAA,EAAiBE,kBAAA,EAAoBC,UAAA,IACtCH,eAAA,EAAiBE,kBAAA,EAAoBE,KAAA,KAAUC,SAAA,IAC/CL,eAAA,EAAiBE,kBAAA,EAAoBE,KAAA,KAAU,MAC/C;MACA,MAAM,IAAIE,KAAA,CACR;IAEJ;IACAR,kBAAA,CAAmBS,GAAG,CAACP,eAAA,CAAgBE,kBAAkB,CAACC,UAAU,EAAEH,eAAA;EACxE;EAEA;EACAH,uBAAA,CAAwBI,QAAQ,GAAGJ,uBAAA,CAAwBI,QAAQ,CAACO,IAAI,CACtE,CAACC,CAAA,EAAGC,CAAA,KAAMD,CAAA,CAAEP,kBAAkB,CAACE,KAAK,GAAGM,CAAA,CAAER,kBAAkB,CAACE,KAAK;EAGnE,MAAMO,gBAAA,GAA6C,IAAIZ,GAAA;EAEvD;EACA,IAAIa,MAAA,GAAS;EACb,KAAK,MAAMZ,eAAA,IAAmBH,uBAAA,CAAwBI,QAAQ,EAAE;IAC9D,MAAMY,OAAA,GACJ,OAAOb,eAAA,CAAgBa,OAAO,KAAK,aAC/Bb,eAAA,CAAgBa,OAAO,CAAC;MACtBrB,MAAA;MACAC,sBAAA;MACAC,sBAAA;MACAI,kBAAA;MACAH,KAAA;MACAgB,gBAAA;MACAf,UAAA;MACAC;IACF,KACAG,eAAA,CAAgBa,OAAO;IAE7BA,OAAA,CAAQC,GAAG,GAAGd,eAAA,CAAgBE,kBAAkB,CAACC,UAAU;IAC3DU,OAAA,CAAQT,KAAK,GAAGQ,MAAA;IAEhBD,gBAAA,CAAiBJ,GAAG,CAClBP,eAAA,CAAgBE,kBAAkB,CAACC,UAAU,EAC7CU,OAAA;IAGFD,MAAA;EACF;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
@@ -1,8 +1,18 @@
1
- import type { Klass, LexicalNode, LexicalNodeReplacement } from 'lexical';
1
+ import type { Klass, LexicalEditor, LexicalNode, LexicalNodeReplacement } from 'lexical';
2
2
  import type { NodeWithHooks } from '../../features/typesServer.js';
3
+ import type { LexicalEditorNodeMap } from '../../types.js';
3
4
  import type { SanitizedClientEditorConfig, SanitizedServerEditorConfig } from '../config/types.js';
4
- export declare function getEnabledNodes({ editorConfig, }: {
5
+ /**
6
+ * Register view definitions for an editor
7
+ */
8
+ export declare function registerEditorNodeViews(editor: LexicalEditor, nodeViews: LexicalEditorNodeMap): void;
9
+ /**
10
+ * Clear all view overrides for an editor (restores default rendering)
11
+ */
12
+ export declare function clearEditorNodeViews(editor: LexicalEditor): void;
13
+ export declare function getEnabledNodes({ editorConfig, nodeViews, }: {
5
14
  editorConfig: SanitizedClientEditorConfig | SanitizedServerEditorConfig;
15
+ nodeViews?: LexicalEditorNodeMap;
6
16
  }): Array<Klass<LexicalNode> | LexicalNodeReplacement>;
7
17
  export declare function getEnabledNodesFromServerNodes({ nodes, }: {
8
18
  nodes: Array<Klass<LexicalNode> | LexicalNodeReplacement> | Array<NodeWithHooks>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lexical/nodes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,KAAK,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAElG,wBAAgB,eAAe,CAAC,EAC9B,YAAY,GACb,EAAE;IACD,YAAY,EAAE,2BAA2B,GAAG,2BAA2B,CAAA;CACxE,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,CAIrD;AAED,wBAAgB,8BAA8B,CAAC,EAC7C,KAAK,GACN,EAAE;IACD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAA;CACjF,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,CAOrD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lexical/nodes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,KAAK,EACL,aAAa,EACb,WAAW,EACX,sBAAsB,EACvB,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAgB,MAAM,gBAAgB,CAAA;AACxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAMlG;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,oBAAoB,GAC9B,IAAI,CAsCN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAEhE;AAoID,wBAAgB,eAAe,CAAC,EAC9B,YAAY,EACZ,SAAS,GACV,EAAE;IACD,YAAY,EAAE,2BAA2B,GAAG,2BAA2B,CAAA;IACvE,SAAS,CAAC,EAAE,oBAAoB,CAAA;CACjC,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,CAyCrD;AAED,wBAAgB,8BAA8B,CAAC,EAC7C,KAAK,GACN,EAAE;IACD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAA;CACjF,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,CAOrD"}
@@ -1,9 +1,202 @@
1
+ import React from 'react';
2
+ // Store view definitions for each editor and node type
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ const editorNodeViews = new WeakMap();
5
+ /**
6
+ * Register view definitions for an editor
7
+ */
8
+ export function registerEditorNodeViews(editor, nodeViews) {
9
+ if (!editorNodeViews.has(editor)) {
10
+ editorNodeViews.set(editor, new Map());
11
+ }
12
+ const editorViews = editorNodeViews.get(editor);
13
+ // Register each node type's view
14
+ for (const [nodeType, value] of Object.entries(nodeViews)) {
15
+ if (!value || typeof value !== 'object') {
16
+ continue;
17
+ }
18
+ // Handle blocks specially - store each block type with key 'block:blockType'
19
+ if (nodeType === 'blocks') {
20
+ for (const [blockType, viewDef] of Object.entries(
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ value)) {
23
+ editorViews.set(`block:${blockType}`, viewDef);
24
+ }
25
+ continue;
26
+ }
27
+ // Handle inlineBlocks specially - store each block type with key 'inlineBlock:blockType'
28
+ if (nodeType === 'inlineBlocks') {
29
+ for (const [blockType, viewDef] of Object.entries(
30
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+ value)) {
32
+ editorViews.set(`inlineBlock:${blockType}`, viewDef);
33
+ }
34
+ continue;
35
+ }
36
+ // Regular node types
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ editorViews.set(nodeType, value);
39
+ }
40
+ }
41
+ /**
42
+ * Clear all view overrides for an editor (restores default rendering)
43
+ */
44
+ export function clearEditorNodeViews(editor) {
45
+ editorNodeViews.delete(editor);
46
+ }
47
+ /**
48
+ * Get the view definition for a specific editor and node
49
+ */
50
+ function getEditorNodeView(editor, nodeType,
51
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
+ node) {
53
+ const editorViews = editorNodeViews.get(editor);
54
+ // For block nodes, look up by blockType
55
+ if (nodeType === 'block' && node?.['__fields']?.blockType) {
56
+ const blockType = node['__fields'].blockType;
57
+ return editorViews?.get(`block:${blockType}`);
58
+ }
59
+ // For inlineBlock nodes, look up by blockType
60
+ if (nodeType === 'inlineBlock' && node?.['__fields']?.blockType) {
61
+ const blockType = node['__fields'].blockType;
62
+ return editorViews?.get(`inlineBlock:${blockType}`);
63
+ }
64
+ // Regular node types
65
+ return editorViews?.get(nodeType);
66
+ }
67
+ /**
68
+ * Apply view overrides to a specific node type by modifying its prototype
69
+ * Uses WeakMap to check per-editor at runtime
70
+ */
71
+ function applyNodeOverride({
72
+ node,
73
+ nodeType
74
+ }) {
75
+ if (!('getType' in node) || node.getType() !== nodeType) {
76
+ return;
77
+ }
78
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
+ const NodeClass = node;
80
+ // Store original methods if not already stored
81
+ if (!NodeClass.prototype._originalDecorate) {
82
+ NodeClass.prototype._originalDecorate = NodeClass.prototype.decorate;
83
+ }
84
+ if (!NodeClass.prototype._originalCreateDOM) {
85
+ NodeClass.prototype._originalCreateDOM = NodeClass.prototype.createDOM;
86
+ }
87
+ // Override decorate method (for DecoratorNodes)
88
+ if (NodeClass.prototype.decorate && !NodeClass.prototype._decorateOverridden) {
89
+ NodeClass.prototype._decorateOverridden = true;
90
+ const hasCreateDOM = !!NodeClass.prototype.createDOM;
91
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
+ NodeClass.prototype.decorate = function (editor, config) {
93
+ const viewDef = getEditorNodeView(editor, nodeType, this);
94
+ if (viewDef) {
95
+ // Priority 1: If Component is provided, use it
96
+ if (viewDef.Component) {
97
+ return viewDef.Component({
98
+ config,
99
+ editor,
100
+ isEditor: true,
101
+ isJSXConverter: false,
102
+ node: this
103
+ });
104
+ }
105
+ // Priority 2: If custom createDOM is provided, use html in decorate
106
+ if (viewDef.createDOM && viewDef.html) {
107
+ const htmlContent = typeof viewDef.html === 'function' ? viewDef.html({
108
+ config,
109
+ editor,
110
+ isEditor: true,
111
+ isJSXConverter: false,
112
+ node: this
113
+ }) : viewDef.html;
114
+ return React.createElement('span', {
115
+ dangerouslySetInnerHTML: {
116
+ __html: htmlContent
117
+ }
118
+ });
119
+ }
120
+ // Priority 3: If only html is provided (no custom createDOM),
121
+ // createDOM will handle it, so decorate returns empty fragment
122
+ if (viewDef.html && hasCreateDOM && !viewDef.createDOM) {
123
+ return React.createElement(React.Fragment);
124
+ }
125
+ }
126
+ // Otherwise use original
127
+ return NodeClass.prototype._originalDecorate.call(this, editor, config);
128
+ };
129
+ }
130
+ // Override createDOM method (for ElementNodes)
131
+ if (NodeClass.prototype.createDOM && !NodeClass.prototype._createDOMOverridden) {
132
+ NodeClass.prototype._createDOMOverridden = true;
133
+ NodeClass.prototype.createDOM = function (config, editor) {
134
+ const viewDef = getEditorNodeView(editor, nodeType, this);
135
+ if (viewDef) {
136
+ // If createDOM is provided, use it
137
+ if (viewDef.createDOM) {
138
+ return viewDef.createDOM({
139
+ config,
140
+ editor,
141
+ node: this
142
+ });
143
+ }
144
+ // If html is provided (as a function or string), create element from it
145
+ if (viewDef.html) {
146
+ const htmlContent = typeof viewDef.html === 'function' ? viewDef.html({
147
+ config,
148
+ editor,
149
+ isEditor: true,
150
+ isJSXConverter: false,
151
+ node: this
152
+ }) : viewDef.html;
153
+ const tempDiv = document.createElement('div');
154
+ tempDiv.innerHTML = htmlContent;
155
+ return tempDiv.firstElementChild || tempDiv;
156
+ }
157
+ }
158
+ // Otherwise use original
159
+ return NodeClass.prototype._originalCreateDOM.call(this, config, editor);
160
+ };
161
+ }
162
+ }
1
163
  export function getEnabledNodes({
2
- editorConfig
164
+ editorConfig,
165
+ nodeViews
3
166
  }) {
4
- return getEnabledNodesFromServerNodes({
167
+ const nodes = getEnabledNodesFromServerNodes({
5
168
  nodes: editorConfig.features.nodes
6
169
  });
170
+ if (nodeViews) {
171
+ // Apply node overrides by modifying prototypes (once globally)
172
+ // The overrides check per-editor at runtime using WeakMap
173
+ const nodeTypesToOverride = new Set();
174
+ for (const [key, value] of Object.entries(nodeViews)) {
175
+ if (!value || typeof value !== 'object') {
176
+ continue;
177
+ }
178
+ // If 'blocks' key exists with content, we need to override 'block' nodes
179
+ if (key === 'blocks' && Object.keys(value).length > 0) {
180
+ nodeTypesToOverride.add('block');
181
+ } else if (key === 'inlineBlocks' && Object.keys(value).length > 0) {
182
+ nodeTypesToOverride.add('inlineBlock');
183
+ } else {
184
+ nodeTypesToOverride.add(key);
185
+ }
186
+ }
187
+ for (const node of nodes) {
188
+ if ('getType' in node) {
189
+ const nodeType = node.getType();
190
+ if (nodeTypesToOverride.has(nodeType)) {
191
+ applyNodeOverride({
192
+ node,
193
+ nodeType
194
+ });
195
+ }
196
+ }
197
+ }
198
+ }
199
+ return nodes;
7
200
  }
8
201
  export function getEnabledNodesFromServerNodes({
9
202
  nodes
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getEnabledNodes","editorConfig","getEnabledNodesFromServerNodes","nodes","features","map","node"],"sources":["../../../src/lexical/nodes/index.ts"],"sourcesContent":["import type { Klass, LexicalNode, LexicalNodeReplacement } from 'lexical'\n\nimport type { NodeWithHooks } from '../../features/typesServer.js'\nimport type { SanitizedClientEditorConfig, SanitizedServerEditorConfig } from '../config/types.js'\n\nexport function getEnabledNodes({\n editorConfig,\n}: {\n editorConfig: SanitizedClientEditorConfig | SanitizedServerEditorConfig\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n return getEnabledNodesFromServerNodes({\n nodes: editorConfig.features.nodes,\n })\n}\n\nexport function getEnabledNodesFromServerNodes({\n nodes,\n}: {\n nodes: Array<Klass<LexicalNode> | LexicalNodeReplacement> | Array<NodeWithHooks>\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n return nodes.map((node) => {\n if ('node' in node) {\n return node.node\n }\n return node\n })\n}\n"],"mappings":"AAKA,OAAO,SAASA,gBAAgB;EAC9BC;AAAY,CAGb;EACC,OAAOC,8BAAA,CAA+B;IACpCC,KAAA,EAAOF,YAAA,CAAaG,QAAQ,CAACD;EAC/B;AACF;AAEA,OAAO,SAASD,+BAA+B;EAC7CC;AAAK,CAGN;EACC,OAAOA,KAAA,CAAME,GAAG,CAAEC,IAAA;IAChB,IAAI,UAAUA,IAAA,EAAM;MAClB,OAAOA,IAAA,CAAKA,IAAI;IAClB;IACA,OAAOA,IAAA;EACT;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","editorNodeViews","WeakMap","registerEditorNodeViews","editor","nodeViews","has","set","Map","editorViews","get","nodeType","value","Object","entries","blockType","viewDef","clearEditorNodeViews","delete","getEditorNodeView","node","applyNodeOverride","getType","NodeClass","prototype","_originalDecorate","decorate","_originalCreateDOM","createDOM","_decorateOverridden","hasCreateDOM","config","Component","isEditor","isJSXConverter","html","htmlContent","createElement","dangerouslySetInnerHTML","__html","Fragment","call","_createDOMOverridden","tempDiv","document","innerHTML","firstElementChild","getEnabledNodes","editorConfig","nodes","getEnabledNodesFromServerNodes","features","nodeTypesToOverride","Set","key","keys","length","add","map"],"sources":["../../../src/lexical/nodes/index.ts"],"sourcesContent":["import type {\n EditorConfig,\n Klass,\n LexicalEditor,\n LexicalNode,\n LexicalNodeReplacement,\n} from 'lexical'\n\nimport React from 'react'\n\nimport type { NodeWithHooks } from '../../features/typesServer.js'\nimport type { LexicalEditorNodeMap, NodeMapValue } from '../../types.js'\nimport type { SanitizedClientEditorConfig, SanitizedServerEditorConfig } from '../config/types.js'\n\n// Store view definitions for each editor and node type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst editorNodeViews = new WeakMap<LexicalEditor, Map<string, NodeMapValue<any>>>()\n\n/**\n * Register view definitions for an editor\n */\nexport function registerEditorNodeViews(\n editor: LexicalEditor,\n nodeViews: LexicalEditorNodeMap,\n): void {\n if (!editorNodeViews.has(editor)) {\n editorNodeViews.set(editor, new Map())\n }\n const editorViews = editorNodeViews.get(editor)!\n\n // Register each node type's view\n for (const [nodeType, value] of Object.entries(nodeViews)) {\n if (!value || typeof value !== 'object') {\n continue\n }\n\n // Handle blocks specially - store each block type with key 'block:blockType'\n if (nodeType === 'blocks') {\n for (const [blockType, viewDef] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value as Record<string, NodeMapValue<any>>,\n )) {\n editorViews.set(`block:${blockType}`, viewDef)\n }\n continue\n }\n\n // Handle inlineBlocks specially - store each block type with key 'inlineBlock:blockType'\n if (nodeType === 'inlineBlocks') {\n for (const [blockType, viewDef] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value as Record<string, NodeMapValue<any>>,\n )) {\n editorViews.set(`inlineBlock:${blockType}`, viewDef)\n }\n continue\n }\n\n // Regular node types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n editorViews.set(nodeType, value as NodeMapValue<any>)\n }\n}\n\n/**\n * Clear all view overrides for an editor (restores default rendering)\n */\nexport function clearEditorNodeViews(editor: LexicalEditor): void {\n editorNodeViews.delete(editor)\n}\n\n/**\n * Get the view definition for a specific editor and node\n */\nfunction getEditorNodeView(\n editor: LexicalEditor,\n nodeType: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n node?: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): NodeMapValue<any> | undefined {\n const editorViews = editorNodeViews.get(editor)\n\n // For block nodes, look up by blockType\n if (nodeType === 'block' && node?.['__fields']?.blockType) {\n const blockType = node['__fields'].blockType\n return editorViews?.get(`block:${blockType}`)\n }\n\n // For inlineBlock nodes, look up by blockType\n if (nodeType === 'inlineBlock' && node?.['__fields']?.blockType) {\n const blockType = node['__fields'].blockType\n return editorViews?.get(`inlineBlock:${blockType}`)\n }\n\n // Regular node types\n return editorViews?.get(nodeType)\n}\n\n/**\n * Apply view overrides to a specific node type by modifying its prototype\n * Uses WeakMap to check per-editor at runtime\n */\nfunction applyNodeOverride({\n node,\n nodeType,\n}: {\n node: Klass<LexicalNode>\n nodeType: string\n}): void {\n if (!('getType' in node) || node.getType() !== nodeType) {\n return\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const NodeClass = node as any\n\n // Store original methods if not already stored\n if (!NodeClass.prototype._originalDecorate) {\n NodeClass.prototype._originalDecorate = NodeClass.prototype.decorate\n }\n if (!NodeClass.prototype._originalCreateDOM) {\n NodeClass.prototype._originalCreateDOM = NodeClass.prototype.createDOM\n }\n\n // Override decorate method (for DecoratorNodes)\n if (NodeClass.prototype.decorate && !NodeClass.prototype._decorateOverridden) {\n NodeClass.prototype._decorateOverridden = true\n const hasCreateDOM = !!NodeClass.prototype.createDOM\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n NodeClass.prototype.decorate = function (editor: LexicalEditor, config: EditorConfig): any {\n const viewDef = getEditorNodeView(editor, nodeType, this)\n\n if (viewDef) {\n // Priority 1: If Component is provided, use it\n if (viewDef.Component) {\n return viewDef.Component({\n config,\n editor,\n isEditor: true,\n isJSXConverter: false,\n node: this,\n })\n }\n\n // Priority 2: If custom createDOM is provided, use html in decorate\n if (viewDef.createDOM && viewDef.html) {\n const htmlContent =\n typeof viewDef.html === 'function'\n ? viewDef.html({ config, editor, isEditor: true, isJSXConverter: false, node: this })\n : viewDef.html\n return React.createElement('span', {\n dangerouslySetInnerHTML: { __html: htmlContent },\n })\n }\n\n // Priority 3: If only html is provided (no custom createDOM),\n // createDOM will handle it, so decorate returns empty fragment\n if (viewDef.html && hasCreateDOM && !viewDef.createDOM) {\n return React.createElement(React.Fragment)\n }\n }\n\n // Otherwise use original\n return NodeClass.prototype._originalDecorate.call(this, editor, config)\n }\n }\n\n // Override createDOM method (for ElementNodes)\n if (NodeClass.prototype.createDOM && !NodeClass.prototype._createDOMOverridden) {\n NodeClass.prototype._createDOMOverridden = true\n NodeClass.prototype.createDOM = function (\n config: EditorConfig,\n editor: LexicalEditor,\n ): HTMLElement {\n const viewDef = getEditorNodeView(editor, nodeType, this)\n\n if (viewDef) {\n // If createDOM is provided, use it\n if (viewDef.createDOM) {\n return viewDef.createDOM({ config, editor, node: this })\n }\n\n // If html is provided (as a function or string), create element from it\n if (viewDef.html) {\n const htmlContent =\n typeof viewDef.html === 'function'\n ? viewDef.html({ config, editor, isEditor: true, isJSXConverter: false, node: this })\n : viewDef.html\n const tempDiv = document.createElement('div')\n tempDiv.innerHTML = htmlContent\n return (tempDiv.firstElementChild as HTMLElement) || tempDiv\n }\n }\n\n // Otherwise use original\n return NodeClass.prototype._originalCreateDOM.call(this, config, editor)\n }\n }\n}\n\nexport function getEnabledNodes({\n editorConfig,\n nodeViews,\n}: {\n editorConfig: SanitizedClientEditorConfig | SanitizedServerEditorConfig\n nodeViews?: LexicalEditorNodeMap\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n const nodes = getEnabledNodesFromServerNodes({\n nodes: editorConfig.features.nodes,\n })\n\n if (nodeViews) {\n // Apply node overrides by modifying prototypes (once globally)\n // The overrides check per-editor at runtime using WeakMap\n const nodeTypesToOverride = new Set<string>()\n\n for (const [key, value] of Object.entries(nodeViews)) {\n if (!value || typeof value !== 'object') {\n continue\n }\n\n // If 'blocks' key exists with content, we need to override 'block' nodes\n if (key === 'blocks' && Object.keys(value).length > 0) {\n nodeTypesToOverride.add('block')\n }\n // If 'inlineBlocks' key exists with content, we need to override 'inlineBlock' nodes\n else if (key === 'inlineBlocks' && Object.keys(value).length > 0) {\n nodeTypesToOverride.add('inlineBlock')\n }\n // Regular node types\n else {\n nodeTypesToOverride.add(key)\n }\n }\n\n for (const node of nodes) {\n if ('getType' in node) {\n const nodeType = node.getType()\n\n if (nodeTypesToOverride.has(nodeType)) {\n applyNodeOverride({ node, nodeType })\n }\n }\n }\n }\n\n return nodes\n}\n\nexport function getEnabledNodesFromServerNodes({\n nodes,\n}: {\n nodes: Array<Klass<LexicalNode> | LexicalNodeReplacement> | Array<NodeWithHooks>\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n return nodes.map((node) => {\n if ('node' in node) {\n return node.node\n }\n return node\n })\n}\n"],"mappings":"AAQA,OAAOA,KAAA,MAAW;AAMlB;AACA;AACA,MAAMC,eAAA,GAAkB,IAAIC,OAAA;AAE5B;;;AAGA,OAAO,SAASC,wBACdC,MAAqB,EACrBC,SAA+B;EAE/B,IAAI,CAACJ,eAAA,CAAgBK,GAAG,CAACF,MAAA,GAAS;IAChCH,eAAA,CAAgBM,GAAG,CAACH,MAAA,EAAQ,IAAII,GAAA;EAClC;EACA,MAAMC,WAAA,GAAcR,eAAA,CAAgBS,GAAG,CAACN,MAAA;EAExC;EACA,KAAK,MAAM,CAACO,QAAA,EAAUC,KAAA,CAAM,IAAIC,MAAA,CAAOC,OAAO,CAACT,SAAA,GAAY;IACzD,IAAI,CAACO,K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BAAA,CAAkB;YAAED,IAAA;YAAMT;UAAS;QACrC;MACF;IACF;EACF;EAEA,OAAOsC,KAAA;AACT;AAEA,OAAO,SAASC,+BAA+B;EAC7CD;AAAK,CAGN;EACC,OAAOA,KAAA,CAAMS,GAAG,CAAEtC,IAAA;IAChB,IAAI,UAAUA,IAAA,EAAM;MAClB,OAAOA,IAAA,CAAKA,IAAI;IAClB;IACA,OAAOA,IAAA;EACT;AACF","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export declare function NodeViewOverridePlugin(): null;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx"],"names":[],"mappings":"AAOA,wBAAgB,sBAAsB,IAAI,IAAI,CAsB7C"}
@@ -0,0 +1,48 @@
1
+ 'use client';
2
+
3
+ import { c as _c } from "react/compiler-runtime";
4
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
5
+ import { useEffect } from 'react';
6
+ import { useRichTextView } from '../../../field/RichTextViewProvider.js';
7
+ import { clearEditorNodeViews, registerEditorNodeViews } from '../../nodes/index.js';
8
+ export function NodeViewOverridePlugin() {
9
+ const $ = _c(5);
10
+ const [editor] = useLexicalComposerContext();
11
+ const {
12
+ currentView,
13
+ views
14
+ } = useRichTextView();
15
+ let t0;
16
+ let t1;
17
+ if ($[0] !== currentView || $[1] !== editor || $[2] !== views) {
18
+ t0 = () => {
19
+ if (!views) {
20
+ return;
21
+ }
22
+ if (currentView === "default") {
23
+ if (views.default) {
24
+ registerEditorNodeViews(editor, views.default);
25
+ } else {
26
+ clearEditorNodeViews(editor);
27
+ }
28
+ } else {
29
+ if (views[currentView]) {
30
+ clearEditorNodeViews(editor);
31
+ registerEditorNodeViews(editor, views[currentView]);
32
+ }
33
+ }
34
+ };
35
+ t1 = [editor, views, currentView];
36
+ $[0] = currentView;
37
+ $[1] = editor;
38
+ $[2] = views;
39
+ $[3] = t0;
40
+ $[4] = t1;
41
+ } else {
42
+ t0 = $[3];
43
+ t1 = $[4];
44
+ }
45
+ useEffect(t0, t1);
46
+ return null;
47
+ }
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useEffect","useRichTextView","clearEditorNodeViews","registerEditorNodeViews","NodeViewOverridePlugin","$","editor","currentView","views","t0","t1","default"],"sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useEffect } from 'react'\n\nimport { useRichTextView } from '../../../field/RichTextViewProvider.js'\nimport { clearEditorNodeViews, registerEditorNodeViews } from '../../nodes/index.js'\n\nexport function NodeViewOverridePlugin(): null {\n const [editor] = useLexicalComposerContext()\n const { currentView, views } = useRichTextView()\n\n useEffect(() => {\n if (!views) {\n return\n }\n\n if (currentView === 'default') {\n if (views.default) {\n registerEditorNodeViews(editor, views.default)\n } else {\n clearEditorNodeViews(editor)\n }\n } else if (views[currentView]) {\n clearEditorNodeViews(editor)\n registerEditorNodeViews(editor, views[currentView])\n }\n }, [editor, views, currentView])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,SAAS,QAAQ;AAE1B,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,EAAEC,uBAAuB,QAAQ;AAE9D,OAAO,SAAAC,uBAAA;EAAA,MAAAC,CAAA,GAAAP,EAAA;EACL,OAAAQ,MAAA,IAAiBP,yBAAA;EACjB;IAAAQ,WAAA;IAAAC;EAAA,IAA+BP,eAAA;EAAA,IAAAQ,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAL,CAAA,QAAAE,WAAA,IAAAF,CAAA,QAAAC,MAAA,IAAAD,CAAA,QAAAG,KAAA;IAErBC,EAAA,GAAAA,CAAA;MAAA,KACHD,KAAA;QAAA;MAAA;MAAA,IAIDD,WAAA,KAAgB;QAAA,IACdC,KAAA,CAAAG,OAAA;UACFR,uBAAA,CAAwBG,MAAA,EAAQE,KAAA,CAAAG,OAAa;QAAA;UAE7CT,oBAAA,CAAqBI,MAAA;QAAA;MAAA;QAAA,IAEdE,KAAK,CAACD,WAAA;UACfL,oBAAA,CAAqBI,MAAA;UACrBH,uBAAA,CAAwBG,MAAA,EAAQE,KAAK,CAACD,WAAA,CAAY;QAAA;MAAA;IAAA;IAEnDG,EAAA,IAACJ,MAAA,EAAQE,KAAA,EAAOD,WAAA;IAAYF,CAAA,MAAAE,WAAA;IAAAF,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAAG,KAAA;IAAAH,CAAA,MAAAI,EAAA;IAAAJ,CAAA,MAAAK,EAAA;EAAA;IAAAD,EAAA,GAAAJ,CAAA;IAAAK,EAAA,GAAAL,CAAA;EAAA;EAf/BL,SAAA,CAAUS,EAeV,EAAGC,EAA4B;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"setHandlePosition.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/plugins/handles/utils/setHandlePosition.ts"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,WAAW,GAAG,IAAI,EAC9B,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,WAAW,EACvB,UAAU,GAAE,MAAU,QAmCvB"}
1
+ {"version":3,"file":"setHandlePosition.d.ts","sourceRoot":"","sources":["../../../../../src/lexical/plugins/handles/utils/setHandlePosition.ts"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,WAAW,GAAG,IAAI,EAC9B,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,WAAW,EACvB,UAAU,GAAE,MAAU,QAyCvB"}
@@ -12,7 +12,7 @@ export function setHandlePosition(targetElem, handleElem, anchorElem, leftOffset
12
12
  const floatingElemRect = handleElem.getBoundingClientRect();
13
13
  const anchorElementRect = anchorElem.getBoundingClientRect();
14
14
  let top;
15
- const isBlockStyle = ['lexical-block', 'lexical-upload', 'lexical-relationship'].some(classes => targetElem.firstElementChild?.classList.contains(classes));
15
+ const isBlockStyle = ['LexicalEditorTheme__block', 'LexicalEditorTheme__upload', 'LexicalEditorTheme__relationship'].some(classes => targetElem.classList.contains(classes) || targetElem.firstElementChild?.classList.contains(classes));
16
16
  if (!isBlockStyle) {
17
17
  // No need to let line height affect the re-positioning of the floating element if line height has no
18
18
  // visual effect on the element. Otherwise, the floating element will be positioned incorrectly.
@@ -1 +1 @@
1
- {"version":3,"file":"setHandlePosition.js","names":["doesLineHeightAffectElement","setHandlePosition","targetElem","handleElem","anchorElem","leftOffset","style","opacity","transform","targetRect","getBoundingClientRect","targetStyle","window","getComputedStyle","floatingElemRect","anchorElementRect","top","isBlockStyle","some","classes","firstElementChild","classList","contains","actualLineHeight","parseInt","lineHeight","height","left"],"sources":["../../../../../src/lexical/plugins/handles/utils/setHandlePosition.ts"],"sourcesContent":["'use client'\nimport { doesLineHeightAffectElement } from './doesLineHeightAffectElement.js'\n\nexport function setHandlePosition(\n targetElem: HTMLElement | null,\n handleElem: HTMLElement,\n anchorElem: HTMLElement,\n leftOffset: number = 0, // SPACE\n) {\n if (!targetElem) {\n handleElem.style.opacity = '0'\n handleElem.style.transform = 'translate(-10000px, -10000px)'\n return\n }\n\n const targetRect = targetElem.getBoundingClientRect()\n const targetStyle = window.getComputedStyle(targetElem)\n const floatingElemRect = handleElem.getBoundingClientRect()\n const anchorElementRect = anchorElem.getBoundingClientRect()\n\n let top: number\n\n const isBlockStyle = ['lexical-block', 'lexical-upload', 'lexical-relationship'].some((classes) =>\n targetElem.firstElementChild?.classList.contains(classes),\n )\n\n if (!isBlockStyle) {\n // No need to let line height affect the re-positioning of the floating element if line height has no\n // visual effect on the element. Otherwise, the floating element will be positioned incorrectly.\n const actualLineHeight = doesLineHeightAffectElement(targetElem)\n ? parseInt(targetStyle.lineHeight, 10)\n : 0\n\n top = targetRect.top + (actualLineHeight - floatingElemRect.height) / 2 - anchorElementRect.top\n } else {\n top = targetRect.top + 8 - anchorElementRect.top\n }\n\n const left = leftOffset\n\n handleElem.style.opacity = '1'\n handleElem.style.transform = `translate(${left}px, ${top}px)`\n}\n"],"mappings":"AAAA;;AACA,SAASA,2BAA2B,QAAQ;AAE5C,OAAO,SAASC,kBACdC,UAA8B,EAC9BC,UAAuB,EACvBC,UAAuB,EACvBC,UAAA,GAAqB,CAAC;EAEtB,IAAI,CAACH,UAAA,EAAY;IACfC,UAAA,CAAWG,KAAK,CAACC,OAAO,GAAG;IAC3BJ,UAAA,CAAWG,KAAK,CAACE,SAAS,GAAG;IAC7B;EACF;EAEA,MAAMC,UAAA,GAAaP,UAAA,CAAWQ,qBAAqB;EACnD,MAAMC,WAAA,GAAcC,MAAA,CAAOC,gBAAgB,CAACX,UAAA;EAC5C,MAAMY,gBAAA,GAAmBX,UAAA,CAAWO,qBAAqB;EACzD,MAAMK,iBAAA,GAAoBX,UAAA,CAAWM,qBAAqB;EAE1D,IAAIM,GAAA;EAEJ,MAAMC,YAAA,GAAe,CAAC,iBAAiB,kBAAkB,uBAAuB,CAACC,IAAI,CAAEC,OAAA,IACrFjB,UAAA,CAAWkB,iBAAiB,EAAEC,SAAA,CAAUC,QAAA,CAASH,OAAA;EAGnD,IAAI,CAACF,YAAA,EAAc;IACjB;IACA;IACA,MAAMM,gBAAA,GAAmBvB,2BAAA,CAA4BE,UAAA,IACjDsB,QAAA,CAASb,WAAA,CAAYc,UAAU,EAAE,MACjC;IAEJT,GAAA,GAAMP,UAAA,CAAWO,GAAG,GAAG,CAACO,gBAAA,GAAmBT,gBAAA,CAAiBY,MAAM,IAAI,IAAIX,iBAAA,CAAkBC,GAAG;EACjG,OAAO;IACLA,GAAA,GAAMP,UAAA,CAAWO,GAAG,GAAG,IAAID,iBAAA,CAAkBC,GAAG;EAClD;EAEA,MAAMW,IAAA,GAAOtB,UAAA;EAEbF,UAAA,CAAWG,KAAK,CAACC,OAAO,GAAG;EAC3BJ,UAAA,CAAWG,KAAK,CAACE,SAAS,GAAG,aAAamB,IAAA,OAAWX,GAAA,KAAQ;AAC/D","ignoreList":[]}
1
+ {"version":3,"file":"setHandlePosition.js","names":["doesLineHeightAffectElement","setHandlePosition","targetElem","handleElem","anchorElem","leftOffset","style","opacity","transform","targetRect","getBoundingClientRect","targetStyle","window","getComputedStyle","floatingElemRect","anchorElementRect","top","isBlockStyle","some","classes","classList","contains","firstElementChild","actualLineHeight","parseInt","lineHeight","height","left"],"sources":["../../../../../src/lexical/plugins/handles/utils/setHandlePosition.ts"],"sourcesContent":["'use client'\nimport { doesLineHeightAffectElement } from './doesLineHeightAffectElement.js'\n\nexport function setHandlePosition(\n targetElem: HTMLElement | null,\n handleElem: HTMLElement,\n anchorElem: HTMLElement,\n leftOffset: number = 0, // SPACE\n) {\n if (!targetElem) {\n handleElem.style.opacity = '0'\n handleElem.style.transform = 'translate(-10000px, -10000px)'\n return\n }\n\n const targetRect = targetElem.getBoundingClientRect()\n const targetStyle = window.getComputedStyle(targetElem)\n const floatingElemRect = handleElem.getBoundingClientRect()\n const anchorElementRect = anchorElem.getBoundingClientRect()\n\n let top: number\n\n const isBlockStyle = [\n 'LexicalEditorTheme__block',\n 'LexicalEditorTheme__upload',\n 'LexicalEditorTheme__relationship',\n ].some(\n (classes) =>\n targetElem.classList.contains(classes) ||\n targetElem.firstElementChild?.classList.contains(classes),\n )\n\n if (!isBlockStyle) {\n // No need to let line height affect the re-positioning of the floating element if line height has no\n // visual effect on the element. Otherwise, the floating element will be positioned incorrectly.\n const actualLineHeight = doesLineHeightAffectElement(targetElem)\n ? parseInt(targetStyle.lineHeight, 10)\n : 0\n\n top = targetRect.top + (actualLineHeight - floatingElemRect.height) / 2 - anchorElementRect.top\n } else {\n top = targetRect.top + 8 - anchorElementRect.top\n }\n\n const left = leftOffset\n\n handleElem.style.opacity = '1'\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,OAAWX,GAAA,KAAQ;AAC/D","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorTheme.d.ts","sourceRoot":"","sources":["../../../src/lexical/theme/EditorTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,eAAO,MAAM,kBAAkB,EAAE,kBA6GhC,CAAA"}
1
+ {"version":3,"file":"EditorTheme.d.ts","sourceRoot":"","sources":["../../../src/lexical/theme/EditorTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,eAAO,MAAM,kBAAkB,EAAE,kBA0EhC,CAAA"}
@@ -3,43 +3,7 @@ export const LexicalEditorTheme = {
3
3
  blockCursor: 'LexicalEditorTheme__blockCursor',
4
4
  characterLimit: 'LexicalEditorTheme__characterLimit',
5
5
  code: 'LexicalEditorTheme__code',
6
- codeHighlight: {
7
- atrule: 'LexicalEditorTheme__tokenAttr',
8
- attr: 'LexicalEditorTheme__tokenAttr',
9
- boolean: 'LexicalEditorTheme__tokenProperty',
10
- builtin: 'LexicalEditorTheme__tokenSelector',
11
- cdata: 'LexicalEditorTheme__tokenComment',
12
- char: 'LexicalEditorTheme__tokenSelector',
13
- class: 'LexicalEditorTheme__tokenFunction',
14
- 'class-name': 'LexicalEditorTheme__tokenFunction',
15
- comment: 'LexicalEditorTheme__tokenComment',
16
- constant: 'LexicalEditorTheme__tokenProperty',
17
- deleted: 'LexicalEditorTheme__tokenProperty',
18
- doctype: 'LexicalEditorTheme__tokenComment',
19
- entity: 'LexicalEditorTheme__tokenOperator',
20
- function: 'LexicalEditorTheme__tokenFunction',
21
- important: 'LexicalEditorTheme__tokenVariable',
22
- inserted: 'LexicalEditorTheme__tokenSelector',
23
- keyword: 'LexicalEditorTheme__tokenAttr',
24
- namespace: 'LexicalEditorTheme__tokenVariable',
25
- number: 'LexicalEditorTheme__tokenProperty',
26
- operator: 'LexicalEditorTheme__tokenOperator',
27
- prolog: 'LexicalEditorTheme__tokenComment',
28
- property: 'LexicalEditorTheme__tokenProperty',
29
- punctuation: 'LexicalEditorTheme__tokenPunctuation',
30
- regex: 'LexicalEditorTheme__tokenVariable',
31
- selector: 'LexicalEditorTheme__tokenSelector',
32
- string: 'LexicalEditorTheme__tokenSelector',
33
- symbol: 'LexicalEditorTheme__tokenProperty',
34
- tag: 'LexicalEditorTheme__tokenProperty',
35
- url: 'LexicalEditorTheme__tokenOperator',
36
- variable: 'LexicalEditorTheme__tokenVariable'
37
- },
38
- embedBlock: {
39
- base: 'LexicalEditorTheme__embedBlock',
40
- focus: 'LexicalEditorTheme__embedBlockFocus'
41
- },
42
- hashtag: 'LexicalEditorTheme__hashtag',
6
+ inlineBlock: 'LexicalEditorTheme__inlineBlock',
43
7
  heading: {
44
8
  h1: 'LexicalEditorTheme__h1',
45
9
  h2: 'LexicalEditorTheme__h2',
@@ -51,7 +15,6 @@ export const LexicalEditorTheme = {
51
15
  hr: 'LexicalEditorTheme__hr',
52
16
  hrSelected: 'LexicalEditorTheme__hrSelected',
53
17
  indent: 'LexicalEditorTheme__indent',
54
- inlineImage: 'LexicalEditor__inline-image',
55
18
  link: 'LexicalEditorTheme__link',
56
19
  list: {
57
20
  checklist: 'LexicalEditorTheme__checklist',
@@ -68,6 +31,7 @@ export const LexicalEditorTheme = {
68
31
  mark: 'LexicalEditorTheme__mark',
69
32
  markOverlap: 'LexicalEditorTheme__markOverlap',
70
33
  paragraph: 'LexicalEditorTheme__paragraph',
34
+ placeholder: 'LexicalEditorTheme__placeholder',
71
35
  quote: 'LexicalEditorTheme__quote',
72
36
  relationship: 'LexicalEditorTheme__relationship',
73
37
  rtl: 'LexicalEditorTheme__rtl',
@@ -100,6 +64,6 @@ export const LexicalEditorTheme = {
100
64
  underline: 'LexicalEditorTheme__textUnderline',
101
65
  underlineStrikethrough: 'LexicalEditorTheme__textUnderlineStrikethrough'
102
66
  },
103
- upload: 'editor-upload'
67
+ upload: 'LexicalEditorTheme__upload'
104
68
  };
105
69
  //# sourceMappingURL=EditorTheme.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditorTheme.js","names":["LexicalEditorTheme","block","blockCursor","characterLimit","code","codeHighlight","atrule","attr","boolean","builtin","cdata","char","class","comment","constant","deleted","doctype","entity","function","important","inserted","keyword","namespace","number","operator","prolog","property","punctuation","regex","selector","string","symbol","tag","url","variable","embedBlock","base","focus","hashtag","heading","h1","h2","h3","h4","h5","h6","hr","hrSelected","indent","inlineImage","link","list","checklist","listitem","listitemChecked","listitemUnchecked","nested","olDepth","ul","ltr","mark","markOverlap","paragraph","quote","relationship","rtl","tab","table","tableAddColumns","tableAddRows","tableAlignment","center","right","tableCell","tableCellActionButton","tableCellActionButtonContainer","tableCellHeader","tableCellResizer","tableCellSelected","tableFrozenColumn","tableRowStriping","tableScrollableWrapper","tableSelected","tableSelection","text","bold","italic","strikethrough","subscript","superscript","underline","underlineStrikethrough","upload"],"sources":["../../../src/lexical/theme/EditorTheme.tsx"],"sourcesContent":["import type { EditorThemeClasses } from 'lexical'\n\nexport const LexicalEditorTheme: EditorThemeClasses = {\n block: 'LexicalEditorTheme__block',\n blockCursor: 'LexicalEditorTheme__blockCursor',\n characterLimit: 'LexicalEditorTheme__characterLimit',\n code: 'LexicalEditorTheme__code',\n codeHighlight: {\n atrule: 'LexicalEditorTheme__tokenAttr',\n attr: 'LexicalEditorTheme__tokenAttr',\n boolean: 'LexicalEditorTheme__tokenProperty',\n builtin: 'LexicalEditorTheme__tokenSelector',\n cdata: 'LexicalEditorTheme__tokenComment',\n char: 'LexicalEditorTheme__tokenSelector',\n class: 'LexicalEditorTheme__tokenFunction',\n 'class-name': 'LexicalEditorTheme__tokenFunction',\n comment: 'LexicalEditorTheme__tokenComment',\n constant: 'LexicalEditorTheme__tokenProperty',\n deleted: 'LexicalEditorTheme__tokenProperty',\n doctype: 'LexicalEditorTheme__tokenComment',\n entity: 'LexicalEditorTheme__tokenOperator',\n function: 'LexicalEditorTheme__tokenFunction',\n important: 'LexicalEditorTheme__tokenVariable',\n inserted: 'LexicalEditorTheme__tokenSelector',\n keyword: 'LexicalEditorTheme__tokenAttr',\n namespace: 'LexicalEditorTheme__tokenVariable',\n number: 'LexicalEditorTheme__tokenProperty',\n operator: 'LexicalEditorTheme__tokenOperator',\n prolog: 'LexicalEditorTheme__tokenComment',\n property: 'LexicalEditorTheme__tokenProperty',\n punctuation: 'LexicalEditorTheme__tokenPunctuation',\n regex: 'LexicalEditorTheme__tokenVariable',\n selector: 'LexicalEditorTheme__tokenSelector',\n string: 'LexicalEditorTheme__tokenSelector',\n symbol: 'LexicalEditorTheme__tokenProperty',\n tag: 'LexicalEditorTheme__tokenProperty',\n url: 'LexicalEditorTheme__tokenOperator',\n variable: 'LexicalEditorTheme__tokenVariable',\n },\n embedBlock: {\n base: 'LexicalEditorTheme__embedBlock',\n focus: 'LexicalEditorTheme__embedBlockFocus',\n },\n hashtag: 'LexicalEditorTheme__hashtag',\n heading: {\n h1: 'LexicalEditorTheme__h1',\n h2: 'LexicalEditorTheme__h2',\n h3: 'LexicalEditorTheme__h3',\n h4: 'LexicalEditorTheme__h4',\n h5: 'LexicalEditorTheme__h5',\n h6: 'LexicalEditorTheme__h6',\n },\n hr: 'LexicalEditorTheme__hr',\n hrSelected: 'LexicalEditorTheme__hrSelected',\n indent: 'LexicalEditorTheme__indent',\n inlineImage: 'LexicalEditor__inline-image',\n link: 'LexicalEditorTheme__link',\n list: {\n checklist: 'LexicalEditorTheme__checklist',\n listitem: 'LexicalEditorTheme__listItem',\n listitemChecked: 'LexicalEditorTheme__listItemChecked',\n listitemUnchecked: 'LexicalEditorTheme__listItemUnchecked',\n nested: {\n listitem: 'LexicalEditorTheme__nestedListItem',\n },\n olDepth: [\n 'LexicalEditorTheme__ol1',\n 'LexicalEditorTheme__ol2',\n 'LexicalEditorTheme__ol3',\n 'LexicalEditorTheme__ol4',\n 'LexicalEditorTheme__ol5',\n ],\n ul: 'LexicalEditorTheme__ul',\n },\n ltr: 'LexicalEditorTheme__ltr',\n mark: 'LexicalEditorTheme__mark',\n markOverlap: 'LexicalEditorTheme__markOverlap',\n paragraph: 'LexicalEditorTheme__paragraph',\n quote: 'LexicalEditorTheme__quote',\n relationship: 'LexicalEditorTheme__relationship',\n rtl: 'LexicalEditorTheme__rtl',\n tab: 'LexicalEditorTheme__tabNode',\n table: 'LexicalEditorTheme__table',\n tableAddColumns: 'LexicalEditorTheme__tableAddColumns',\n tableAddRows: 'LexicalEditorTheme__tableAddRows',\n tableAlignment: {\n center: 'LexicalEditorTheme__tableAlignmentCenter',\n right: 'LexicalEditorTheme__tableAlignmentRight',\n },\n tableCell: 'LexicalEditorTheme__tableCell',\n tableCellActionButton: 'LexicalEditorTheme__tableCellActionButton',\n tableCellActionButtonContainer: 'LexicalEditorTheme__tableCellActionButtonContainer',\n tableCellHeader: 'LexicalEditorTheme__tableCellHeader',\n tableCellResizer: 'LexicalEditorTheme__tableCellResizer',\n tableCellSelected: 'LexicalEditorTheme__tableCellSelected',\n tableFrozenColumn: 'LexicalEditorTheme__tableFrozenColumn',\n tableRowStriping: 'LexicalEditorTheme__tableRowStriping',\n tableScrollableWrapper: 'LexicalEditorTheme__tableScrollableWrapper',\n tableSelected: 'LexicalEditorTheme__tableSelected',\n tableSelection: 'LexicalEditorTheme__tableSelection',\n text: {\n bold: 'LexicalEditorTheme__textBold',\n code: 'LexicalEditorTheme__textCode',\n italic: 'LexicalEditorTheme__textItalic',\n strikethrough: 'LexicalEditorTheme__textStrikethrough',\n subscript: 'LexicalEditorTheme__textSubscript',\n superscript: 'LexicalEditorTheme__textSuperscript',\n underline: 'LexicalEditorTheme__textUnderline',\n underlineStrikethrough: 'LexicalEditorTheme__textUnderlineStrikethrough',\n },\n upload: 'editor-upload',\n}\n"],"mappings":"AAEA,OAAO,MAAMA,kBAAA,GAAyC;EACpDC,KAAA,EAAO;EACPC,WAAA,EAAa;EACbC,cAAA,EAAgB;EA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AA,EAAK;EACLC,KAAA,EAAO;EACPC,eAAA,EAAiB;EACjBC,YAAA,EAAc;EACdC,cAAA,EAAgB;IACdC,MAAA,EAAQ;IACRC,KAAA,EAAO;EACT;EACAC,SAAA,EAAW;EACXC,qBAAA,EAAuB;EACvBC,8BAAA,EAAgC;EAChCC,eAAA,EAAiB;EACjBC,gBAAA,EAAkB;EAClBC,iBAAA,EAAmB;EACnBC,iBAAA,EAAmB;EACnBC,gBAAA,EAAkB;EAClBC,sBAAA,EAAwB;EACxBC,aAAA,EAAe;EACfC,cAAA,EAAgB;EAChBC,IAAA,EAAM;IACJC,IAAA,EAAM;IACNjF,IAAA,EAAM;IACNkF,MAAA,EAAQ;IACRC,aAAA,EAAe;IACfC,SAAA,EAAW;IACXC,WAAA,EAAa;IACbC,SAAA,EAAW;IACXC,sBAAA,EAAwB;EAC1B;EACAC,MAAA,EAAQ;AACV","ignoreList":[]}
1
+ {"version":3,"file":"EditorTheme.js","names":["LexicalEditorTheme","block","blockCursor","characterLimit","code","inlineBlock","heading","h1","h2","h3","h4","h5","h6","hr","hrSelected","indent","link","list","checklist","listitem","listitemChecked","listitemUnchecked","nested","olDepth","ul","ltr","mark","markOverlap","paragraph","placeholder","quote","relationship","rtl","tab","table","tableAddColumns","tableAddRows","tableAlignment","center","right","tableCell","tableCellActionButton","tableCellActionButtonContainer","tableCellHeader","tableCellResizer","tableCellSelected","tableFrozenColumn","tableRowStriping","tableScrollableWrapper","tableSelected","tableSelection","text","bold","italic","strikethrough","subscript","superscript","underline","underlineStrikethrough","upload"],"sources":["../../../src/lexical/theme/EditorTheme.tsx"],"sourcesContent":["import type { EditorThemeClasses } from 'lexical'\n\nexport const LexicalEditorTheme: EditorThemeClasses = {\n block: 'LexicalEditorTheme__block',\n blockCursor: 'LexicalEditorTheme__blockCursor',\n characterLimit: 'LexicalEditorTheme__characterLimit',\n code: 'LexicalEditorTheme__code',\n inlineBlock: 'LexicalEditorTheme__inlineBlock',\n\n heading: {\n h1: 'LexicalEditorTheme__h1',\n h2: 'LexicalEditorTheme__h2',\n h3: 'LexicalEditorTheme__h3',\n h4: 'LexicalEditorTheme__h4',\n h5: 'LexicalEditorTheme__h5',\n h6: 'LexicalEditorTheme__h6',\n },\n hr: 'LexicalEditorTheme__hr',\n hrSelected: 'LexicalEditorTheme__hrSelected',\n indent: 'LexicalEditorTheme__indent',\n link: 'LexicalEditorTheme__link',\n list: {\n checklist: 'LexicalEditorTheme__checklist',\n listitem: 'LexicalEditorTheme__listItem',\n listitemChecked: 'LexicalEditorTheme__listItemChecked',\n listitemUnchecked: 'LexicalEditorTheme__listItemUnchecked',\n nested: {\n listitem: 'LexicalEditorTheme__nestedListItem',\n },\n olDepth: [\n 'LexicalEditorTheme__ol1',\n 'LexicalEditorTheme__ol2',\n 'LexicalEditorTheme__ol3',\n 'LexicalEditorTheme__ol4',\n 'LexicalEditorTheme__ol5',\n ],\n ul: 'LexicalEditorTheme__ul',\n },\n ltr: 'LexicalEditorTheme__ltr',\n mark: 'LexicalEditorTheme__mark',\n markOverlap: 'LexicalEditorTheme__markOverlap',\n paragraph: 'LexicalEditorTheme__paragraph',\n placeholder: 'LexicalEditorTheme__placeholder',\n quote: 'LexicalEditorTheme__quote',\n relationship: 'LexicalEditorTheme__relationship',\n rtl: 'LexicalEditorTheme__rtl',\n tab: 'LexicalEditorTheme__tabNode',\n table: 'LexicalEditorTheme__table',\n tableAddColumns: 'LexicalEditorTheme__tableAddColumns',\n tableAddRows: 'LexicalEditorTheme__tableAddRows',\n tableAlignment: {\n center: 'LexicalEditorTheme__tableAlignmentCenter',\n right: 'LexicalEditorTheme__tableAlignmentRight',\n },\n tableCell: 'LexicalEditorTheme__tableCell',\n tableCellActionButton: 'LexicalEditorTheme__tableCellActionButton',\n tableCellActionButtonContainer: 'LexicalEditorTheme__tableCellActionButtonContainer',\n tableCellHeader: 'LexicalEditorTheme__tableCellHeader',\n tableCellResizer: 'LexicalEditorTheme__tableCellResizer',\n tableCellSelected: 'LexicalEditorTheme__tableCellSelected',\n tableFrozenColumn: 'LexicalEditorTheme__tableFrozenColumn',\n tableRowStriping: 'LexicalEditorTheme__tableRowStriping',\n tableScrollableWrapper: 'LexicalEditorTheme__tableScrollableWrapper',\n tableSelected: 'LexicalEditorTheme__tableSelected',\n tableSelection: 'LexicalEditorTheme__tableSelection',\n text: {\n bold: 'LexicalEditorTheme__textBold',\n code: 'LexicalEditorTheme__textCode',\n italic: 'LexicalEditorTheme__textItalic',\n strikethrough: 'LexicalEditorTheme__textStrikethrough',\n subscript: 'LexicalEditorTheme__textSubscript',\n superscript: 'LexicalEditorTheme__textSuperscript',\n underline: 'LexicalEditorTheme__textUnderline',\n underlineStrikethrough: 'LexicalEditorTheme__textUnderlineStrikethrough',\n },\n upload: 'LexicalEditorTheme__upload',\n}\n"],"mappings":"AAEA,OAAO,MAAMA,kBAAA,GAAyC;EACpDC,KAAA,EAAO;EACPC,WAAA,EAAa;EACbC,cAAA,EAAgB;EAChBC,IAAA,EAAM;EACNC,WAAA,EAAa;EAEbC,OAAA,EAAS;IACPC,EAAA,EAAI;IACJC,EAAA,EAAI;IACJC,EAAA,EAAI;IACJC,EAAA,EAAI;IACJC,EAAA,EAAI;IACJC,EAAA,EAAI;EACN;EACAC,EAAA,EAAI;EACJC,UAAA,EAAY;EACZC,MAAA,EAAQ;EACRC,IAAA,EAAM;EACNC,IAAA,EAAM;IACJC,SAAA,EAAW;IACXC,QAAA,EAAU;IACVC,eAAA,EAAiB;IACjBC,iBAAA,EAAmB;IACnBC,MAAA,EAAQ;MACNH,QAAA,EAAU;IACZ;IACAI,OAAA,EAAS,CACP,2BACA,2BACA,2BACA,2BACA,0BACD;IACDC,EAAA,EAAI;EACN;EACAC,GAAA,EAAK;EACLC,IAAA,EAAM;EACNC,WAAA,EAAa;EACbC,SAAA,EAAW;EACXC,WAAA,EAAa;EACbC,KAAA,EAAO;EACPC,YAAA,EAAc;EACdC,GAAA,EAAK;EACLC,GAAA,EAAK;EACLC,KAAA,EAAO;EACPC,eAAA,EAAiB;EACjBC,YAAA,EAAc;EACdC,cAAA,EAAgB;IACdC,MAAA,EAAQ;IACRC,KAAA,EAAO;EACT;EACAC,SAAA,EAAW;EACXC,qBAAA,EAAuB;EACvBC,8BAAA,EAAgC;EAChCC,eAAA,EAAiB;EACjBC,gBAAA,EAAkB;EAClBC,iBAAA,EAAmB;EACnBC,iBAAA,EAAmB;EACnBC,gBAAA,EAAkB;EAClBC,sBAAA,EAAwB;EACxBC,aAAA,EAAe;EACfC,cAAA,EAAgB;EAChBC,IAAA,EAAM;IACJC,IAAA,EAAM;IACNhD,IAAA,EAAM;IACNiD,MAAA,EAAQ;IACRC,aAAA,EAAe;IACfC,SAAA,EAAW;IACXC,WAAA,EAAa;IACbC,SAAA,EAAW;IACXC,sBAAA,EAAwB;EAC1B;EACAC,MAAA,EAAQ;AACV","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ContentEditable.d.ts","sourceRoot":"","sources":["../../../src/lexical/ui/ContentEditable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAMhC,OAAO,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAErE,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,YAAY,GACb,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,2BAA2B,CAAA;CAC1C,GAAG,GAAG,CAAC,OAAO,CAcd"}
1
+ {"version":3,"file":"ContentEditable.d.ts","sourceRoot":"","sources":["../../../src/lexical/ui/ContentEditable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAMhC,OAAO,wBAAwB,CAAA;AAI/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAErE,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,YAAY,GACb,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,2BAA2B,CAAA;CAC1C,GAAG,GAAG,CAAC,OAAO,CAgBd"}
@@ -2,11 +2,12 @@
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
5
6
  import { ContentEditable } from '@lexical/react/LexicalContentEditable.js';
6
7
  import { useTranslation } from '@payloadcms/ui';
7
8
  import * as React from 'react';
8
9
  export function LexicalContentEditable(t0) {
9
- const $ = _c(4);
10
+ const $ = _c(5);
10
11
  const {
11
12
  className,
12
13
  editorConfig
@@ -14,23 +15,29 @@ export function LexicalContentEditable(t0) {
14
15
  const {
15
16
  t
16
17
  } = useTranslation();
17
- let t1;
18
- if ($[0] !== className || $[1] !== editorConfig?.admin?.placeholder || $[2] !== t) {
19
- t1 = _jsx(ContentEditable, {
18
+ const [, t1] = useLexicalComposerContext();
19
+ const {
20
+ getTheme
21
+ } = t1;
22
+ let t2;
23
+ if ($[0] !== className || $[1] !== editorConfig?.admin?.placeholder || $[2] !== getTheme || $[3] !== t) {
24
+ const theme = getTheme();
25
+ t2 = _jsx(ContentEditable, {
20
26
  "aria-placeholder": t("lexical:general:placeholder"),
21
27
  className: className ?? "ContentEditable__root",
22
28
  placeholder: _jsx("p", {
23
- className: "editor-placeholder",
29
+ className: theme?.placeholder,
24
30
  children: editorConfig?.admin?.placeholder ?? t("lexical:general:placeholder")
25
31
  })
26
32
  });
27
33
  $[0] = className;
28
34
  $[1] = editorConfig?.admin?.placeholder;
29
- $[2] = t;
30
- $[3] = t1;
35
+ $[2] = getTheme;
36
+ $[3] = t;
37
+ $[4] = t2;
31
38
  } else {
32
- t1 = $[3];
39
+ t2 = $[4];
33
40
  }
34
- return t1;
41
+ return t2;
35
42
  }
36
43
  //# sourceMappingURL=ContentEditable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContentEditable.js","names":["c","_c","ContentEditable","useTranslation","React","LexicalContentEditable","t0","$","className","editorConfig","t","t1","admin","placeholder","_jsx","children"],"sources":["../../../src/lexical/ui/ContentEditable.tsx"],"sourcesContent":["'use client'\nimport type { JSX } from 'react'\n\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport { useTranslation } from '@payloadcms/ui'\nimport * as React from 'react'\n\nimport './ContentEditable.scss'\nimport type { SanitizedClientEditorConfig } from '../config/types.js'\n\nexport function LexicalContentEditable({\n className,\n editorConfig,\n}: {\n className?: string\n editorConfig: SanitizedClientEditorConfig\n}): JSX.Element {\n const { t } = useTranslation<{}, string>()\n\n return (\n <ContentEditable\n aria-placeholder={t('lexical:general:placeholder')}\n className={className ?? 'ContentEditable__root'}\n placeholder={\n <p className=\"editor-placeholder\">\n {editorConfig?.admin?.placeholder ?? t('lexical:general:placeholder')}\n </p>\n }\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,YAAYC,KAAA,MAAW;AAKvB,OAAO,SAAAC,uBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAAgC;IAAAO,SAAA;IAAAC;EAAA,IAAAH,EAMtC;EACC;IAAAI;EAAA,IAAcP,cAAA;EAAA,IAAAQ,EAAA;EAAA,IAAAJ,CAAA,QAAAC,SAAA,IAAAD,CAAA,QAAAE,YAAA,EAAAG,KAAA,EAAAC,WAAA,IAAAN,CAAA,QAAAG,CAAA;IAGZC,EAAA,GAAAG,IAAA,CAAAZ,eAAA;MAAA,oBACoBQ,CAAA,CAAE;MAAAF,SAAA,EACTA,SAAA,IAAa;MAAAK,WAAA,EAEtBC,IAAA,CAAC;QAAAN,SAAA,EAAY;QAAAO,QAAA,EACVN,YAAA,EAAAG,KAAA,EAAAC,WAAA,IAAoCH,CAAA,CAAE;MAAA,C;;;;;;;;;SAL7CC,E","ignoreList":[]}
1
+ {"version":3,"file":"ContentEditable.js","names":["c","_c","useLexicalComposerContext","ContentEditable","useTranslation","React","LexicalContentEditable","t0","$","className","editorConfig","t","t1","getTheme","t2","admin","placeholder","theme","_jsx","children"],"sources":["../../../src/lexical/ui/ContentEditable.tsx"],"sourcesContent":["'use client'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport { useTranslation } from '@payloadcms/ui'\n\nimport './ContentEditable.scss'\n\nimport * as React from 'react'\n\nimport type { SanitizedClientEditorConfig } from '../config/types.js'\n\nexport function LexicalContentEditable({\n className,\n editorConfig,\n}: {\n className?: string\n editorConfig: SanitizedClientEditorConfig\n}): JSX.Element {\n const { t } = useTranslation<{}, string>()\n const [_, { getTheme }] = useLexicalComposerContext()\n const theme = getTheme()\n\n return (\n <ContentEditable\n aria-placeholder={t('lexical:general:placeholder')}\n className={className ?? 'ContentEditable__root'}\n placeholder={\n <p className={theme?.placeholder}>\n {editorConfig?.admin?.placeholder ?? t('lexical:general:placeholder')}\n </p>\n }\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAI/B,YAAYC,KAAA,MAAW;AAIvB,OAAO,SAAAC,uBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAP,EAAA;EAAgC;IAAAQ,SAAA;IAAAC;EAAA,IAAAH,EAMtC;EACC;IAAAI;EAAA,IAAcP,cAAA;EACd,SAAAQ,EAAA,IAA0BV,yBAAA;EAAhB;IAAAW;EAAA,IAAAD,EAAY;EAAA,IAAAE,EAAA;EAAA,IAAAN,CAAA,QAAAC,SAAA,IAAAD,CAAA,QAAAE,YAAA,EAAAK,KAAA,EAAAC,WAAA,IAAAR,CAAA,QAAAK,QAAA,IAAAL,CAAA,QAAAG,CAAA;IACtB,MAAAM,KAAA,GAAcJ,QAAA;IAGZC,EAAA,GAAAI,IAAA,CAAAf,eAAA;MAAA,oBACoBQ,CAAA,CAAE;MAAAF,SAAA,EACTA,SAAA,IAAa;MAAAO,WAAA,EAEtBE,IAAA,CAAC;QAAAT,SAAA,EAAaQ,KAAA,EAAAD,WAAA;QAAAG,QAAA,EACXT,YAAA,EAAAK,KAAA,EAAAC,WAAA,IAAoCL,CAAA,CAAE;MAAA,C;;;;;;;;;;SAL7CG,E","ignoreList":[]}