@payloadcms/richtext-lexical 4.0.0-internal.5f0cd13 → 4.0.0-internal.811e0a4

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 (384) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js +5 -5
  4. package/dist/cell/rscEntry.js.map +1 -1
  5. package/dist/exports/client/Field-XH5C4HFU.js +2 -0
  6. package/dist/exports/client/Field-XH5C4HFU.js.map +7 -0
  7. package/dist/exports/client/bundled.css +1 -1
  8. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  9. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  10. package/dist/exports/client/chunk-ESITTE3C.js +2 -0
  11. package/dist/exports/client/chunk-ESITTE3C.js.map +7 -0
  12. package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
  13. package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
  14. package/dist/exports/client/chunk-X3D4LZS7.js +2 -0
  15. package/dist/exports/client/chunk-X3D4LZS7.js.map +7 -0
  16. package/dist/exports/client/{component-HKTAZ77E.js → component-PHZQBOJE.js} +2 -2
  17. package/dist/exports/client/componentInline-H24N7GUG.js +2 -0
  18. package/dist/exports/client/index.d.ts +0 -1
  19. package/dist/exports/client/index.d.ts.map +1 -1
  20. package/dist/exports/client/index.js +20 -21
  21. package/dist/exports/client/index.js.map +4 -4
  22. package/dist/features/blockquote/client/index.js +2 -2
  23. package/dist/features/blockquote/client/index.js.map +1 -1
  24. package/dist/features/blockquote/server/index.js +2 -2
  25. package/dist/features/blockquote/server/index.js.map +1 -1
  26. package/dist/features/blocks/client/component/index.css +2 -2
  27. package/dist/features/blocks/client/component/index.d.ts +1 -0
  28. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  29. package/dist/features/blocks/client/component/index.js +16 -8
  30. package/dist/features/blocks/client/component/index.js.map +1 -1
  31. package/dist/features/blocks/client/componentInline/index.css +8 -8
  32. package/dist/features/blocks/client/componentInline/index.d.ts +1 -0
  33. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  34. package/dist/features/blocks/client/componentInline/index.js +15 -7
  35. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  36. package/dist/features/blocks/client/index.d.ts.map +1 -1
  37. package/dist/features/blocks/client/index.js +4 -2
  38. package/dist/features/blocks/client/index.js.map +1 -1
  39. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  40. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  41. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  42. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  43. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  44. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  45. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  46. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  47. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  48. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  49. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  50. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  51. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  52. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  53. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  54. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  55. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  56. package/dist/features/blocks/server/index.d.ts.map +1 -1
  57. package/dist/features/blocks/server/index.js +6 -8
  58. package/dist/features/blocks/server/index.js.map +1 -1
  59. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  60. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  61. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  62. package/dist/features/blocks/server/schema.d.ts +5 -5
  63. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  64. package/dist/features/blocks/server/schema.js +28 -24
  65. package/dist/features/blocks/server/schema.js.map +1 -1
  66. package/dist/features/converters/lexicalToHtml/async/types.d.ts +13 -15
  67. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  68. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  69. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +13 -15
  70. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  71. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  72. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -2
  73. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  74. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  75. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  76. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  77. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  78. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  79. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  80. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  81. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  82. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  83. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  84. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  85. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  86. package/dist/features/converters/markdownToLexical/index.js +5 -2
  87. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  88. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  89. package/dist/features/experimental_table/client/index.js +2 -2
  90. package/dist/features/experimental_table/client/index.js.map +1 -1
  91. package/dist/features/experimental_table/markdownTransformer.d.ts +2 -2
  92. package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -1
  93. package/dist/features/experimental_table/markdownTransformer.js +6 -3
  94. package/dist/features/experimental_table/markdownTransformer.js.map +1 -1
  95. package/dist/features/experimental_table/server/index.js +2 -2
  96. package/dist/features/experimental_table/server/index.js.map +1 -1
  97. package/dist/features/experimental_table/server/schema.d.ts.map +1 -1
  98. package/dist/features/experimental_table/server/schema.js +6 -3
  99. package/dist/features/experimental_table/server/schema.js.map +1 -1
  100. package/dist/features/format/bold/feature.client.js +1 -1
  101. package/dist/features/format/bold/feature.client.js.map +1 -1
  102. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  103. package/dist/features/format/bold/feature.server.js +1 -1
  104. package/dist/features/format/bold/feature.server.js.map +1 -1
  105. package/dist/features/format/inlineCode/feature.client.js +1 -1
  106. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  107. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  108. package/dist/features/format/inlineCode/feature.server.js +1 -1
  109. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  110. package/dist/features/format/italic/feature.client.js +1 -1
  111. package/dist/features/format/italic/feature.client.js.map +1 -1
  112. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  113. package/dist/features/format/italic/feature.server.js +1 -1
  114. package/dist/features/format/italic/feature.server.js.map +1 -1
  115. package/dist/features/format/strikethrough/feature.client.js +1 -1
  116. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  117. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  118. package/dist/features/format/strikethrough/feature.server.js +1 -1
  119. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  120. package/dist/features/heading/client/index.js +2 -2
  121. package/dist/features/heading/client/index.js.map +1 -1
  122. package/dist/features/heading/markdownTransformer.d.ts +2 -2
  123. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  124. package/dist/features/heading/markdownTransformer.js +6 -19
  125. package/dist/features/heading/markdownTransformer.js.map +1 -1
  126. package/dist/features/heading/server/index.js +2 -2
  127. package/dist/features/heading/server/index.js.map +1 -1
  128. package/dist/features/horizontalRule/client/index.js +2 -2
  129. package/dist/features/horizontalRule/client/index.js.map +1 -1
  130. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +2 -2
  131. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  132. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  133. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  134. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  135. package/dist/features/horizontalRule/server/index.js +2 -2
  136. package/dist/features/horizontalRule/server/index.js.map +1 -1
  137. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +2 -2
  138. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  139. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  140. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  141. package/dist/features/link/client/index.js +2 -2
  142. package/dist/features/link/client/index.js.map +1 -1
  143. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -3
  144. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  145. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -11
  146. package/dist/features/link/markdownTransformer.d.ts +4 -4
  147. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  148. package/dist/features/link/markdownTransformer.js +2 -2
  149. package/dist/features/link/markdownTransformer.js.map +1 -1
  150. package/dist/features/link/markdownTransformer.spec.js +10 -10
  151. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  152. package/dist/features/link/server/baseFields.js.map +1 -1
  153. package/dist/features/link/server/index.js +2 -2
  154. package/dist/features/link/server/index.js.map +1 -1
  155. package/dist/features/link/server/schema.d.ts.map +1 -1
  156. package/dist/features/link/server/schema.js +14 -9
  157. package/dist/features/link/server/schema.js.map +1 -1
  158. package/dist/features/lists/checklist/client/index.js +1 -1
  159. package/dist/features/lists/checklist/client/index.js.map +1 -1
  160. package/dist/features/lists/checklist/server/index.js +1 -1
  161. package/dist/features/lists/checklist/server/index.js.map +1 -1
  162. package/dist/features/lists/orderedList/client/index.js +1 -1
  163. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  164. package/dist/features/lists/orderedList/server/index.js +1 -1
  165. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  166. package/dist/features/lists/unorderedList/client/index.js +1 -1
  167. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  168. package/dist/features/lists/unorderedList/server/index.js +1 -1
  169. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  170. package/dist/features/relationship/server/schema.d.ts +3 -3
  171. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  172. package/dist/features/relationship/server/schema.js +27 -13
  173. package/dist/features/relationship/server/schema.js.map +1 -1
  174. package/dist/features/textState/feature.client.js +1 -1
  175. package/dist/features/textState/feature.client.js.map +1 -1
  176. package/dist/features/toolbars/fixed/client/Toolbar/index.css +2 -2
  177. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -13
  178. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +8 -12
  179. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  180. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  181. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  182. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  183. package/dist/features/typesClient.d.ts +1 -1
  184. package/dist/features/typesClient.d.ts.map +1 -1
  185. package/dist/features/typesClient.js.map +1 -1
  186. package/dist/features/typesServer.d.ts +2 -2
  187. package/dist/features/typesServer.d.ts.map +1 -1
  188. package/dist/features/typesServer.js.map +1 -1
  189. package/dist/features/upload/client/component/index.css +11 -11
  190. package/dist/features/upload/client/plugin/index.js +5 -5
  191. package/dist/features/upload/client/plugin/index.js.map +1 -1
  192. package/dist/features/upload/server/index.js +2 -2
  193. package/dist/features/upload/server/index.js.map +1 -1
  194. package/dist/features/upload/server/markdownTransformer.d.ts +2 -2
  195. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  196. package/dist/features/upload/server/markdownTransformer.js +1 -1
  197. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  198. package/dist/features/upload/server/schema.d.ts +8 -8
  199. package/dist/features/upload/server/schema.d.ts.map +1 -1
  200. package/dist/features/upload/server/schema.js +59 -23
  201. package/dist/features/upload/server/schema.js.map +1 -1
  202. package/dist/field/Diff/converters/unknown/index.css +1 -1
  203. package/dist/field/Field.js +1 -1
  204. package/dist/field/Field.js.map +1 -1
  205. package/dist/field/ViewSelector.css +1 -1
  206. package/dist/field/bundled.css +1 -1
  207. package/dist/field/index.css +5 -5
  208. package/dist/field/index.js +1 -1
  209. package/dist/field/index.js.map +1 -1
  210. package/dist/field/rscEntry.d.ts.map +1 -1
  211. package/dist/field/rscEntry.js +2 -0
  212. package/dist/field/rscEntry.js.map +1 -1
  213. package/dist/index.d.ts +2 -2
  214. package/dist/index.d.ts.map +1 -1
  215. package/dist/index.js +3 -3
  216. package/dist/index.js.map +1 -1
  217. package/dist/lexical/LexicalEditor.css +2 -2
  218. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  219. package/dist/lexical/config/client/loader.js +5 -1
  220. package/dist/lexical/config/client/loader.js.map +1 -1
  221. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  222. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  223. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  224. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  225. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  226. package/dist/lexical/plugins/SlashMenu/index.css +1 -5
  227. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -1
  228. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +3 -3
  229. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -1
  230. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  231. package/dist/lexical/theme/EditorTheme.css +18 -19
  232. package/dist/lexical/ui/ContentEditable.css +5 -5
  233. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  234. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  235. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  236. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  237. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +88 -0
  238. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +1 -0
  239. package/dist/lexical/utils/markdown/createBlockNode.d.ts +1 -1
  240. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  241. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  242. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +25 -0
  243. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  244. package/dist/lexical/utils/markdown/normalizeMarkdown.js +91 -0
  245. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  246. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -1
  247. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  248. package/dist/lexical-proxy/@lexical-markdown.js +1 -1
  249. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  250. package/dist/types/builtInNodes.d.ts.map +1 -1
  251. package/dist/types/builtInNodes.js +17 -17
  252. package/dist/types/builtInNodes.js.map +1 -1
  253. package/dist/types/index.d.ts +16 -16
  254. package/dist/types/index.d.ts.map +1 -1
  255. package/dist/types/index.js.map +1 -1
  256. package/dist/types/jsonSchemaHelpers.d.ts +2 -0
  257. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  258. package/dist/types/jsonSchemaHelpers.js +7 -3
  259. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  260. package/dist/types/nodeTypes.d.ts +51 -9
  261. package/dist/types/nodeTypes.d.ts.map +1 -1
  262. package/dist/types/nodeTypes.js +3 -3
  263. package/dist/types/nodeTypes.js.map +1 -1
  264. package/dist/types/schema.d.ts.map +1 -1
  265. package/dist/types/schema.js +24 -7
  266. package/dist/types/schema.js.map +1 -1
  267. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  268. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  269. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  270. package/dist/utilities/buildEditorState.d.ts +17 -3
  271. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  272. package/dist/utilities/buildEditorState.js +8 -0
  273. package/dist/utilities/buildEditorState.js.map +1 -1
  274. package/dist/utilities/buildInitialState.d.ts +2 -1
  275. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  276. package/dist/utilities/buildInitialState.js.map +1 -1
  277. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  278. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  279. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  280. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  281. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  282. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  283. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  284. package/dist/utilities/fieldsDrawer/index.css +12 -0
  285. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  286. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  287. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  288. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  289. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  290. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  291. package/package.json +22 -26
  292. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  293. package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
  294. package/dist/exports/client/chunk-6QWQ7JV4.js +0 -2
  295. package/dist/exports/client/chunk-6QWQ7JV4.js.map +0 -7
  296. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  297. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  298. package/dist/exports/client/chunk-LH634DPU.js +0 -12
  299. package/dist/exports/client/chunk-LH634DPU.js.map +0 -7
  300. package/dist/exports/client/chunk-UAKNDD6R.js +0 -2
  301. package/dist/exports/client/chunk-UAKNDD6R.js.map +0 -7
  302. package/dist/exports/client/componentInline-D3A6OW76.js +0 -2
  303. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  304. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  305. package/dist/features/blockquote/markdownTransformer.js +0 -33
  306. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  307. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  308. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  309. package/dist/features/format/bold/markdownTransformers.js +0 -23
  310. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  311. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  312. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  313. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  314. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  315. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  316. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  317. package/dist/features/format/italic/markdownTransformers.js +0 -12
  318. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  319. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  320. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  321. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  322. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  323. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  324. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  325. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  326. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  327. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  328. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  329. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  330. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  331. package/dist/features/lists/shared/markdown.d.ts +0 -6
  332. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  333. package/dist/features/lists/shared/markdown.js +0 -57
  334. package/dist/features/lists/shared/markdown.js.map +0 -1
  335. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  336. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  337. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  338. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  339. package/dist/lexical/utils/guard.d.ts +0 -5
  340. package/dist/lexical/utils/guard.d.ts.map +0 -1
  341. package/dist/lexical/utils/guard.js +0 -9
  342. package/dist/lexical/utils/guard.js.map +0 -1
  343. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  344. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  345. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  346. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  347. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  348. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  349. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -213
  350. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  351. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  352. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  353. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -198
  354. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  355. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  356. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  357. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  358. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  359. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -147
  360. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  361. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -268
  362. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  363. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  364. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  365. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  366. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  367. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  368. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  369. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  370. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  371. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  372. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  373. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  374. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  375. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  376. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  377. package/dist/packages/@lexical/markdown/index.js +0 -39
  378. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  379. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  380. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  381. package/dist/packages/@lexical/markdown/utils.js +0 -267
  382. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
  383. /package/dist/exports/client/{component-HKTAZ77E.js.map → component-PHZQBOJE.js.map} +0 -0
  384. /package/dist/exports/client/{componentInline-D3A6OW76.js.map → componentInline-H24N7GUG.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","names":["BulkUploadProvider","FieldDescription","FieldError","FieldLabel","isFieldRTL","RenderCustomComponent","useConfig","useEditDepth","useEffectEvent","useField","useLocale","mergeFieldStyles","dequal","React","useCallback","useEffect","useMemo","useState","ErrorBoundary","LexicalProvider","useRunDeprioritized","useRichTextView","ViewSelector","baseClass","RichTextComponent","props","editorConfig","field","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","schemaPath","validate","readOnlyFromProps","locale","config","localization","localizationConfig","rtl","fieldLocalized","undefined","editDepth","isControlledByParent","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Error1","Label","disabled","disabledFromField","initialValue","setValue","showError","potentiallyStalePath","isSmallWidthViewport","setIsSmallWidthViewport","rerenderProviderKey","setRerenderProviderKey","prevInitialValueRef","useRef","prevValueRef","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","runDeprioritized","handleChange","editorState","updateFieldValue","newState","toJSON","current","styles","handleInitialValueChange","JSON","parse","stringify","Date","Object","is","_jsxs","view","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","drawerSlugPrefix","composerKey","fieldProps","onChange","error","role","color","message","String","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\nimport type { FallbackProps } from 'react-error-boundary'\n\nimport {\n BulkUploadProvider,\n FieldDescription,\n FieldError,\n FieldLabel,\n isFieldRTL,\n RenderCustomComponent,\n useConfig,\n useEditDepth,\n useEffectEvent,\n useField,\n useLocale,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport { dequal } from 'dequal/lite'\nimport { type Validate } from 'payload'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\n\nimport '../lexical/theme/EditorTheme.css'\nimport './bundled.css'\nimport './index.css'\n\nimport type { LexicalRichTextFieldProps } from '../types/index.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport { useRunDeprioritized } from '../utilities/useRunDeprioritized.js'\nimport { useRichTextView } from './RichTextViewProvider.js'\nimport { ViewSelector } from './ViewSelector.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n schemaPath,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const locale = useLocale()\n const {\n config: { localization: localizationConfig },\n } = useConfig()\n\n const rtl = isFieldRTL({\n fieldLocalized: localized,\n locale,\n localizationConfig: localizationConfig || undefined,\n })\n\n const editDepth = useEditDepth()\n const { isControlledByParent } = useRichTextView()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled: disabledFromField,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || disabledFromField\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n const [rerenderProviderKey, setRerenderProviderKey] = useState<Date>()\n\n const prevInitialValueRef = React.useRef<SerializedEditorState | undefined>(initialValue)\n const prevValueRef = React.useRef<SerializedEditorState | undefined>(value)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const classes = [\n 'field-type',\n baseClass,\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport\n ? `${baseClass}--show-gutter`\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const runDeprioritized = useRunDeprioritized() // defaults to 500 ms timeout\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n // Capture `editorState` in the closure so we can safely run later.\n const updateFieldValue = () => {\n const newState = editorState.toJSON()\n prevValueRef.current = newState\n setValue(newState)\n }\n\n // Queue the update for the browser’s idle time (or Safari shim)\n // and let the hook handle debouncing/cancellation.\n void runDeprioritized(updateFieldValue)\n },\n [setValue, runDeprioritized], // `runDeprioritized` is stable (useCallback inside hook)\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const handleInitialValueChange = useEffectEvent(\n (initialValue: SerializedEditorState | undefined) => {\n // Object deep equality check here, as re-mounting the editor if\n // the new value is the same as the old one is not necessary.\n // In postgres, the order of keys in JSON objects is not guaranteed to be preserved,\n // so we need to do a deep equality check here that does not care about key order => we use dequal.\n // If we used JSON.stringify, the editor would re-mount every time you save the document, as the order of keys changes => change detected => re-mount.\n if (\n prevValueRef.current !== value &&\n !dequal(\n prevValueRef.current != null\n ? JSON.parse(JSON.stringify(prevValueRef.current))\n : prevValueRef.current,\n value,\n )\n ) {\n prevInitialValueRef.current = initialValue\n prevValueRef.current = value\n setRerenderProviderKey(new Date())\n }\n },\n )\n\n useEffect(() => {\n // Needs to trigger for object reference changes - otherwise,\n // reacting to the same initial value change twice will cause\n // the second change to be ignored, even though the value has changed.\n // That's because initialValue is not kept up-to-date\n if (!Object.is(initialValue, prevInitialValueRef.current)) {\n handleInitialValueChange(initialValue)\n }\n }, [initialValue])\n\n return (\n <div\n className={classes}\n data-field-path={path}\n data-field-schemapath={schemaPath}\n data-lexical-view={editorConfig?.view}\n key={pathWithEditDepth}\n style={styles}\n >\n <div className={`${baseClass}__label-row`}>\n {Label || (\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n )}\n {!isControlledByParent && <ViewSelector />}\n </div>\n <div className={`${baseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n {/* Lexical may be in a drawer. We need to define another BulkUploadProvider to ensure that the bulk upload drawer\n is rendered in the correct depth (not displayed *behind* the current drawer).\n The `lexical-` prefix prevents drawer-slug collisions with non-lexical `BulkUploadProvider`s up the tree. */}\n <BulkUploadProvider drawerSlugPrefix={`lexical-${path}`}>\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n isSmallWidthViewport={isSmallWidthViewport}\n key={JSON.stringify({ path, rerenderProviderKey })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n rtl={rtl}\n value={value}\n />\n </BulkUploadProvider>\n {AfterInput}\n </ErrorBoundary>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: FallbackProps) {\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error instanceof Error ? error.message : String(error)}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n"],"mappings":"AAAA;;;AAIA,SACEA,kBAAkB,EAClBC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,UAAU,EACVC,qBAAqB,EACrBC,SAAS,EACTC,YAAY,EACZC,cAAc,EACdC,QAAQ,EACRC,SAAS,QACJ;AACP,SAASC,gBAAgB,QAAQ;AACjC,SAASC,MAAM,QAAQ;AAEvB,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AACjE,SAASC,aAAa,QAAQ;AAI9B,OAAO;AACP,OAAO;AACP,OAAO;AAIP,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAE7B,MAAMC,SAAA,GAAY;AAElB,MAAMC,iBAAA,GAIDC,KAAA;EACH,MAAM;IACJC,YAAY;IACZC,KAAK;IACLA,KAAA,EAAO;MACLC,KAAA,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AGrF;AAEA,OAAO,MAAMK,QAAA,GAAqC/F,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"Field.js","names":["BulkUploadProvider","FieldDescription","FieldError","FieldLabel","isFieldRTL","RenderCustomComponent","useConfig","useEditDepth","useEffectEvent","useField","useLocale","mergeFieldStyles","dequal","React","useCallback","useEffect","useMemo","useState","ErrorBoundary","LexicalProvider","useRunDeprioritized","useRichTextView","ViewSelector","baseClass","RichTextComponent","props","editorConfig","field","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","schemaPath","validate","readOnlyFromProps","locale","config","localization","localizationConfig","rtl","fieldLocalized","undefined","editDepth","isControlledByParent","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Error1","Label","disabled","disabledFromField","initialValue","setValue","showError","potentiallyStalePath","isSmallWidthViewport","setIsSmallWidthViewport","rerenderProviderKey","setRerenderProviderKey","prevInitialValueRef","useRef","prevValueRef","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","runDeprioritized","handleChange","editorState","updateFieldValue","newState","toJSON","current","styles","handleInitialValueChange","JSON","parse","stringify","Date","Object","is","_jsxs","view","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","modalSlugPrefix","composerKey","fieldProps","onChange","error","role","color","message","String","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\nimport type { FallbackProps } from 'react-error-boundary'\n\nimport {\n BulkUploadProvider,\n FieldDescription,\n FieldError,\n FieldLabel,\n isFieldRTL,\n RenderCustomComponent,\n useConfig,\n useEditDepth,\n useEffectEvent,\n useField,\n useLocale,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport { dequal } from 'dequal/lite'\nimport { type Validate } from 'payload'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\n\nimport '../lexical/theme/EditorTheme.css'\nimport './bundled.css'\nimport './index.css'\n\nimport type { LexicalRichTextFieldProps } from '../types/index.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport { useRunDeprioritized } from '../utilities/useRunDeprioritized.js'\nimport { useRichTextView } from './RichTextViewProvider.js'\nimport { ViewSelector } from './ViewSelector.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n schemaPath,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const locale = useLocale()\n const {\n config: { localization: localizationConfig },\n } = useConfig()\n\n const rtl = isFieldRTL({\n fieldLocalized: localized,\n locale,\n localizationConfig: localizationConfig || undefined,\n })\n\n const editDepth = useEditDepth()\n const { isControlledByParent } = useRichTextView()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled: disabledFromField,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || disabledFromField\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n const [rerenderProviderKey, setRerenderProviderKey] = useState<Date>()\n\n const prevInitialValueRef = React.useRef<SerializedEditorState | undefined>(initialValue)\n const prevValueRef = React.useRef<SerializedEditorState | undefined>(value)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const classes = [\n 'field-type',\n baseClass,\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport\n ? `${baseClass}--show-gutter`\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const runDeprioritized = useRunDeprioritized() // defaults to 500 ms timeout\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n // Capture `editorState` in the closure so we can safely run later.\n const updateFieldValue = () => {\n const newState = editorState.toJSON()\n prevValueRef.current = newState\n setValue(newState)\n }\n\n // Queue the update for the browser’s idle time (or Safari shim)\n // and let the hook handle debouncing/cancellation.\n void runDeprioritized(updateFieldValue)\n },\n [setValue, runDeprioritized], // `runDeprioritized` is stable (useCallback inside hook)\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const handleInitialValueChange = useEffectEvent(\n (initialValue: SerializedEditorState | undefined) => {\n // Object deep equality check here, as re-mounting the editor if\n // the new value is the same as the old one is not necessary.\n // In postgres, the order of keys in JSON objects is not guaranteed to be preserved,\n // so we need to do a deep equality check here that does not care about key order => we use dequal.\n // If we used JSON.stringify, the editor would re-mount every time you save the document, as the order of keys changes => change detected => re-mount.\n if (\n prevValueRef.current !== value &&\n !dequal(\n prevValueRef.current != null\n ? JSON.parse(JSON.stringify(prevValueRef.current))\n : prevValueRef.current,\n value,\n )\n ) {\n prevInitialValueRef.current = initialValue\n prevValueRef.current = value\n setRerenderProviderKey(new Date())\n }\n },\n )\n\n useEffect(() => {\n // Needs to trigger for object reference changes - otherwise,\n // reacting to the same initial value change twice will cause\n // the second change to be ignored, even though the value has changed.\n // That's because initialValue is not kept up-to-date\n if (!Object.is(initialValue, prevInitialValueRef.current)) {\n handleInitialValueChange(initialValue)\n }\n }, [initialValue])\n\n return (\n <div\n className={classes}\n data-field-path={path}\n data-field-schemapath={schemaPath}\n data-lexical-view={editorConfig?.view}\n key={pathWithEditDepth}\n style={styles}\n >\n <div className={`${baseClass}__label-row`}>\n {Label || (\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n )}\n {!isControlledByParent && <ViewSelector />}\n </div>\n <div className={`${baseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n {/* Lexical may be in a drawer. We need to define another BulkUploadProvider to ensure that the bulk upload drawer\n is rendered in the correct depth (not displayed *behind* the current drawer).\n The `lexical-` prefix prevents drawer-slug collisions with non-lexical `BulkUploadProvider`s up the tree. */}\n <BulkUploadProvider modalSlugPrefix={`lexical-${path}`}>\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n isSmallWidthViewport={isSmallWidthViewport}\n key={JSON.stringify({ path, rerenderProviderKey })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n rtl={rtl}\n value={value}\n />\n </BulkUploadProvider>\n {AfterInput}\n </ErrorBoundary>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: FallbackProps) {\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error instanceof Error ? error.message : String(error)}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n"],"mappings":"AAAA;;;AAIA,SACEA,kBAAkB,EAClBC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,UAAU,EACVC,qBAAqB,EACrBC,SAAS,EACTC,YAAY,EACZC,cAAc,EACdC,QAAQ,EACRC,SAAS,QACJ;AACP,SAASC,gBAAgB,QAAQ;AACjC,SAASC,MAAM,QAAQ;AAEvB,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AACjE,SAASC,aAAa,QAAQ;AAI9B,OAAO;AACP,OAAO;AACP,OAAO;AAIP,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAE7B,MAAMC,SAAA,GAAY;AAElB,MAAMC,iBAAA,GAIDC,KAAA;EACH,MAAM;IACJC,YAAY;IACZC,KAAK;IACLA,KAAA,EAAO;MACLC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC,QAAA,EAAUC;MAAiB,CAAE,GAAG,CAAC,CAAC;MACnEC,KAAK;MACLC,SAAS;MACTC;IAAQ,CACT;IACDC,IAAA,EAAMC,aAAa;IACnBN,QAAA,EAAUO,yBAAyB;IACnCC,UAAU;IACVC;EAAQ,CACT,GAAGf,KAAA;EAEJ,MAAMgB,iBAAA,GAAoBH,yBAAA,IAA6BN,iBAAA;EAEvD,MAAMU,MAAA,GAAShC,SAAA;EACf,MAAM;IACJiC,MAAA,EAAQ;MAAEC,YAAA,EAAcC;IAAkB;EAAE,CAC7C,GAAGvC,SAAA;EAEJ,MAAM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B,WAAW1E,IAAA,EAAM;oBACpD,aAAAqE,IAAA,CAACtF,eAAA;YACC4F,WAAA,EAAazB,iBAAA;YACb5D,YAAA,EAAcA,YAAA;YACdsF,UAAA,EAAYvF,KAAA;YACZ0C,oBAAA,EAAsBA,oBAAA;YAEtB8C,QAAA,EAAUzB,YAAA;YACVzD,QAAA,EAAU8B,QAAA;YACVf,GAAA,EAAKA,GAAA;YACLM,KAAA,EAAOA;aAJF4C,IAAA,CAAKE,SAAS,CAAC;YAAE9D,IAAA;YAAMiC;UAAoB;YAOnDd,UAAA;uBAEHkD,IAAA,CAACpG,qBAAA;QACCqG,eAAA,EAAiBjD,WAAA;QACjBkD,QAAA,eAAUF,IAAA,CAACxG,gBAAA;UAAiB6B,WAAA,EAAaA,WAAA;UAAaM,IAAA,EAAMA;;;;KApC3DkD,iBAAA;AAyCX;AAEA,SAASsB,eAAe;EAAEM;AAAK,CAAiB;EAC9C,oBACEZ,KAAA,CAAC;IAAIzE,SAAA,EAAU;IAAgBsF,IAAA,EAAK;4BAClCV,IAAA,CAAC;gBAAE;qBACHA,IAAA,CAAC;MAAID,KAAA,EAAO;QAAEY,KAAA,EAAO;MAAM;gBAAIF,KAAA,YAAiBxD,KAAA,GAAQwD,KAAA,CAAMG,OAAO,GAAGC,MAAA,CAAOJ,KAAA;;;AAGrF;AAEA,OAAO,MAAMK,QAAA,GAAqC/F,iBAAA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  .lexical-view-selector {
2
2
  display: inline-flex;
3
- margin-left: var(--spacing-xs);
3
+ margin-inline-start: var(--spacing-xs);
4
4
  vertical-align: middle;
5
5
  }
6
6