@payloadcms/richtext-lexical 3.0.0-beta.23 → 3.0.0-beta.25

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 (342) hide show
  1. package/dist/exports/components.d.ts +3 -2
  2. package/dist/exports/components.d.ts.map +1 -1
  3. package/dist/exports/components.js +3 -2
  4. package/dist/exports/components.js.map +1 -1
  5. package/dist/field/features/align/feature.client.d.ts.map +1 -1
  6. package/dist/field/features/align/feature.client.js +127 -53
  7. package/dist/field/features/align/feature.client.js.map +1 -1
  8. package/dist/field/features/align/toolbarAlignGroup.d.ts +3 -0
  9. package/dist/field/features/align/toolbarAlignGroup.d.ts.map +1 -0
  10. package/dist/field/features/align/toolbarAlignGroup.js +12 -0
  11. package/dist/field/features/align/toolbarAlignGroup.js.map +1 -0
  12. package/dist/field/features/blockquote/feature.client.d.ts.map +1 -1
  13. package/dist/field/features/blockquote/feature.client.js +50 -34
  14. package/dist/field/features/blockquote/feature.client.js.map +1 -1
  15. package/dist/field/features/blocks/component/index.d.ts.map +1 -1
  16. package/dist/field/features/blocks/component/index.js +1 -1
  17. package/dist/field/features/blocks/component/index.js.map +1 -1
  18. package/dist/field/features/blocks/feature.client.d.ts.map +1 -1
  19. package/dist/field/features/blocks/feature.client.js +56 -27
  20. package/dist/field/features/blocks/feature.client.js.map +1 -1
  21. package/dist/field/features/blocks/populationPromise.d.ts.map +1 -1
  22. package/dist/field/features/blocks/populationPromise.js +2 -1
  23. package/dist/field/features/blocks/populationPromise.js.map +1 -1
  24. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.d.ts.map +1 -1
  25. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.js.map +1 -1
  26. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.d.ts.map +1 -1
  27. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.js +1 -1
  28. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.js.map +1 -1
  29. package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.d.ts.map +1 -1
  30. package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.js.map +1 -1
  31. package/dist/field/features/debug/{treeview → treeView}/feature.client.d.ts.map +1 -1
  32. package/dist/field/features/debug/{treeview → treeView}/feature.client.js.map +1 -1
  33. package/dist/field/features/debug/{treeview → treeView}/feature.server.d.ts.map +1 -1
  34. package/dist/field/features/debug/{treeview → treeView}/feature.server.js +1 -1
  35. package/dist/field/features/debug/{treeview → treeView}/feature.server.js.map +1 -1
  36. package/dist/field/features/debug/{treeview → treeView}/plugin/index.d.ts.map +1 -1
  37. package/dist/field/features/debug/{treeview → treeView}/plugin/index.js.map +1 -1
  38. package/dist/field/features/format/bold/feature.client.d.ts.map +1 -1
  39. package/dist/field/features/format/bold/feature.client.js +25 -21
  40. package/dist/field/features/format/bold/feature.client.js.map +1 -1
  41. package/dist/field/features/format/inlineCode/feature.client.d.ts.map +1 -0
  42. package/dist/field/features/format/inlineCode/feature.client.js +46 -0
  43. package/dist/field/features/format/inlineCode/feature.client.js.map +1 -0
  44. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.d.ts.map +1 -1
  45. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.js +1 -1
  46. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.js.map +1 -1
  47. package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.d.ts.map +1 -1
  48. package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.js.map +1 -1
  49. package/dist/field/features/format/italic/feature.client.d.ts.map +1 -1
  50. package/dist/field/features/format/italic/feature.client.js +26 -22
  51. package/dist/field/features/format/italic/feature.client.js.map +1 -1
  52. package/dist/field/features/format/shared/toolbarFormatGroup.d.ts +3 -0
  53. package/dist/field/features/format/shared/toolbarFormatGroup.d.ts.map +1 -0
  54. package/dist/field/features/format/shared/toolbarFormatGroup.js +10 -0
  55. package/dist/field/features/format/shared/toolbarFormatGroup.js.map +1 -0
  56. package/dist/field/features/format/strikethrough/feature.client.d.ts.map +1 -1
  57. package/dist/field/features/format/strikethrough/feature.client.js +26 -22
  58. package/dist/field/features/format/strikethrough/feature.client.js.map +1 -1
  59. package/dist/field/features/format/subscript/feature.client.d.ts.map +1 -1
  60. package/dist/field/features/format/subscript/feature.client.js +24 -20
  61. package/dist/field/features/format/subscript/feature.client.js.map +1 -1
  62. package/dist/field/features/format/superscript/feature.client.d.ts.map +1 -1
  63. package/dist/field/features/format/superscript/feature.client.js +24 -20
  64. package/dist/field/features/format/superscript/feature.client.js.map +1 -1
  65. package/dist/field/features/format/underline/feature.client.d.ts.map +1 -1
  66. package/dist/field/features/format/underline/feature.client.js +24 -20
  67. package/dist/field/features/format/underline/feature.client.js.map +1 -1
  68. package/dist/field/features/heading/feature.client.d.ts.map +1 -1
  69. package/dist/field/features/heading/feature.client.js +69 -49
  70. package/dist/field/features/heading/feature.client.js.map +1 -1
  71. package/dist/field/features/{horizontalrule → horizontalRule}/component/index.d.ts.map +1 -1
  72. package/dist/field/features/{horizontalrule → horizontalRule}/component/index.js.map +1 -1
  73. package/dist/field/features/horizontalRule/feature.client.d.ts.map +1 -0
  74. package/dist/field/features/horizontalRule/feature.client.js +76 -0
  75. package/dist/field/features/horizontalRule/feature.client.js.map +1 -0
  76. package/dist/field/features/{horizontalrule → horizontalRule}/feature.server.d.ts.map +1 -1
  77. package/dist/field/features/{horizontalrule → horizontalRule}/feature.server.js +1 -1
  78. package/dist/field/features/{horizontalrule → horizontalRule}/feature.server.js.map +1 -1
  79. package/dist/field/features/{horizontalrule → horizontalRule}/markdownTransformer.d.ts.map +1 -1
  80. package/dist/field/features/{horizontalrule → horizontalRule}/markdownTransformer.js.map +1 -1
  81. package/dist/field/features/{horizontalrule → horizontalRule}/nodes/HorizontalRuleNode.d.ts.map +1 -1
  82. package/dist/field/features/{horizontalrule → horizontalRule}/nodes/HorizontalRuleNode.js.map +1 -1
  83. package/dist/field/features/{horizontalrule → horizontalRule}/plugin/index.d.ts.map +1 -1
  84. package/dist/field/features/{horizontalrule → horizontalRule}/plugin/index.js.map +1 -1
  85. package/dist/field/features/indent/feature.client.d.ts.map +1 -1
  86. package/dist/field/features/indent/feature.client.js +42 -40
  87. package/dist/field/features/indent/feature.client.js.map +1 -1
  88. package/dist/field/features/indent/toolbarIndentGroup.d.ts +3 -0
  89. package/dist/field/features/indent/toolbarIndentGroup.d.ts.map +1 -0
  90. package/dist/field/features/indent/toolbarIndentGroup.js +10 -0
  91. package/dist/field/features/indent/toolbarIndentGroup.js.map +1 -0
  92. package/dist/field/features/link/feature.client.d.ts.map +1 -1
  93. package/dist/field/features/link/feature.client.js +47 -43
  94. package/dist/field/features/link/feature.client.js.map +1 -1
  95. package/dist/field/features/link/populationPromise.d.ts.map +1 -1
  96. package/dist/field/features/link/populationPromise.js +2 -1
  97. package/dist/field/features/link/populationPromise.js.map +1 -1
  98. package/dist/field/features/lists/checklist/feature.client.d.ts +1 -1
  99. package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
  100. package/dist/field/features/lists/checklist/feature.client.js +56 -31
  101. package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
  102. package/dist/field/features/lists/checklist/feature.server.d.ts +1 -1
  103. package/dist/field/features/lists/checklist/feature.server.js +4 -4
  104. package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
  105. package/dist/field/features/lists/checklist/markdownTransformers.js +1 -1
  106. package/dist/field/features/lists/checklist/markdownTransformers.js.map +1 -1
  107. package/dist/field/features/lists/orderedList/feature.client.d.ts.map +1 -0
  108. package/dist/field/features/lists/orderedList/feature.client.js +96 -0
  109. package/dist/field/features/lists/orderedList/feature.client.js.map +1 -0
  110. package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.d.ts.map +1 -1
  111. package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.js +1 -1
  112. package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.js.map +1 -1
  113. package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.d.ts.map +1 -1
  114. package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.js +1 -1
  115. package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.js.map +1 -1
  116. package/dist/field/features/lists/{common → shared}/markdown.d.ts.map +1 -1
  117. package/dist/field/features/lists/{common → shared}/markdown.js.map +1 -1
  118. package/dist/field/features/lists/unorderedList/feature.client.d.ts.map +1 -0
  119. package/dist/field/features/lists/unorderedList/feature.client.js +96 -0
  120. package/dist/field/features/lists/unorderedList/feature.client.js.map +1 -0
  121. package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.d.ts.map +1 -1
  122. package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.js +1 -1
  123. package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.js.map +1 -1
  124. package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.d.ts.map +1 -1
  125. package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.js +1 -1
  126. package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.js.map +1 -1
  127. package/dist/field/features/paragraph/feature.client.d.ts.map +1 -1
  128. package/dist/field/features/paragraph/feature.client.js +44 -30
  129. package/dist/field/features/paragraph/feature.client.js.map +1 -1
  130. package/dist/field/features/relationship/feature.client.d.ts.map +1 -1
  131. package/dist/field/features/relationship/feature.client.js +36 -10
  132. package/dist/field/features/relationship/feature.client.js.map +1 -1
  133. package/dist/field/features/relationship/populationPromise.d.ts.map +1 -1
  134. package/dist/field/features/relationship/populationPromise.js +2 -1
  135. package/dist/field/features/relationship/populationPromise.js.map +1 -1
  136. package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts +3 -0
  137. package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -0
  138. package/dist/field/features/shared/toolbar/addDropdownGroup.js +12 -0
  139. package/dist/field/features/shared/toolbar/addDropdownGroup.js.map +1 -0
  140. package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts +3 -0
  141. package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -0
  142. package/dist/field/features/shared/toolbar/featureButtonsGroup.js +10 -0
  143. package/dist/field/features/shared/toolbar/featureButtonsGroup.js.map +1 -0
  144. package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts +3 -0
  145. package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -0
  146. package/dist/field/features/shared/toolbar/textDropdownGroup.js +12 -0
  147. package/dist/field/features/shared/toolbar/textDropdownGroup.js.map +1 -0
  148. package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts +6 -0
  149. package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -0
  150. package/dist/field/features/toolbars/fixed/Toolbar/index.js +152 -0
  151. package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -0
  152. package/dist/field/features/toolbars/fixed/Toolbar/index.scss +81 -0
  153. package/dist/field/features/toolbars/fixed/feature.client.d.ts +3 -0
  154. package/dist/field/features/toolbars/fixed/feature.client.d.ts.map +1 -0
  155. package/dist/field/features/toolbars/fixed/feature.client.js +20 -0
  156. package/dist/field/features/toolbars/fixed/feature.client.js.map +1 -0
  157. package/dist/field/features/toolbars/fixed/feature.server.d.ts +3 -0
  158. package/dist/field/features/toolbars/fixed/feature.server.d.ts.map +1 -0
  159. package/dist/field/features/toolbars/fixed/feature.server.js +16 -0
  160. package/dist/field/features/toolbars/fixed/feature.server.js.map +1 -0
  161. package/dist/field/features/toolbars/inline/Toolbar/index.d.ts +6 -0
  162. package/dist/field/features/toolbars/inline/Toolbar/index.d.ts.map +1 -0
  163. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/inline/Toolbar}/index.js +64 -38
  164. package/dist/field/features/toolbars/inline/Toolbar/index.js.map +1 -0
  165. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/inline/Toolbar}/index.scss +7 -11
  166. package/dist/field/features/toolbars/inline/feature.client.d.ts +3 -0
  167. package/dist/field/features/toolbars/inline/feature.client.d.ts.map +1 -0
  168. package/dist/field/features/toolbars/inline/feature.client.js +20 -0
  169. package/dist/field/features/toolbars/inline/feature.client.js.map +1 -0
  170. package/dist/field/features/toolbars/inline/feature.server.d.ts +3 -0
  171. package/dist/field/features/toolbars/inline/feature.server.d.ts.map +1 -0
  172. package/dist/field/features/toolbars/inline/feature.server.js +16 -0
  173. package/dist/field/features/toolbars/inline/feature.server.js.map +1 -0
  174. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts +10 -0
  175. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -0
  176. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarButton/index.js +16 -12
  177. package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -0
  178. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarButton/index.scss +3 -1
  179. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +23 -0
  180. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -0
  181. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarDropdown/DropDown.js +17 -67
  182. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -0
  183. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts +23 -0
  184. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -0
  185. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js +139 -0
  186. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -0
  187. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarDropdown/index.scss +25 -13
  188. package/dist/field/features/toolbars/types.d.ts +48 -0
  189. package/dist/field/features/toolbars/types.d.ts.map +1 -0
  190. package/dist/field/features/toolbars/types.js.map +1 -0
  191. package/dist/field/features/types.d.ts +51 -12
  192. package/dist/field/features/types.d.ts.map +1 -1
  193. package/dist/field/features/types.js.map +1 -1
  194. package/dist/field/features/upload/feature.client.d.ts.map +1 -1
  195. package/dist/field/features/upload/feature.client.js +35 -10
  196. package/dist/field/features/upload/feature.client.js.map +1 -1
  197. package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
  198. package/dist/field/features/upload/populationPromise.js +3 -1
  199. package/dist/field/features/upload/populationPromise.js.map +1 -1
  200. package/dist/field/lexical/EditorFocusProvider.d.ts +20 -0
  201. package/dist/field/lexical/EditorFocusProvider.d.ts.map +1 -0
  202. package/dist/field/lexical/EditorFocusProvider.js +78 -0
  203. package/dist/field/lexical/EditorFocusProvider.js.map +1 -0
  204. package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
  205. package/dist/field/lexical/LexicalEditor.js +20 -4
  206. package/dist/field/lexical/LexicalEditor.js.map +1 -1
  207. package/dist/field/lexical/LexicalEditor.scss +3 -19
  208. package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
  209. package/dist/field/lexical/LexicalProvider.js +3 -2
  210. package/dist/field/lexical/LexicalProvider.js.map +1 -1
  211. package/dist/field/lexical/config/client/EditorConfigProvider.d.ts +2 -3
  212. package/dist/field/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  213. package/dist/field/lexical/config/client/EditorConfigProvider.js.map +1 -1
  214. package/dist/field/lexical/config/client/sanitize.d.ts.map +1 -1
  215. package/dist/field/lexical/config/client/sanitize.js +80 -32
  216. package/dist/field/lexical/config/client/sanitize.js.map +1 -1
  217. package/dist/field/lexical/config/server/default.d.ts.map +1 -1
  218. package/dist/field/lexical/config/server/default.js +9 -7
  219. package/dist/field/lexical/config/server/default.js.map +1 -1
  220. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +9 -9
  221. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  222. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +71 -71
  223. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  224. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +4 -4
  225. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  226. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +3 -3
  227. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  228. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +17 -25
  229. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  230. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js +1 -37
  231. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  232. package/dist/field/lexical/plugins/SlashMenu/index.d.ts +2 -2
  233. package/dist/field/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  234. package/dist/field/lexical/plugins/SlashMenu/index.js +71 -65
  235. package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
  236. package/dist/field/lexical/theme/EditorTheme.scss +2 -6
  237. package/dist/field/lexical/ui/icons/Add/index.d.ts +3 -0
  238. package/dist/field/lexical/ui/icons/Add/index.d.ts.map +1 -0
  239. package/dist/field/lexical/ui/icons/Add/index.js +16 -0
  240. package/dist/field/lexical/ui/icons/Add/index.js.map +1 -0
  241. package/dist/index.d.ts +15 -11
  242. package/dist/index.d.ts.map +1 -1
  243. package/dist/index.js +16 -12
  244. package/dist/index.js.map +1 -1
  245. package/dist/populate/populate.d.ts +2 -1
  246. package/dist/populate/populate.d.ts.map +1 -1
  247. package/dist/populate/populate.js +13 -11
  248. package/dist/populate/populate.js.map +1 -1
  249. package/dist/populate/populateLexicalPopulationPromises.d.ts +1 -1
  250. package/dist/populate/populateLexicalPopulationPromises.d.ts.map +1 -1
  251. package/dist/populate/populateLexicalPopulationPromises.js +2 -1
  252. package/dist/populate/populateLexicalPopulationPromises.js.map +1 -1
  253. package/dist/populate/recurseNestedFields.d.ts +2 -1
  254. package/dist/populate/recurseNestedFields.d.ts.map +1 -1
  255. package/dist/populate/recurseNestedFields.js +2 -1
  256. package/dist/populate/recurseNestedFields.js.map +1 -1
  257. package/package.json +10 -10
  258. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.d.ts +0 -3
  259. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.d.ts.map +0 -1
  260. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.js +0 -12
  261. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.js.map +0 -1
  262. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.d.ts +0 -3
  263. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.d.ts.map +0 -1
  264. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.js +0 -10
  265. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.js.map +0 -1
  266. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.d.ts +0 -3
  267. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.d.ts.map +0 -1
  268. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.js +0 -12
  269. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.js.map +0 -1
  270. package/dist/field/features/format/common/floatingSelectToolbarSection.d.ts +0 -3
  271. package/dist/field/features/format/common/floatingSelectToolbarSection.d.ts.map +0 -1
  272. package/dist/field/features/format/common/floatingSelectToolbarSection.js +0 -10
  273. package/dist/field/features/format/common/floatingSelectToolbarSection.js.map +0 -1
  274. package/dist/field/features/format/inlinecode/feature.client.d.ts.map +0 -1
  275. package/dist/field/features/format/inlinecode/feature.client.js +0 -42
  276. package/dist/field/features/format/inlinecode/feature.client.js.map +0 -1
  277. package/dist/field/features/horizontalrule/feature.client.d.ts.map +0 -1
  278. package/dist/field/features/horizontalrule/feature.client.js +0 -53
  279. package/dist/field/features/horizontalrule/feature.client.js.map +0 -1
  280. package/dist/field/features/indent/floatingSelectToolbarIndentSection.d.ts +0 -3
  281. package/dist/field/features/indent/floatingSelectToolbarIndentSection.d.ts.map +0 -1
  282. package/dist/field/features/indent/floatingSelectToolbarIndentSection.js +0 -10
  283. package/dist/field/features/indent/floatingSelectToolbarIndentSection.js.map +0 -1
  284. package/dist/field/features/indent/index.scss +0 -4
  285. package/dist/field/features/lists/orderedlist/feature.client.d.ts.map +0 -1
  286. package/dist/field/features/lists/orderedlist/feature.client.js +0 -71
  287. package/dist/field/features/lists/orderedlist/feature.client.js.map +0 -1
  288. package/dist/field/features/lists/unorderedlist/feature.client.d.ts.map +0 -1
  289. package/dist/field/features/lists/unorderedlist/feature.client.js +0 -71
  290. package/dist/field/features/lists/unorderedlist/feature.client.js.map +0 -1
  291. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts +0 -8
  292. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts.map +0 -1
  293. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js.map +0 -1
  294. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts +0 -17
  295. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts.map +0 -1
  296. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.js.map +0 -1
  297. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.d.ts +0 -18
  298. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.d.ts.map +0 -1
  299. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js +0 -42
  300. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js.map +0 -1
  301. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts +0 -6
  302. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts.map +0 -1
  303. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js.map +0 -1
  304. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.d.ts +0 -40
  305. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.d.ts.map +0 -1
  306. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.js.map +0 -1
  307. /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.d.ts +0 -0
  308. /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.js +0 -0
  309. /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.d.ts +0 -0
  310. /package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.d.ts +0 -0
  311. /package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.js +0 -0
  312. /package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.scss +0 -0
  313. /package/dist/field/features/debug/{treeview → treeView}/feature.client.d.ts +0 -0
  314. /package/dist/field/features/debug/{treeview → treeView}/feature.client.js +0 -0
  315. /package/dist/field/features/debug/{treeview → treeView}/feature.server.d.ts +0 -0
  316. /package/dist/field/features/debug/{treeview → treeView}/plugin/index.d.ts +0 -0
  317. /package/dist/field/features/debug/{treeview → treeView}/plugin/index.js +0 -0
  318. /package/dist/field/features/debug/{treeview → treeView}/plugin/index.scss +0 -0
  319. /package/dist/field/features/format/{inlinecode → inlineCode}/feature.client.d.ts +0 -0
  320. /package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.d.ts +0 -0
  321. /package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.d.ts +0 -0
  322. /package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.js +0 -0
  323. /package/dist/field/features/{horizontalrule → horizontalRule}/component/index.d.ts +0 -0
  324. /package/dist/field/features/{horizontalrule → horizontalRule}/component/index.js +0 -0
  325. /package/dist/field/features/{horizontalrule → horizontalRule}/feature.client.d.ts +0 -0
  326. /package/dist/field/features/{horizontalrule → horizontalRule}/feature.server.d.ts +0 -0
  327. /package/dist/field/features/{horizontalrule → horizontalRule}/markdownTransformer.d.ts +0 -0
  328. /package/dist/field/features/{horizontalrule → horizontalRule}/markdownTransformer.js +0 -0
  329. /package/dist/field/features/{horizontalrule → horizontalRule}/nodes/HorizontalRuleNode.d.ts +0 -0
  330. /package/dist/field/features/{horizontalrule → horizontalRule}/nodes/HorizontalRuleNode.js +0 -0
  331. /package/dist/field/features/{horizontalrule → horizontalRule}/plugin/index.d.ts +0 -0
  332. /package/dist/field/features/{horizontalrule → horizontalRule}/plugin/index.js +0 -0
  333. /package/dist/field/features/{horizontalrule → horizontalRule}/plugin/index.scss +0 -0
  334. /package/dist/field/features/lists/{orderedlist → orderedList}/feature.client.d.ts +0 -0
  335. /package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.d.ts +0 -0
  336. /package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.d.ts +0 -0
  337. /package/dist/field/features/lists/{common → shared}/markdown.d.ts +0 -0
  338. /package/dist/field/features/lists/{common → shared}/markdown.js +0 -0
  339. /package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.client.d.ts +0 -0
  340. /package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.d.ts +0 -0
  341. /package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.d.ts +0 -0
  342. /package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars}/types.js +0 -0
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
  import { getTranslation } from '@payloadcms/translations';
3
- import { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js';
4
3
  import { BlockIcon } from '../../lexical/ui/icons/Block/index.js';
5
4
  import { createClientComponent } from '../createClientComponent.js';
6
5
  import { BlockNode } from './nodes/BlocksNode.js';
@@ -21,35 +20,65 @@ const BlocksFeatureClient = (props)=>{
21
20
  }
22
21
  ],
23
22
  slashMenu: {
24
- options: [
23
+ groups: [
25
24
  {
26
- displayName: 'Blocks',
25
+ items: props.reducedBlocks.map((block)=>{
26
+ return {
27
+ Icon: BlockIcon,
28
+ key: 'block-' + block.slug,
29
+ keywords: [
30
+ 'block',
31
+ 'blocks',
32
+ block.slug
33
+ ],
34
+ label: ({ i18n })=>{
35
+ if (!block.labels.singular) {
36
+ return block.slug;
37
+ }
38
+ return getTranslation(block.labels.singular, i18n);
39
+ },
40
+ onSelect: ({ editor })=>{
41
+ editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
42
+ id: null,
43
+ blockName: '',
44
+ blockType: block.slug
45
+ });
46
+ }
47
+ };
48
+ }),
27
49
  key: 'blocks',
28
- options: [
29
- ...props.reducedBlocks.map((block)=>{
30
- return new SlashMenuOption('block-' + block.slug, {
31
- Icon: BlockIcon,
32
- displayName: ({ i18n })=>{
33
- if (!block.labels.singular) {
34
- return block.slug;
35
- }
36
- return getTranslation(block.labels.singular, i18n);
37
- },
38
- keywords: [
39
- 'block',
40
- 'blocks',
41
- block.slug
42
- ],
43
- onSelect: ({ editor })=>{
44
- editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
45
- id: null,
46
- blockName: '',
47
- blockType: block.slug
48
- });
50
+ label: 'Blocks'
51
+ }
52
+ ]
53
+ },
54
+ toolbarFixed: {
55
+ groups: [
56
+ {
57
+ type: 'dropdown',
58
+ ChildComponent: BlockIcon,
59
+ items: props.reducedBlocks.map((block, index)=>{
60
+ return {
61
+ ChildComponent: BlockIcon,
62
+ isActive: undefined,
63
+ key: 'block-' + block.slug,
64
+ label: ({ i18n })=>{
65
+ if (!block.labels.singular) {
66
+ return block.slug;
49
67
  }
50
- });
51
- })
52
- ]
68
+ return getTranslation(block.labels.singular, i18n);
69
+ },
70
+ onSelect: ({ editor })=>{
71
+ editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
72
+ id: null,
73
+ blockName: '',
74
+ blockType: block.slug
75
+ });
76
+ },
77
+ order: index
78
+ };
79
+ }),
80
+ key: 'blocks',
81
+ order: 20
53
82
  }
54
83
  ]
55
84
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blocks/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport { BlockIcon } from '../../lexical/ui/icons/Block/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport type BlocksFeatureClientProps = {\n reducedBlocks: ReducedBlock[]\n}\n\nconst BlocksFeatureClient: FeatureProviderProviderClient<BlocksFeatureClientProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [BlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n options: [\n {\n displayName: 'Blocks',\n key: 'blocks',\n options: [\n ...props.reducedBlocks.map((block) => {\n return new SlashMenuOption('block-' + block.slug, {\n Icon: BlockIcon,\n displayName: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n keywords: ['block', 'blocks', block.slug],\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n })\n }),\n ],\n },\n ],\n },\n }),\n }\n}\n\nexport const BlocksFeatureClientComponent = createClientComponent(BlocksFeatureClient)\n"],"names":["getTranslation","SlashMenuOption","BlockIcon","createClientComponent","BlockNode","INSERT_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","slashMenu","options","displayName","key","reducedBlocks","map","block","slug","Icon","i18n","labels","singular","keywords","onSelect","editor","dispatchCommand","id","blockName","blockType","BlocksFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AAIzD,SAASC,eAAe,QAAQ,sEAAqE;AACrG,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,oBAAoB,QAAQ,uBAAsB;AAC3D,SAASC,YAAY,QAAQ,oBAAmB;AAMhD,MAAMC,sBAA+E,CAACC;IACpF,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,OAAO;oBAACP;iBAAU;gBAClBQ,SAAS;oBACP;wBACEC,WAAWP;wBACXQ,UAAU;oBACZ;iBACD;gBACDC,WAAW;oBACTC,SAAS;wBACP;4BACEC,aAAa;4BACbC,KAAK;4BACLF,SAAS;mCACJR,MAAMW,aAAa,CAACC,GAAG,CAAC,CAACC;oCAC1B,OAAO,IAAIpB,gBAAgB,WAAWoB,MAAMC,IAAI,EAAE;wCAChDC,MAAMrB;wCACNe,aAAa,CAAC,EAAEO,IAAI,EAAE;4CACpB,IAAI,CAACH,MAAMI,MAAM,CAACC,QAAQ,EAAE;gDAC1B,OAAOL,MAAMC,IAAI;4CACnB;4CAEA,OAAOtB,eAAeqB,MAAMI,MAAM,CAACC,QAAQ,EAAEF;wCAC/C;wCACAG,UAAU;4CAAC;4CAAS;4CAAUN,MAAMC,IAAI;yCAAC;wCACzCM,UAAU,CAAC,EAAEC,MAAM,EAAE;4CACnBA,OAAOC,eAAe,CAACzB,sBAAsB;gDAC3C0B,IAAI;gDACJC,WAAW;gDACXC,WAAWZ,MAAMC,IAAI;4CACvB;wCACF;oCACF;gCACF;6BACD;wBACH;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMY,+BAA+B/B,sBAAsBI,qBAAoB"}
1
+ {"version":3,"sources":["../../../../src/field/features/blocks/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { BlockIcon } from '../../lexical/ui/icons/Block/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport type BlocksFeatureClientProps = {\n reducedBlocks: ReducedBlock[]\n}\n\nconst BlocksFeatureClient: FeatureProviderProviderClient<BlocksFeatureClientProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [BlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n {\n items: props.reducedBlocks.map((block) => {\n return {\n Icon: BlockIcon,\n key: 'block-' + block.slug,\n keywords: ['block', 'blocks', block.slug],\n label: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n }\n }),\n key: 'blocks',\n label: 'Blocks',\n },\n ],\n },\n toolbarFixed: {\n groups: [\n {\n type: 'dropdown',\n ChildComponent: BlockIcon,\n items: props.reducedBlocks.map((block, index) => {\n return {\n ChildComponent: BlockIcon,\n isActive: undefined, // At this point, we would be inside a sub-richtext-editor. And at this point this will be run against the focused sub-editor, not the parent editor which has the actual block. Thus, no point in running this\n key: 'block-' + block.slug,\n label: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n order: index,\n }\n }),\n key: 'blocks',\n order: 20,\n },\n ],\n },\n }),\n }\n}\n\nexport const BlocksFeatureClientComponent = createClientComponent(BlocksFeatureClient)\n"],"names":["getTranslation","BlockIcon","createClientComponent","BlockNode","INSERT_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","slashMenu","groups","items","reducedBlocks","map","block","Icon","key","slug","keywords","label","i18n","labels","singular","onSelect","editor","dispatchCommand","id","blockName","blockType","toolbarFixed","type","ChildComponent","index","isActive","undefined","order","BlocksFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AAIzD,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,oBAAoB,QAAQ,uBAAsB;AAC3D,SAASC,YAAY,QAAQ,oBAAmB;AAMhD,MAAMC,sBAA+E,CAACC;IACpF,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,OAAO;oBAACP;iBAAU;gBAClBQ,SAAS;oBACP;wBACEC,WAAWP;wBACXQ,UAAU;oBACZ;iBACD;gBACDC,WAAW;oBACTC,QAAQ;wBACN;4BACEC,OAAOT,MAAMU,aAAa,CAACC,GAAG,CAAC,CAACC;gCAC9B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version":3,"file":"populationPromise.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/populationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAIhE,eAAO,MAAM,yBAAyB,UAC7B,kBAAkB,KACxB,kBAAkB,mBAAmB,CA4CvC,CAAA"}
1
+ {"version":3,"file":"populationPromise.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/populationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAIhE,eAAO,MAAM,yBAAyB,UAC7B,kBAAkB,KACxB,kBAAkB,mBAAmB,CA8CvC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { recurseNestedFields } from '../../../populate/recurseNestedFields.js';
2
2
  export const blockPopulationPromiseHOC = (props)=>{
3
- const blockPopulationPromise = ({ context, currentDepth, depth, editorPopulationPromises, fieldPromises, findMany, flattenLocales, node, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc })=>{
3
+ const blockPopulationPromise = ({ context, currentDepth, depth, draft, editorPopulationPromises, fieldPromises, findMany, flattenLocales, node, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc })=>{
4
4
  const blockFieldData = node.fields;
5
5
  // find block used in this node
6
6
  const block = props.blocks.find((block)=>block.slug === blockFieldData.blockType);
@@ -22,6 +22,7 @@ export const blockPopulationPromiseHOC = (props)=>{
22
22
  req,
23
23
  showHiddenFields,
24
24
  // The afterReadPromise gets its data from looking for field.name inside the siblingDoc. Thus, here we cannot pass the whole document's siblingDoc, but only the siblingDoc (sibling fields) of the current field.
25
+ draft,
25
26
  siblingDoc: blockFieldData
26
27
  });
27
28
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blocks/populationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../types.js'\nimport type { BlocksFeatureProps } from './feature.server.js'\nimport type { SerializedBlockNode } from './nodes/BlocksNode.js'\n\nimport { recurseNestedFields } from '../../../populate/recurseNestedFields.js'\n\nexport const blockPopulationPromiseHOC = (\n props: BlocksFeatureProps,\n): PopulationPromise<SerializedBlockNode> => {\n const blockPopulationPromise: PopulationPromise<SerializedBlockNode> = ({\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) => {\n const blockFieldData = node.fields\n\n // find block used in this node\n const block = props.blocks.find((block) => block.slug === blockFieldData.blockType)\n if (!block || !block?.fields?.length || !blockFieldData) {\n return\n }\n\n recurseNestedFields({\n context,\n currentDepth,\n data: blockFieldData,\n depth,\n editorPopulationPromises,\n fieldPromises,\n fields: block.fields,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n // The afterReadPromise gets its data from looking for field.name inside the siblingDoc. Thus, here we cannot pass the whole document's siblingDoc, but only the siblingDoc (sibling fields) of the current field.\n siblingDoc: blockFieldData,\n })\n }\n\n return blockPopulationPromise\n}\n"],"names":["recurseNestedFields","blockPopulationPromiseHOC","props","blockPopulationPromise","context","currentDepth","depth","editorPopulationPromises","fieldPromises","findMany","flattenLocales","node","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","blockFieldData","fields","block","blocks","find","slug","blockType","length","data"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,mBAAmB,QAAQ,2CAA0C;AAE9E,OAAO,MAAMC,4BAA4B,CACvCC;IAEA,MAAMC,yBAAiE,CAAC,EACtEC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,wBAAwB,EACxBC,aAAa,EACbC,QAAQ,EACRC,cAAc,EACdC,IAAI,EACJC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACX;QACC,MAAMC,iBAAiBN,KAAKO,MAAM;QAElC,+BAA+B;QAC/B,MAAMC,QAAQjB,MAAMkB,MAAM,CAACC,IAAI,CAAC,CAACF,QAAUA,MAAMG,IAAI,KAAKL,eAAeM,SAAS;QAClF,IAAI,CAACJ,SAAS,CAACA,OAAOD,QAAQM,UAAU,CAACP,gBAAgB;YACvD;QACF;QAEAjB,oBAAoB;YAClBI;YACAC;YACAoB,MAAMR;YACNX;YACAC;YACAC;YACAU,QAAQC,MAAMD,MAAM;YACpBT;YACAC;YACAE;YACAC;YACAC;YACAC;YACA,kNAAkN;YAClNC,YAAYC;QACd;IACF;IAEA,OAAOd;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/blocks/populationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../types.js'\nimport type { BlocksFeatureProps } from './feature.server.js'\nimport type { SerializedBlockNode } from './nodes/BlocksNode.js'\n\nimport { recurseNestedFields } from '../../../populate/recurseNestedFields.js'\n\nexport const blockPopulationPromiseHOC = (\n props: BlocksFeatureProps,\n): PopulationPromise<SerializedBlockNode> => {\n const blockPopulationPromise: PopulationPromise<SerializedBlockNode> = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) => {\n const blockFieldData = node.fields\n\n // find block used in this node\n const block = props.blocks.find((block) => block.slug === blockFieldData.blockType)\n if (!block || !block?.fields?.length || !blockFieldData) {\n return\n }\n\n recurseNestedFields({\n context,\n currentDepth,\n data: blockFieldData,\n depth,\n editorPopulationPromises,\n fieldPromises,\n fields: block.fields,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n // The afterReadPromise gets its data from looking for field.name inside the siblingDoc. Thus, here we cannot pass the whole document's siblingDoc, but only the siblingDoc (sibling fields) of the current field.\n draft,\n siblingDoc: blockFieldData,\n })\n }\n\n return blockPopulationPromise\n}\n"],"names":["recurseNestedFields","blockPopulationPromiseHOC","props","blockPopulationPromise","context","currentDepth","depth","draft","editorPopulationPromises","fieldPromises","findMany","flattenLocales","node","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","blockFieldData","fields","block","blocks","find","slug","blockType","length","data"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,mBAAmB,QAAQ,2CAA0C;AAE9E,OAAO,MAAMC,4BAA4B,CACvCC;IAEA,MAAMC,yBAAiE,CAAC,EACtEC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,KAAK,EACLC,wBAAwB,EACxBC,aAAa,EACbC,QAAQ,EACRC,cAAc,EACdC,IAAI,EACJC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACX;QACC,MAAMC,iBAAiBN,KAAKO,MAAM;QAElC,+BAA+B;QAC/B,MAAMC,QAAQlB,MAAMmB,MAAM,CAACC,IAAI,CAAC,CAACF,QAAUA,MAAMG,IAAI,KAAKL,eAAeM,SAAS;QAClF,IAAI,CAACJ,SAAS,CAACA,OAAOD,QAAQM,UAAU,CAACP,gBAAgB;YACvD;QACF;QAEAlB,oBAAoB;YAClBI;YACAC;YACAqB,MAAMR;YACNZ;YACAE;YACAC;YACAU,QAAQC,MAAMD,MAAM;YACpBT;YACAC;YACAE;YACAC;YACAC;YACAC;YACA,kNAAkN;YAClNT;YACAU,YAAYC;QACd;IACF;IAEA,OAAOf;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/testrecorder/feature.client.tsx"],"names":[],"mappings":";AAqBA,eAAO,MAAM,kCAAkC,+BAAmD,CAAA"}
1
+ {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/testRecorder/feature.client.tsx"],"names":[],"mappings":";AAqBA,eAAO,MAAM,kCAAkC,+BAAmD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/debug/testrecorder/feature.client.tsx"],"sourcesContent":["'use client'\nimport type { FeatureProviderProviderClient } from '../../types.js'\n\nimport { createClientComponent } from '../../createClientComponent.js'\nimport { TestRecorderPlugin } from './plugin/index.js'\n\nconst TestRecorderFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n plugins: [\n {\n Component: TestRecorderPlugin,\n position: 'bottom',\n },\n ],\n }),\n }\n}\n\nexport const TestRecorderFeatureClientComponent = createClientComponent(TestRecorderFeatureClient)\n"],"names":["createClientComponent","TestRecorderPlugin","TestRecorderFeatureClient","props","clientFeatureProps","feature","plugins","Component","position","TestRecorderFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,qBAAqB,QAAQ,iCAAgC;AACtE,SAASC,kBAAkB,QAAQ,oBAAmB;AAEtD,MAAMC,4BAAsE,CAACC;IAC3E,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,SAAS;oBACP;wBACEC,WAAWN;wBACXO,UAAU;oBACZ;iBACD;YACH,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,qCAAqCT,sBAAsBE,2BAA0B"}
1
+ {"version":3,"sources":["../../../../../src/field/features/debug/testRecorder/feature.client.tsx"],"sourcesContent":["'use client'\nimport type { FeatureProviderProviderClient } from '../../types.js'\n\nimport { createClientComponent } from '../../createClientComponent.js'\nimport { TestRecorderPlugin } from './plugin/index.js'\n\nconst TestRecorderFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n plugins: [\n {\n Component: TestRecorderPlugin,\n position: 'bottom',\n },\n ],\n }),\n }\n}\n\nexport const TestRecorderFeatureClientComponent = createClientComponent(TestRecorderFeatureClient)\n"],"names":["createClientComponent","TestRecorderPlugin","TestRecorderFeatureClient","props","clientFeatureProps","feature","plugins","Component","position","TestRecorderFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,qBAAqB,QAAQ,iCAAgC;AACtE,SAASC,kBAAkB,QAAQ,oBAAmB;AAEtD,MAAMC,4BAAsE,CAACC;IAC3E,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,SAAS;oBACP;wBACEC,WAAWN;wBACXO,UAAU;oBACZ;iBACD;YACH,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,qCAAqCT,sBAAsBE,2BAA0B"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/testrecorder/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAInE,eAAO,MAAM,mBAAmB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAWnF,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/testRecorder/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAInE,eAAO,MAAM,mBAAmB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAWnF,CAAA"}
@@ -7,7 +7,7 @@ export const TestRecorderFeature = (props)=>{
7
7
  serverFeatureProps: props
8
8
  };
9
9
  },
10
- key: 'testrecorder',
10
+ key: 'testRecorder',
11
11
  serverFeatureProps: props
12
12
  };
13
13
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/debug/testrecorder/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { TestRecorderFeatureClientComponent } from './feature.client.js'\n\nexport const TestRecorderFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: TestRecorderFeatureClientComponent,\n serverFeatureProps: props,\n }\n },\n key: 'testrecorder',\n serverFeatureProps: props,\n }\n}\n"],"names":["TestRecorderFeatureClientComponent","TestRecorderFeature","props","feature","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAEA,SAASA,kCAAkC,QAAQ,sBAAqB;AAExE,OAAO,MAAMC,sBAA2E,CAACC;IACvF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoBH;YACtB;QACF;QACAI,KAAK;QACLD,oBAAoBH;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/debug/testRecorder/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { TestRecorderFeatureClientComponent } from './feature.client.js'\n\nexport const TestRecorderFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: TestRecorderFeatureClientComponent,\n serverFeatureProps: props,\n }\n },\n key: 'testRecorder',\n serverFeatureProps: props,\n }\n}\n"],"names":["TestRecorderFeatureClientComponent","TestRecorderFeature","props","feature","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAEA,SAASA,kCAAkC,QAAQ,sBAAqB;AAExE,OAAO,MAAMC,sBAA2E,CAACC;IACvF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoBH;YACtB;QACF;QACAI,KAAK;QACLD,oBAAoBH;IACtB;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/debug/testrecorder/plugin/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,cAAc,CAAA;AA8ErB,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAEzD;AAmWD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAYtC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/debug/testRecorder/plugin/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,cAAc,CAAA;AA8ErB,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAEzD;AAmWD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAYtC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/field/features/debug/testrecorder/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $createParagraphNode, $createTextNode, $getRoot } from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\n\nimport { IS_APPLE } from '../../../../lexical/utils/environment.js'\nimport './index.scss'\n\nconst copy = (text: null | string) => {\n const textArea = document.createElement('textarea')\n textArea.value = text || ''\n textArea.style.position = 'absolute'\n textArea.style.opacity = '0'\n document.body?.appendChild(textArea)\n textArea.focus()\n textArea.select()\n try {\n const result = document.execCommand('copy')\n // eslint-disable-next-line no-console\n console.log(result)\n } catch (error) {\n console.error(error)\n }\n document.body?.removeChild(textArea)\n}\n\nconst download = (filename: string, text: null | string) => {\n const a = document.createElement('a')\n a.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text || ''))\n a.setAttribute('download', filename)\n a.style.display = 'none'\n document.body?.appendChild(a)\n a.click()\n document.body?.removeChild(a)\n}\n\nconst formatStep = (step: Step) => {\n const formatOneStep = (name: string, value: Step['value']) => {\n switch (name) {\n case 'click': {\n return ` await page.mouse.click(${value.x}, ${value.y});`\n }\n case 'press': {\n return ` await page.keyboard.press('${value}');`\n }\n case 'keydown': {\n return ` await page.keyboard.keydown('${value}');`\n }\n case 'keyup': {\n return ` await page.keyboard.keyup('${value}');`\n }\n case 'type': {\n return ` await page.keyboard.type('${value}');`\n }\n case 'selectAll': {\n return ` await selectAll(page);`\n }\n case 'snapshot': {\n return ` await assertHTMLSnapshot(page);\n await assertSelection(page, {\n anchorPath: [${value.anchorPath.toString()}],\n anchorOffset: ${value.anchorOffset},\n focusPath: [${value.focusPath.toString()}],\n focusOffset: ${value.focusOffset},\n });\n`\n }\n default:\n return ``\n }\n }\n const formattedStep = formatOneStep(step.name, step.value)\n switch (step.count) {\n case 1:\n return formattedStep\n case 2:\n return [formattedStep, formattedStep].join(`\\n`)\n default:\n return ` await repeat(${step.count}, async () => {\n ${formattedStep}\n );`\n }\n}\n\nexport function isSelectAll(event: KeyboardEvent): boolean {\n return event.keyCode === 65 && (IS_APPLE ? event.metaKey : event.ctrlKey)\n}\n\n// stolen from LexicalSelection-test\nfunction sanitizeSelection(selection: Selection) {\n const { anchorNode, focusNode } = selection\n let { anchorOffset, focusOffset } = selection\n if (anchorOffset !== 0) {\n anchorOffset--\n }\n if (focusOffset !== 0) {\n focusOffset--\n }\n return { anchorNode, anchorOffset, focusNode, focusOffset }\n}\n\nfunction getPathFromNodeToEditor(node: Node, rootElement: HTMLElement | null) {\n let currentNode: Node | null | undefined = node\n const path = []\n while (currentNode !== rootElement) {\n if (currentNode !== null && currentNode !== undefined) {\n path.unshift(\n Array.from(currentNode?.parentNode?.childNodes ?? []).indexOf(currentNode as ChildNode),\n )\n }\n currentNode = currentNode?.parentNode\n }\n return path\n}\n\nconst keyPresses = new Set([\n 'Enter',\n 'Backspace',\n 'Delete',\n 'Escape',\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n])\n\ntype Step = {\n count: number\n name: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any\n}\n\ntype Steps = Step[]\n\nfunction useTestRecorder(editor: LexicalEditor): [JSX.Element, JSX.Element | null] {\n const [steps, setSteps] = useState<Steps>([])\n const [isRecording, setIsRecording] = useState(false)\n const [, setCurrentInnerHTML] = useState('')\n const [templatedTest, setTemplatedTest] = useState('')\n const previousSelectionRef = useRef<BaseSelection | null>(null)\n const skipNextSelectionChangeRef = useRef(false)\n const preRef = useRef<HTMLPreElement>(null)\n\n const getCurrentEditor = useCallback(() => {\n return editor\n }, [editor])\n\n const generateTestContent = useCallback(() => {\n const rootElement = editor.getRootElement()\n const browserSelection = window.getSelection()\n\n if (\n rootElement == null ||\n browserSelection == null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null ||\n !rootElement.contains(browserSelection.anchorNode) ||\n !rootElement.contains(browserSelection.focusNode)\n ) {\n return null\n }\n\n return `\nimport {\n initializeE2E,\n assertHTMLSnapshot,\n assertSelection,\n repeat,\n} from '../utils';\nimport {selectAll} from '../keyboardShortcuts';\nimport { RangeSelection } from 'lexical';\nimport { NodeSelection } from 'lexical';\n\ndescribe('Test case', () => {\n initializeE2E((e2e) => {\n it('Should pass this test', async () => {\n const {page} = e2e;\n\n await page.focus('div[contenteditable=\"true\"]');\n${steps.map(formatStep).join(`\\n`)}\n });\n});\n `\n }, [editor, steps])\n\n // just a wrapper around inserting new actions so that we can\n // coalesce some actions like insertText/moveNativeSelection\n const pushStep = useCallback(\n (name: string, value: Step['value']) => {\n setSteps((currentSteps) => {\n // trying to group steps\n const currentIndex = steps.length - 1\n const lastStep = steps[currentIndex]\n if (lastStep) {\n if (lastStep.name === name) {\n if (name === 'type') {\n // for typing events we just append the text\n return [\n ...steps.slice(0, currentIndex),\n { ...lastStep, value: lastStep.value + value },\n ]\n } else {\n // for other events we bump the counter if their values are the same\n if (lastStep.value === value) {\n return [...steps.slice(0, currentIndex), { ...lastStep, count: lastStep.count + 1 }]\n }\n }\n }\n }\n // could not group, just append a new one\n return [...currentSteps, { name, count: 1, value }]\n })\n },\n [steps, setSteps],\n )\n\n useLayoutEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (isSelectAll(event)) {\n pushStep('selectAll', '')\n } else if (keyPresses.has(key)) {\n pushStep('press', event.key)\n } else if ([...key].length > 1) {\n pushStep('keydown', event.key)\n } else {\n pushStep('type', event.key)\n }\n }\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (!keyPresses.has(key) && [...key].length > 1) {\n pushStep('keyup', event.key)\n }\n }\n\n return editor.registerRootListener(\n (rootElement: HTMLElement | null, prevRootElement: HTMLElement | null) => {\n if (prevRootElement !== null) {\n prevRootElement.removeEventListener('keydown', onKeyDown)\n prevRootElement.removeEventListener('keyup', onKeyUp)\n }\n if (rootElement !== null) {\n rootElement.addEventListener('keydown', onKeyDown)\n rootElement.addEventListener('keyup', onKeyUp)\n }\n },\n )\n }, [editor, isRecording, pushStep])\n\n useLayoutEffect(() => {\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }, [generateTestContent])\n\n useEffect(() => {\n if (steps) {\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }\n }, [generateTestContent, steps])\n\n useEffect(() => {\n const removeUpdateListener = editor.registerUpdateListener(\n ({ dirtyElements, dirtyLeaves, editorState }) => {\n if (!isRecording) {\n return\n }\n const currentSelection = editorState._selection\n const previousSelection = previousSelectionRef.current\n const skipNextSelectionChange = skipNextSelectionChangeRef.current\n if (previousSelection !== currentSelection) {\n if (dirtyLeaves.size === 0 && dirtyElements.size === 0 && !skipNextSelectionChange) {\n const browserSelection = window.getSelection()\n if (\n browserSelection &&\n (browserSelection.anchorNode == null || browserSelection.focusNode == null)\n ) {\n return\n }\n }\n previousSelectionRef.current = currentSelection\n }\n skipNextSelectionChangeRef.current = false\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n },\n )\n return removeUpdateListener\n }, [editor, generateTestContent, isRecording, pushStep])\n\n // save innerHTML\n useEffect(() => {\n if (!isRecording) {\n return\n }\n const removeUpdateListener = editor.registerUpdateListener(() => {\n const rootElement = editor.getRootElement()\n if (rootElement !== null) {\n setCurrentInnerHTML(rootElement?.innerHTML)\n }\n })\n return removeUpdateListener\n }, [editor, isRecording])\n\n // clear editor and start recording\n const toggleEditorSelection = useCallback(\n (currentEditor: LexicalEditor) => {\n if (!isRecording) {\n currentEditor.update(() => {\n const root = $getRoot()\n root.clear()\n const text = $createTextNode()\n root.append($createParagraphNode().append(text))\n text.select()\n })\n setSteps([])\n }\n setIsRecording((currentIsRecording) => !currentIsRecording)\n },\n [isRecording],\n )\n\n const onSnapshotClick = useCallback(() => {\n if (!isRecording) {\n return\n }\n const browserSelection = window.getSelection()\n if (\n browserSelection === null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null\n ) {\n return\n }\n const { anchorNode, anchorOffset, focusNode, focusOffset } = sanitizeSelection(browserSelection)\n const rootElement = getCurrentEditor().getRootElement()\n let anchorPath\n if (anchorNode !== null) {\n anchorPath = getPathFromNodeToEditor(anchorNode, rootElement)\n }\n let focusPath\n if (focusNode !== null) {\n focusPath = getPathFromNodeToEditor(focusNode, rootElement)\n }\n pushStep('snapshot', {\n anchorNode,\n anchorOffset,\n anchorPath,\n focusNode,\n focusOffset,\n focusPath,\n })\n }, [pushStep, isRecording, getCurrentEditor])\n\n const onCopyClick = useCallback(() => {\n copy(generateTestContent())\n }, [generateTestContent])\n\n const onDownloadClick = useCallback(() => {\n download('test.js', generateTestContent())\n }, [generateTestContent])\n\n const button = (\n <button\n className={`editor-dev-button ${isRecording ? 'active' : ''}`}\n id=\"test-recorder-button\"\n onClick={(e) => {\n toggleEditorSelection(getCurrentEditor())\n e.preventDefault()\n }}\n title={isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n type=\"button\"\n >\n {isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n </button>\n )\n const output = isRecording ? (\n <div className=\"test-recorder-output\">\n <div className=\"test-recorder-toolbar\">\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-snapshot\"\n onClick={(e) => {\n onSnapshotClick()\n e.preventDefault()\n }}\n title=\"Insert snapshot\"\n type=\"button\"\n >\n Insert Snapshot\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-copy\"\n onClick={(e) => {\n onCopyClick()\n e.preventDefault()\n }}\n title=\"Copy to clipboard\"\n type=\"button\"\n >\n Copy\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-download\"\n onClick={(e) => {\n onDownloadClick()\n e.preventDefault()\n }}\n title=\"Download as a file\"\n type=\"button\"\n >\n Download\n </button>\n </div>\n <pre id=\"test-recorder\" ref={preRef}>\n {templatedTest}\n </pre>\n </div>\n ) : null\n\n return [button, output]\n}\nexport const TestRecorderPlugin: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const [testRecorderButton, testRecorderOutput] = useTestRecorder(editor)\n\n return (\n <React.Fragment>\n <p>HI</p>\n {testRecorderButton}\n {testRecorderOutput}\n <p>DONE</p>\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","$createParagraphNode","$createTextNode","$getRoot","React","useCallback","useEffect","useLayoutEffect","useRef","useState","IS_APPLE","copy","text","textArea","document","createElement","value","style","position","opacity","body","appendChild","focus","select","result","execCommand","console","log","error","removeChild","download","filename","a","setAttribute","encodeURIComponent","display","click","formatStep","step","formatOneStep","name","x","y","anchorPath","toString","anchorOffset","focusPath","focusOffset","formattedStep","count","join","isSelectAll","event","keyCode","metaKey","ctrlKey","sanitizeSelection","selection","anchorNode","focusNode","getPathFromNodeToEditor","node","rootElement","currentNode","path","undefined","unshift","Array","from","parentNode","childNodes","indexOf","keyPresses","Set","useTestRecorder","editor","steps","setSteps","isRecording","setIsRecording","setCurrentInnerHTML","templatedTest","setTemplatedTest","previousSelectionRef","skipNextSelectionChangeRef","preRef","getCurrentEditor","generateTestContent","getRootElement","browserSelection","window","getSelection","contains","map","pushStep","currentSteps","currentIndex","length","lastStep","slice","onKeyDown","key","has","onKeyUp","registerRootListener","prevRootElement","removeEventListener","addEventListener","current","scrollTo","scrollHeight","testContent","removeUpdateListener","registerUpdateListener","dirtyElements","dirtyLeaves","editorState","currentSelection","_selection","previousSelection","skipNextSelectionChange","size","innerHTML","toggleEditorSelection","currentEditor","update","root","clear","append","currentIsRecording","onSnapshotClick","onCopyClick","onDownloadClick","button","className","id","onClick","e","preventDefault","title","type","output","div","pre","ref","TestRecorderPlugin","testRecorderButton","testRecorderOutput","Fragment","p"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,EAAEC,eAAe,EAAEC,QAAQ,QAAQ,UAAS;AACz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QACAC,OAAM;QACNC,MAAK;OACN,4BAIH,oBAACG;QAAIR,IAAG;QAAgBS,KAAK3D;OAC1BJ,kBAGH;IAEJ,OAAO;QAACoD;QAAQQ;KAAO;AACzB;AACA,OAAO,MAAMI,qBAA+B;IAC1C,MAAM,CAACtE,OAAO,GAAG3E;IACjB,MAAM,CAACkJ,oBAAoBC,mBAAmB,GAAGzE,gBAAgBC;IAEjE,qBACE,oBAACvE,MAAMgJ,QAAQ,sBACb,oBAACC,WAAE,OACFH,oBACAC,kCACD,oBAACE,WAAE;AAGT,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/field/features/debug/testRecorder/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $createParagraphNode, $createTextNode, $getRoot } from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\n\nimport { IS_APPLE } from '../../../../lexical/utils/environment.js'\nimport './index.scss'\n\nconst copy = (text: null | string) => {\n const textArea = document.createElement('textarea')\n textArea.value = text || ''\n textArea.style.position = 'absolute'\n textArea.style.opacity = '0'\n document.body?.appendChild(textArea)\n textArea.focus()\n textArea.select()\n try {\n const result = document.execCommand('copy')\n // eslint-disable-next-line no-console\n console.log(result)\n } catch (error) {\n console.error(error)\n }\n document.body?.removeChild(textArea)\n}\n\nconst download = (filename: string, text: null | string) => {\n const a = document.createElement('a')\n a.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text || ''))\n a.setAttribute('download', filename)\n a.style.display = 'none'\n document.body?.appendChild(a)\n a.click()\n document.body?.removeChild(a)\n}\n\nconst formatStep = (step: Step) => {\n const formatOneStep = (name: string, value: Step['value']) => {\n switch (name) {\n case 'click': {\n return ` await page.mouse.click(${value.x}, ${value.y});`\n }\n case 'press': {\n return ` await page.keyboard.press('${value}');`\n }\n case 'keydown': {\n return ` await page.keyboard.keydown('${value}');`\n }\n case 'keyup': {\n return ` await page.keyboard.keyup('${value}');`\n }\n case 'type': {\n return ` await page.keyboard.type('${value}');`\n }\n case 'selectAll': {\n return ` await selectAll(page);`\n }\n case 'snapshot': {\n return ` await assertHTMLSnapshot(page);\n await assertSelection(page, {\n anchorPath: [${value.anchorPath.toString()}],\n anchorOffset: ${value.anchorOffset},\n focusPath: [${value.focusPath.toString()}],\n focusOffset: ${value.focusOffset},\n });\n`\n }\n default:\n return ``\n }\n }\n const formattedStep = formatOneStep(step.name, step.value)\n switch (step.count) {\n case 1:\n return formattedStep\n case 2:\n return [formattedStep, formattedStep].join(`\\n`)\n default:\n return ` await repeat(${step.count}, async () => {\n ${formattedStep}\n );`\n }\n}\n\nexport function isSelectAll(event: KeyboardEvent): boolean {\n return event.keyCode === 65 && (IS_APPLE ? event.metaKey : event.ctrlKey)\n}\n\n// stolen from LexicalSelection-test\nfunction sanitizeSelection(selection: Selection) {\n const { anchorNode, focusNode } = selection\n let { anchorOffset, focusOffset } = selection\n if (anchorOffset !== 0) {\n anchorOffset--\n }\n if (focusOffset !== 0) {\n focusOffset--\n }\n return { anchorNode, anchorOffset, focusNode, focusOffset }\n}\n\nfunction getPathFromNodeToEditor(node: Node, rootElement: HTMLElement | null) {\n let currentNode: Node | null | undefined = node\n const path = []\n while (currentNode !== rootElement) {\n if (currentNode !== null && currentNode !== undefined) {\n path.unshift(\n Array.from(currentNode?.parentNode?.childNodes ?? []).indexOf(currentNode as ChildNode),\n )\n }\n currentNode = currentNode?.parentNode\n }\n return path\n}\n\nconst keyPresses = new Set([\n 'Enter',\n 'Backspace',\n 'Delete',\n 'Escape',\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n])\n\ntype Step = {\n count: number\n name: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any\n}\n\ntype Steps = Step[]\n\nfunction useTestRecorder(editor: LexicalEditor): [JSX.Element, JSX.Element | null] {\n const [steps, setSteps] = useState<Steps>([])\n const [isRecording, setIsRecording] = useState(false)\n const [, setCurrentInnerHTML] = useState('')\n const [templatedTest, setTemplatedTest] = useState('')\n const previousSelectionRef = useRef<BaseSelection | null>(null)\n const skipNextSelectionChangeRef = useRef(false)\n const preRef = useRef<HTMLPreElement>(null)\n\n const getCurrentEditor = useCallback(() => {\n return editor\n }, [editor])\n\n const generateTestContent = useCallback(() => {\n const rootElement = editor.getRootElement()\n const browserSelection = window.getSelection()\n\n if (\n rootElement == null ||\n browserSelection == null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null ||\n !rootElement.contains(browserSelection.anchorNode) ||\n !rootElement.contains(browserSelection.focusNode)\n ) {\n return null\n }\n\n return `\nimport {\n initializeE2E,\n assertHTMLSnapshot,\n assertSelection,\n repeat,\n} from '../utils';\nimport {selectAll} from '../keyboardShortcuts';\nimport { RangeSelection } from 'lexical';\nimport { NodeSelection } from 'lexical';\n\ndescribe('Test case', () => {\n initializeE2E((e2e) => {\n it('Should pass this test', async () => {\n const {page} = e2e;\n\n await page.focus('div[contenteditable=\"true\"]');\n${steps.map(formatStep).join(`\\n`)}\n });\n});\n `\n }, [editor, steps])\n\n // just a wrapper around inserting new actions so that we can\n // coalesce some actions like insertText/moveNativeSelection\n const pushStep = useCallback(\n (name: string, value: Step['value']) => {\n setSteps((currentSteps) => {\n // trying to group steps\n const currentIndex = steps.length - 1\n const lastStep = steps[currentIndex]\n if (lastStep) {\n if (lastStep.name === name) {\n if (name === 'type') {\n // for typing events we just append the text\n return [\n ...steps.slice(0, currentIndex),\n { ...lastStep, value: lastStep.value + value },\n ]\n } else {\n // for other events we bump the counter if their values are the same\n if (lastStep.value === value) {\n return [...steps.slice(0, currentIndex), { ...lastStep, count: lastStep.count + 1 }]\n }\n }\n }\n }\n // could not group, just append a new one\n return [...currentSteps, { name, count: 1, value }]\n })\n },\n [steps, setSteps],\n )\n\n useLayoutEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (isSelectAll(event)) {\n pushStep('selectAll', '')\n } else if (keyPresses.has(key)) {\n pushStep('press', event.key)\n } else if ([...key].length > 1) {\n pushStep('keydown', event.key)\n } else {\n pushStep('type', event.key)\n }\n }\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (!keyPresses.has(key) && [...key].length > 1) {\n pushStep('keyup', event.key)\n }\n }\n\n return editor.registerRootListener(\n (rootElement: HTMLElement | null, prevRootElement: HTMLElement | null) => {\n if (prevRootElement !== null) {\n prevRootElement.removeEventListener('keydown', onKeyDown)\n prevRootElement.removeEventListener('keyup', onKeyUp)\n }\n if (rootElement !== null) {\n rootElement.addEventListener('keydown', onKeyDown)\n rootElement.addEventListener('keyup', onKeyUp)\n }\n },\n )\n }, [editor, isRecording, pushStep])\n\n useLayoutEffect(() => {\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }, [generateTestContent])\n\n useEffect(() => {\n if (steps) {\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }\n }, [generateTestContent, steps])\n\n useEffect(() => {\n const removeUpdateListener = editor.registerUpdateListener(\n ({ dirtyElements, dirtyLeaves, editorState }) => {\n if (!isRecording) {\n return\n }\n const currentSelection = editorState._selection\n const previousSelection = previousSelectionRef.current\n const skipNextSelectionChange = skipNextSelectionChangeRef.current\n if (previousSelection !== currentSelection) {\n if (dirtyLeaves.size === 0 && dirtyElements.size === 0 && !skipNextSelectionChange) {\n const browserSelection = window.getSelection()\n if (\n browserSelection &&\n (browserSelection.anchorNode == null || browserSelection.focusNode == null)\n ) {\n return\n }\n }\n previousSelectionRef.current = currentSelection\n }\n skipNextSelectionChangeRef.current = false\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n },\n )\n return removeUpdateListener\n }, [editor, generateTestContent, isRecording, pushStep])\n\n // save innerHTML\n useEffect(() => {\n if (!isRecording) {\n return\n }\n const removeUpdateListener = editor.registerUpdateListener(() => {\n const rootElement = editor.getRootElement()\n if (rootElement !== null) {\n setCurrentInnerHTML(rootElement?.innerHTML)\n }\n })\n return removeUpdateListener\n }, [editor, isRecording])\n\n // clear editor and start recording\n const toggleEditorSelection = useCallback(\n (currentEditor: LexicalEditor) => {\n if (!isRecording) {\n currentEditor.update(() => {\n const root = $getRoot()\n root.clear()\n const text = $createTextNode()\n root.append($createParagraphNode().append(text))\n text.select()\n })\n setSteps([])\n }\n setIsRecording((currentIsRecording) => !currentIsRecording)\n },\n [isRecording],\n )\n\n const onSnapshotClick = useCallback(() => {\n if (!isRecording) {\n return\n }\n const browserSelection = window.getSelection()\n if (\n browserSelection === null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null\n ) {\n return\n }\n const { anchorNode, anchorOffset, focusNode, focusOffset } = sanitizeSelection(browserSelection)\n const rootElement = getCurrentEditor().getRootElement()\n let anchorPath\n if (anchorNode !== null) {\n anchorPath = getPathFromNodeToEditor(anchorNode, rootElement)\n }\n let focusPath\n if (focusNode !== null) {\n focusPath = getPathFromNodeToEditor(focusNode, rootElement)\n }\n pushStep('snapshot', {\n anchorNode,\n anchorOffset,\n anchorPath,\n focusNode,\n focusOffset,\n focusPath,\n })\n }, [pushStep, isRecording, getCurrentEditor])\n\n const onCopyClick = useCallback(() => {\n copy(generateTestContent())\n }, [generateTestContent])\n\n const onDownloadClick = useCallback(() => {\n download('test.js', generateTestContent())\n }, [generateTestContent])\n\n const button = (\n <button\n className={`editor-dev-button ${isRecording ? 'active' : ''}`}\n id=\"test-recorder-button\"\n onClick={(e) => {\n toggleEditorSelection(getCurrentEditor())\n e.preventDefault()\n }}\n title={isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n type=\"button\"\n >\n {isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n </button>\n )\n const output = isRecording ? (\n <div className=\"test-recorder-output\">\n <div className=\"test-recorder-toolbar\">\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-snapshot\"\n onClick={(e) => {\n onSnapshotClick()\n e.preventDefault()\n }}\n title=\"Insert snapshot\"\n type=\"button\"\n >\n Insert Snapshot\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-copy\"\n onClick={(e) => {\n onCopyClick()\n e.preventDefault()\n }}\n title=\"Copy to clipboard\"\n type=\"button\"\n >\n Copy\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-download\"\n onClick={(e) => {\n onDownloadClick()\n e.preventDefault()\n }}\n title=\"Download as a file\"\n type=\"button\"\n >\n Download\n </button>\n </div>\n <pre id=\"test-recorder\" ref={preRef}>\n {templatedTest}\n </pre>\n </div>\n ) : null\n\n return [button, output]\n}\nexport const TestRecorderPlugin: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const [testRecorderButton, testRecorderOutput] = useTestRecorder(editor)\n\n return (\n <React.Fragment>\n <p>HI</p>\n {testRecorderButton}\n {testRecorderOutput}\n <p>DONE</p>\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","$createParagraphNode","$createTextNode","$getRoot","React","useCallback","useEffect","useLayoutEffect","useRef","useState","IS_APPLE","copy","text","textArea","document","createElement","value","style","position","opacity","body","appendChild","focus","select","result","execCommand","console","log","error","removeChild","download","filename","a","setAttribute","encodeURIComponent","display","click","formatStep","step","formatOneStep","name","x","y","anchorPath","toString","anchorOffset","focusPath","focusOffset","formattedStep","count","join","isSelectAll","event","keyCode","metaKey","ctrlKey","sanitizeSelection","selection","anchorNode","focusNode","getPathFromNodeToEditor","node","rootElement","currentNode","path","undefined","unshift","Array","from","parentNode","childNodes","indexOf","keyPresses","Set","useTestRecorder","editor","steps","setSteps","isRecording","setIsRecording","setCurrentInnerHTML","templatedTest","setTemplatedTest","previousSelectionRef","skipNextSelectionChangeRef","preRef","getCurrentEditor","generateTestContent","getRootElement","browserSelection","window","getSelection","contains","map","pushStep","currentSteps","currentIndex","length","lastStep","slice","onKeyDown","key","has","onKeyUp","registerRootListener","prevRootElement","removeEventListener","addEventListener","current","scrollTo","scrollHeight","testContent","removeUpdateListener","registerUpdateListener","dirtyElements","dirtyLeaves","editorState","currentSelection","_selection","previousSelection","skipNextSelectionChange","size","innerHTML","toggleEditorSelection","currentEditor","update","root","clear","append","currentIsRecording","onSnapshotClick","onCopyClick","onDownloadClick","button","className","id","onClick","e","preventDefault","title","type","output","div","pre","ref","TestRecorderPlugin","testRecorderButton","testRecorderOutput","Fragment","p"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,EAAEC,eAAe,EAAEC,QAAQ,QAAQ,UAAS;AACzE,YAAYC,WAAW,QAAO;AAC9B,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAEjF,SAASC,QAAQ,QAAQ,2CAA0C;AACnE,OAAO,eAAc;AAErB,MAAMC,OAAO,CAACC;IACZ,MAAMC,WAAWC,SAASC,aA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AoBC,mBAAmB,GAAGzE,gBAAgBC;IAEjE,qBACE,oBAACvE,MAAMgJ,QAAQ,sBACb,oBAACC,WAAE,OACFH,oBACAC,kCACD,oBAACE,WAAE;AAGT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/treeview/feature.client.tsx"],"names":[],"mappings":";AAqBA,eAAO,MAAM,8BAA8B,+BAA+C,CAAA"}
1
+ {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/treeView/feature.client.tsx"],"names":[],"mappings":";AAqBA,eAAO,MAAM,8BAA8B,+BAA+C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/debug/treeview/feature.client.tsx"],"sourcesContent":["'use client'\nimport type { FeatureProviderProviderClient } from '../../types.js'\n\nimport { createClientComponent } from '../../createClientComponent.js'\nimport { TreeViewPlugin } from './plugin/index.js'\n\nconst TreeViewFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n plugins: [\n {\n Component: TreeViewPlugin,\n position: 'bottom',\n },\n ],\n }),\n }\n}\n\nexport const TreeViewFeatureClientComponent = createClientComponent(TreeViewFeatureClient)\n"],"names":["createClientComponent","TreeViewPlugin","TreeViewFeatureClient","props","clientFeatureProps","feature","plugins","Component","position","TreeViewFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,qBAAqB,QAAQ,iCAAgC;AACtE,SAASC,cAAc,QAAQ,oBAAmB;AAElD,MAAMC,wBAAkE,CAACC;IACvE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,SAAS;oBACP;wBACEC,WAAWN;wBACXO,UAAU;oBACZ;iBACD;YACH,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,iCAAiCT,sBAAsBE,uBAAsB"}
1
+ {"version":3,"sources":["../../../../../src/field/features/debug/treeView/feature.client.tsx"],"sourcesContent":["'use client'\nimport type { FeatureProviderProviderClient } from '../../types.js'\n\nimport { createClientComponent } from '../../createClientComponent.js'\nimport { TreeViewPlugin } from './plugin/index.js'\n\nconst TreeViewFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n plugins: [\n {\n Component: TreeViewPlugin,\n position: 'bottom',\n },\n ],\n }),\n }\n}\n\nexport const TreeViewFeatureClientComponent = createClientComponent(TreeViewFeatureClient)\n"],"names":["createClientComponent","TreeViewPlugin","TreeViewFeatureClient","props","clientFeatureProps","feature","plugins","Component","position","TreeViewFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,qBAAqB,QAAQ,iCAAgC;AACtE,SAASC,cAAc,QAAQ,oBAAmB;AAElD,MAAMC,wBAAkE,CAACC;IACvE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,SAAS;oBACP;wBACEC,WAAWN;wBACXO,UAAU;oBACZ;iBACD;YACH,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,iCAAiCT,sBAAsBE,uBAAsB"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/treeview/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAInE,eAAO,MAAM,eAAe,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAW/E,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/treeView/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAInE,eAAO,MAAM,eAAe,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAW/E,CAAA"}
@@ -7,7 +7,7 @@ export const TreeViewFeature = (props)=>{
7
7
  serverFeatureProps: props
8
8
  };
9
9
  },
10
- key: 'treeview',
10
+ key: 'treeView',
11
11
  serverFeatureProps: props
12
12
  };
13
13
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/debug/treeview/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { TreeViewFeatureClientComponent } from './feature.client.js'\n\nexport const TreeViewFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: TreeViewFeatureClientComponent,\n serverFeatureProps: props,\n }\n },\n key: 'treeview',\n serverFeatureProps: props,\n }\n}\n"],"names":["TreeViewFeatureClientComponent","TreeViewFeature","props","feature","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAEA,SAASA,8BAA8B,QAAQ,sBAAqB;AAEpE,OAAO,MAAMC,kBAAuE,CAACC;IACnF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoBH;YACtB;QACF;QACAI,KAAK;QACLD,oBAAoBH;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/debug/treeView/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { TreeViewFeatureClientComponent } from './feature.client.js'\n\nexport const TreeViewFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: TreeViewFeatureClientComponent,\n serverFeatureProps: props,\n }\n },\n key: 'treeView',\n serverFeatureProps: props,\n }\n}\n"],"names":["TreeViewFeatureClientComponent","TreeViewFeature","props","feature","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAEA,SAASA,8BAA8B,QAAQ,sBAAqB;AAEpE,OAAO,MAAMC,kBAAuE,CAACC;IACnF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoBH;YACtB;QACF;QACAI,KAAK;QACLD,oBAAoBH;IACtB;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/debug/treeview/plugin/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,cAAc,CAAA;AAErB,wBAAgB,cAAc,IAAI,KAAK,CAAC,SAAS,CAahD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/debug/treeView/plugin/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,cAAc,CAAA;AAErB,wBAAgB,cAAc,IAAI,KAAK,CAAC,SAAS,CAahD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/field/features/debug/treeview/plugin/index.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { TreeView } from '@lexical/react/LexicalTreeView.js'\nimport * as React from 'react'\n\nimport './index.scss'\n\nexport function TreeViewPlugin(): React.ReactNode {\n const [editor] = useLexicalComposerContext()\n return (\n <TreeView\n editor={editor}\n timeTravelButtonClassName=\"debug-timetravel-button\"\n timeTravelPanelButtonClassName=\"debug-timetravel-panel-button\"\n timeTravelPanelClassName=\"debug-timetravel-panel\"\n timeTravelPanelSliderClassName=\"debug-timetravel-panel-slider\"\n treeTypeButtonClassName=\"debug-treetype-button\"\n viewClassName=\"tree-view-output\"\n />\n )\n}\n"],"names":["useLexicalComposerContext","TreeView","React","TreeViewPlugin","editor","timeTravelButtonClassName","timeTravelPanelButtonClassName","timeTravelPanelClassName","timeTravelPanelSliderClassName","treeTypeButtonClassName","viewClassName"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,QAAQ,QAAQ,oCAAmC;AAC5D,YAAYC,WAAW,QAAO;AAE9B,OAAO,eAAc;AAErB,OAAO,SAASC;IACd,MAAM,CAACC,OAAO,GAAGJ;IACjB,qBACE,oBAACC;QACCG,QAAQA;QACRC,2BAA0B;QAC1BC,gCAA+B;QAC/BC,0BAAyB;QACzBC,gCAA+B;QAC/BC,yBAAwB;QACxBC,eAAc;;AAGpB"}
1
+ {"version":3,"sources":["../../../../../../src/field/features/debug/treeView/plugin/index.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { TreeView } from '@lexical/react/LexicalTreeView.js'\nimport * as React from 'react'\n\nimport './index.scss'\n\nexport function TreeViewPlugin(): React.ReactNode {\n const [editor] = useLexicalComposerContext()\n return (\n <TreeView\n editor={editor}\n timeTravelButtonClassName=\"debug-timetravel-button\"\n timeTravelPanelButtonClassName=\"debug-timetravel-panel-button\"\n timeTravelPanelClassName=\"debug-timetravel-panel\"\n timeTravelPanelSliderClassName=\"debug-timetravel-panel-slider\"\n treeTypeButtonClassName=\"debug-treetype-button\"\n viewClassName=\"tree-view-output\"\n />\n )\n}\n"],"names":["useLexicalComposerContext","TreeView","React","TreeViewPlugin","editor","timeTravelButtonClassName","timeTravelPanelButtonClassName","timeTravelPanelClassName","timeTravelPanelSliderClassName","treeTypeButtonClassName","viewClassName"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,QAAQ,QAAQ,oCAAmC;AAC5D,YAAYC,WAAW,QAAO;AAE9B,OAAO,eAAc;AAErB,OAAO,SAASC;IACd,MAAM,CAACC,OAAO,GAAGJ;IACjB,qBACE,oBAACC;QACCG,QAAQA;QACRC,2BAA0B;QAC1BC,gCAA+B;QAC/BC,0BAAyB;QACzBC,gCAA+B;QAC/BC,yBAAwB;QACxBC,eAAc;;AAGpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/bold/feature.client.tsx"],"names":[],"mappings":";AAoDA,eAAO,MAAM,0BAA0B,+BAA2C,CAAA"}
1
+ {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/bold/feature.client.tsx"],"names":[],"mappings":";AA0DA,eAAO,MAAM,0BAA0B,+BAA2C,CAAA"}
@@ -2,8 +2,26 @@
2
2
  import { $isRangeSelection, FORMAT_TEXT_COMMAND } from 'lexical';
3
3
  import { BoldIcon } from '../../../lexical/ui/icons/Bold/index.js';
4
4
  import { createClientComponent } from '../../createClientComponent.js';
5
- import { SectionWithEntries } from '../common/floatingSelectToolbarSection.js';
5
+ import { toolbarFormatGroupWithItems } from '../shared/toolbarFormatGroup.js';
6
6
  import { BOLD_ITALIC_STAR, BOLD_ITALIC_UNDERSCORE, BOLD_STAR, BOLD_UNDERSCORE } from './markdownTransformers.js';
7
+ const toolbarGroups = [
8
+ toolbarFormatGroupWithItems([
9
+ {
10
+ ChildComponent: BoldIcon,
11
+ isActive: ({ selection })=>{
12
+ if ($isRangeSelection(selection)) {
13
+ return selection.hasFormat('bold');
14
+ }
15
+ return false;
16
+ },
17
+ key: 'bold',
18
+ onSelect: ({ editor })=>{
19
+ editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'bold');
20
+ },
21
+ order: 1
22
+ }
23
+ ])
24
+ ];
7
25
  const BoldFeatureClient = (props)=>{
8
26
  return {
9
27
  clientFeatureProps: props,
@@ -17,27 +35,13 @@ const BoldFeatureClient = (props)=>{
17
35
  }
18
36
  return {
19
37
  clientFeatureProps: props,
20
- floatingSelectToolbar: {
21
- sections: [
22
- SectionWithEntries([
23
- {
24
- ChildComponent: BoldIcon,
25
- isActive: ({ selection })=>{
26
- if ($isRangeSelection(selection)) {
27
- return selection.hasFormat('bold');
28
- }
29
- return false;
30
- },
31
- key: 'bold',
32
- onClick: ({ editor })=>{
33
- editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'bold');
34
- },
35
- order: 1
36
- }
37
- ])
38
- ]
38
+ markdownTransformers,
39
+ toolbarFixed: {
40
+ groups: toolbarGroups
39
41
  },
40
- markdownTransformers
42
+ toolbarInline: {
43
+ groups: toolbarGroups
44
+ }
41
45
  };
42
46
  }
43
47
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/format/bold/feature.client.tsx"],"sourcesContent":["'use client'\nimport { $isRangeSelection, FORMAT_TEXT_COMMAND } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../../types.js'\n\nimport { BoldIcon } from '../../../lexical/ui/icons/Bold/index.js'\nimport { createClientComponent } from '../../createClientComponent.js'\nimport { SectionWithEntries } from '../common/floatingSelectToolbarSection.js'\nimport {\n BOLD_ITALIC_STAR,\n BOLD_ITALIC_UNDERSCORE,\n BOLD_STAR,\n BOLD_UNDERSCORE,\n} from './markdownTransformers.js'\n\nconst BoldFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: ({ featureProviderMap }) => {\n const markdownTransformers = [BOLD_STAR, BOLD_UNDERSCORE]\n if (featureProviderMap.get('italic')) {\n markdownTransformers.push(BOLD_ITALIC_UNDERSCORE, BOLD_ITALIC_STAR)\n }\n\n return {\n clientFeatureProps: props,\n floatingSelectToolbar: {\n sections: [\n SectionWithEntries([\n {\n ChildComponent: BoldIcon,\n isActive: ({ selection }) => {\n if ($isRangeSelection(selection)) {\n return selection.hasFormat('bold')\n }\n return false\n },\n key: 'bold',\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'bold')\n },\n order: 1,\n },\n ]),\n ],\n },\n markdownTransformers,\n }\n },\n }\n}\n\nexport const BoldFeatureClientComponent = createClientComponent(BoldFeatureClient)\n"],"names":["$isRangeSelection","FORMAT_TEXT_COMMAND","BoldIcon","createClientComponent","SectionWithEntries","BOLD_ITALIC_STAR","BOLD_ITALIC_UNDERSCORE","BOLD_STAR","BOLD_UNDERSCORE","BoldFeatureClient","props","clientFeatureProps","feature","featureProviderMap","markdownTransformers","get","push","floatingSelectToolbar","sections","ChildComponent","isActive","selection","hasFormat","key","onClick","editor","dispatchCommand","order","BoldFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,iBAAiB,EAAEC,mBAAmB,QAAQ,UAAS;AAIhE,SAASC,QAAQ,QAAQ,0CAAyC;AAClE,SAASC,qBAAqB,QAAQ,iCAAgC;AACtE,SAASC,kBAAkB,QAAQ,4CAA2C;AAC9E,SACEC,gBAAgB,EAChBC,sBAAsB,EACtBC,SAAS,EACTC,eAAe,QACV,4BAA2B;AAElC,MAAMC,oBAA8D,CAACC;IACnE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,CAAC,EAAEC,kBAAkB,EAAE;YAC9B,MAAMC,uBAAuB;gBAACP;gBAAWC;aAAgB;YACzD,IAAIK,mBAAmBE,GAAG,CAAC,WAAW;gBACpCD,qBAAqBE,IAAI,CAACV,wBAAwBD;YACpD;YAEA,OAAO;gBACLM,oBAAoBD;gBACpBO,uBAAuB;oBACrBC,UAAU;wBACRd,mBAAmB;4BACjB;gCACEe,gBAAgBjB;gCAChBkB,UAAU,CAAC,EAAEC,SAAS,EAAE;oCACtB,IAAIrB,kBAAkBqB,YAAY;wCAChC,OAAOA,UAAUC,SAAS,CAAC;oCAC7B;oCACA,OAAO;gCACT;gCACAC,KAAK;gCACLC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,eAAe,CAACzB,qBAAqB;gCAC9C;gCACA0B,OAAO;4BACT;yBACD;qBACF;gBACH;gBACAb;YACF;QACF;IACF;AACF;AAEA,OAAO,MAAMc,6BAA6BzB,sBAAsBM,mBAAkB"}
1
+ {"version":3,"sources":["../../../../../src/field/features/format/bold/feature.client.tsx"],"sourcesContent":["'use client'\nimport { $isRangeSelection, FORMAT_TEXT_COMMAND } from 'lexical'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../../types.js'\n\nimport { BoldIcon } from '../../../lexical/ui/icons/Bold/index.js'\nimport { createClientComponent } from '../../createClientComponent.js'\nimport { toolbarFormatGroupWithItems } from '../shared/toolbarFormatGroup.js'\nimport {\n BOLD_ITALIC_STAR,\n BOLD_ITALIC_UNDERSCORE,\n BOLD_STAR,\n BOLD_UNDERSCORE,\n} from './markdownTransformers.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarFormatGroupWithItems([\n {\n ChildComponent: BoldIcon,\n isActive: ({ selection }) => {\n if ($isRangeSelection(selection)) {\n return selection.hasFormat('bold')\n }\n return false\n },\n key: 'bold',\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'bold')\n },\n order: 1,\n },\n ]),\n]\n\nconst BoldFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: ({ featureProviderMap }) => {\n const markdownTransformers = [BOLD_STAR, BOLD_UNDERSCORE]\n if (featureProviderMap.get('italic')) {\n markdownTransformers.push(BOLD_ITALIC_UNDERSCORE, BOLD_ITALIC_STAR)\n }\n\n return {\n clientFeatureProps: props,\n markdownTransformers,\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n },\n }\n}\n\nexport const BoldFeatureClientComponent = createClientComponent(BoldFeatureClient)\n"],"names":["$isRangeSelection","FORMAT_TEXT_COMMAND","BoldIcon","createClientComponent","toolbarFormatGroupWithItems","BOLD_ITALIC_STAR","BOLD_ITALIC_UNDERSCORE","BOLD_STAR","BOLD_UNDERSCORE","toolbarGroups","ChildComponent","isActive","selection","hasFormat","key","onSelect","editor","dispatchCommand","order","BoldFeatureClient","props","clientFeatureProps","feature","featureProviderMap","markdownTransformers","get","push","toolbarFixed","groups","toolbarInline","BoldFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,SAASA,iBAAiB,EAAEC,mBAAmB,QAAQ,UAAS;AAKhE,SAASC,QAAQ,QAAQ,0CAAyC;AAClE,SAASC,qBAAqB,QAAQ,iCAAgC;AACtE,SAASC,2BAA2B,QAAQ,kCAAiC;AAC7E,SACEC,gBAAgB,EAChBC,sBAAsB,EACtBC,SAAS,EACTC,eAAe,QACV,4BAA2B;AAElC,MAAMC,gBAAgC;IACpCL,4BAA4B;QAC1B;YACEM,gBAAgBR;YAChBS,UAAU,CAAC,EAAEC,SAAS,EAAE;gBACtB,IAAIZ,kBAAkBY,YAAY;oBAChC,OAAOA,UAAUC,SAAS,CAAC;gBAC7B;gBACA,OAAO;YACT;YACAC,KAAK;YACLC,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACnBA,OAAOC,eAAe,CAAChB,qBAAqB;YAC9C;YACAiB,OAAO;QACT;KACD;CACF;AAED,MAAMC,oBAA8D,CAACC;IACnE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,CAAC,EAAEC,kBAAkB,EAAE;YAC9B,MAAMC,uBAAuB;gBAACjB;gBAAWC;aAAgB;YACzD,IAAIe,mBAAmBE,GAAG,CAAC,WAAW;gBACpCD,qBAAqBE,IAAI,CAACpB,wBAAwBD;YACpD;YAEA,OAAO;gBACLgB,oBAAoBD;gBACpBI;gBACAG,cAAc;oBACZC,QAAQnB;gBACV;gBACAoB,eAAe;oBACbD,QAAQnB;gBACV;YACF;QACF;IACF;AACF;AAEA,OAAO,MAAMqB,6BAA6B3B,sBAAsBgB,mBAAkB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/inlineCode/feature.client.tsx"],"names":[],"mappings":";AAkDA,eAAO,MAAM,gCAAgC,+BAAiD,CAAA"}
@@ -0,0 +1,46 @@
1
+ 'use client';
2
+ import { $isRangeSelection, FORMAT_TEXT_COMMAND } from 'lexical';
3
+ import { CodeIcon } from '../../../lexical/ui/icons/Code/index.js';
4
+ import { createClientComponent } from '../../createClientComponent.js';
5
+ import { toolbarFormatGroupWithItems } from '../shared/toolbarFormatGroup.js';
6
+ import { INLINE_CODE } from './markdownTransformers.js';
7
+ const toolbarGroups = [
8
+ toolbarFormatGroupWithItems([
9
+ {
10
+ ChildComponent: CodeIcon,
11
+ isActive: ({ selection })=>{
12
+ if ($isRangeSelection(selection)) {
13
+ return selection.hasFormat('code');
14
+ }
15
+ return false;
16
+ },
17
+ key: 'inlineCode',
18
+ onSelect: ({ editor })=>{
19
+ editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'code');
20
+ },
21
+ order: 7
22
+ }
23
+ ])
24
+ ];
25
+ const InlineCodeFeatureClient = (props)=>{
26
+ return {
27
+ clientFeatureProps: props,
28
+ feature: ()=>{
29
+ return {
30
+ clientFeatureProps: props,
31
+ markdownTransformers: [
32
+ INLINE_CODE
33
+ ],
34
+ toolbarFixed: {
35
+ groups: toolbarGroups
36
+ },
37
+ toolbarInline: {
38
+ groups: toolbarGroups
39
+ }
40
+ };
41
+ }
42
+ };
43
+ };
44
+ export const InlineCodeFeatureClientComponent = createClientComponent(InlineCodeFeatureClient);
45
+
46
+ //# sourceMappingURL=feature.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/field/features/format/inlineCode/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $isRangeSelection, FORMAT_TEXT_COMMAND } from 'lexical'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../../types.js'\n\nimport { CodeIcon } from '../../../lexical/ui/icons/Code/index.js'\nimport { createClientComponent } from '../../createClientComponent.js'\nimport { toolbarFormatGroupWithItems } from '../shared/toolbarFormatGroup.js'\nimport { INLINE_CODE } from './markdownTransformers.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarFormatGroupWithItems([\n {\n ChildComponent: CodeIcon,\n isActive: ({ selection }) => {\n if ($isRangeSelection(selection)) {\n return selection.hasFormat('code')\n }\n return false\n },\n key: 'inlineCode',\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'code')\n },\n order: 7,\n },\n ]),\n]\n\nconst InlineCodeFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => {\n return {\n clientFeatureProps: props,\n markdownTransformers: [INLINE_CODE],\n\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n },\n }\n}\n\nexport const InlineCodeFeatureClientComponent = createClientComponent(InlineCodeFeatureClient)\n"],"names":["$isRangeSelection","FORMAT_TEXT_COMMAND","CodeIcon","createClientComponent","toolbarFormatGroupWithItems","INLINE_CODE","toolbarGroups","ChildComponent","isActive","selection","hasFormat","key","onSelect","editor","dispatchCommand","order","InlineCodeFeatureClient","props","clientFeatureProps","feature","markdownTransformers","toolbarFixed","groups","toolbarInline","InlineCodeFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,iBAAiB,EAAEC,mBAAmB,QAAQ,UAAS;AAKhE,SAASC,QAAQ,QAAQ,0CAAyC;AAClE,SAASC,qBAAqB,QAAQ,iCAAgC;AACtE,SAASC,2BAA2B,QAAQ,kCAAiC;AAC7E,SAASC,WAAW,QAAQ,4BAA2B;AAEvD,MAAMC,gBAAgC;IACpCF,4BAA4B;QAC1B;YACEG,gBAAgBL;YAChBM,UAAU,CAAC,EAAEC,SAAS,EAAE;gBACtB,IAAIT,kBAAkBS,YAAY;oBAChC,OAAOA,UAAUC,SAAS,CAAC;gBAC7B;gBACA,OAAO;YACT;YACAC,KAAK;YACLC,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACnBA,OAAOC,eAAe,CAACb,qBAAqB;YAC9C;YACAc,OAAO;QACT;KACD;CACF;AAED,MAAMC,0BAAoE,CAACC;IACzE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS;YACP,OAAO;gBACLD,oBAAoBD;gBACpBG,sBAAsB;oBAACf;iBAAY;gBAEnCgB,cAAc;oBACZC,QAAQhB;gBACV;gBACAiB,eAAe;oBACbD,QAAQhB;gBACV;YACF;QACF;IACF;AACF;AAEA,OAAO,MAAMkB,mCAAmCrB,sBAAsBa,yBAAwB"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/inlinecode/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAKnE,eAAO,MAAM,iBAAiB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAYjF,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/inlineCode/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAKnE,eAAO,MAAM,iBAAiB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAYjF,CAAA"}
@@ -11,7 +11,7 @@ export const InlineCodeFeature = (props)=>{
11
11
  serverFeatureProps: props
12
12
  };
13
13
  },
14
- key: 'inlinecode',
14
+ key: 'inlineCode',
15
15
  serverFeatureProps: props
16
16
  };
17
17
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/format/inlinecode/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { InlineCodeFeatureClientComponent } from './feature.client.js'\nimport { INLINE_CODE } from './markdownTransformers.js'\n\nexport const InlineCodeFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: InlineCodeFeatureClientComponent,\n markdownTransformers: [INLINE_CODE],\n serverFeatureProps: props,\n }\n },\n key: 'inlinecode',\n serverFeatureProps: props,\n }\n}\n"],"names":["InlineCodeFeatureClientComponent","INLINE_CODE","InlineCodeFeature","props","feature","ClientComponent","markdownTransformers","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,gCAAgC,QAAQ,sBAAqB;AACtE,SAASC,WAAW,QAAQ,4BAA2B;AAEvD,OAAO,MAAMC,oBAAyE,CAACC;IACrF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBL;gBACjBM,sBAAsB;oBAACL;iBAAY;gBACnCM,oBAAoBJ;YACtB;QACF;QACAK,KAAK;QACLD,oBAAoBJ;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/format/inlineCode/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { InlineCodeFeatureClientComponent } from './feature.client.js'\nimport { INLINE_CODE } from './markdownTransformers.js'\n\nexport const InlineCodeFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: InlineCodeFeatureClientComponent,\n markdownTransformers: [INLINE_CODE],\n serverFeatureProps: props,\n }\n },\n key: 'inlineCode',\n serverFeatureProps: props,\n }\n}\n"],"names":["InlineCodeFeatureClientComponent","INLINE_CODE","InlineCodeFeature","props","feature","ClientComponent","markdownTransformers","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,gCAAgC,QAAQ,sBAAqB;AACtE,SAASC,WAAW,QAAQ,4BAA2B;AAEvD,OAAO,MAAMC,oBAAyE,CAACC;IACrF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBL;gBACjBM,sBAAsB;oBAACL;iBAAY;gBACnCM,oBAAoBJ;YACtB;QACF;QACAK,KAAK;QACLD,oBAAoBJ;IACtB;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTransformers.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/inlinecode/markdownTransformers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE9D,eAAO,MAAM,WAAW,EAAE,qBAIzB,CAAA"}
1
+ {"version":3,"file":"markdownTransformers.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/inlineCode/markdownTransformers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE9D,eAAO,MAAM,WAAW,EAAE,qBAIzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/format/inlinecode/markdownTransformers.ts"],"sourcesContent":["import type { TextFormatTransformer } from '@lexical/markdown'\n\nexport const INLINE_CODE: TextFormatTransformer = {\n type: 'text-format',\n format: ['code'],\n tag: '`',\n}\n"],"names":["INLINE_CODE","type","format","tag"],"rangeMappings":";;;;;;","mappings":"AAEA,OAAO,MAAMA,cAAqC;IAChDC,MAAM;IACNC,QAAQ;QAAC;KAAO;IAChBC,KAAK;AACP,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/format/inlineCode/markdownTransformers.ts"],"sourcesContent":["import type { TextFormatTransformer } from '@lexical/markdown'\n\nexport const INLINE_CODE: TextFormatTransformer = {\n type: 'text-format',\n format: ['code'],\n tag: '`',\n}\n"],"names":["INLINE_CODE","type","format","tag"],"rangeMappings":";;;;;;","mappings":"AAEA,OAAO,MAAMA,cAAqC;IAChDC,MAAM;IACNC,QAAQ;QAAC;KAAO;IAChBC,KAAK;AACP,EAAC"}