@payloadcms/richtext-lexical 4.0.0-internal.314c594 → 4.0.0-internal.31ba7ee

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 (241) hide show
  1. package/dist/exports/client/Field-TCOK744G.js +2 -0
  2. package/dist/exports/client/Field-TCOK744G.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
  5. package/dist/exports/client/{chunk-LN6VX25I.js.map → chunk-3LRZDIIG.js.map} +2 -2
  6. package/dist/exports/client/{chunk-ESITTE3C.js → chunk-ZFGDYZDE.js} +2 -2
  7. package/dist/exports/client/{chunk-ESITTE3C.js.map → chunk-ZFGDYZDE.js.map} +2 -2
  8. package/dist/exports/client/componentInline-55HZXGUS.js +2 -0
  9. package/dist/exports/client/index.js +23 -23
  10. package/dist/exports/client/index.js.map +4 -4
  11. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  12. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  13. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  14. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  15. package/dist/features/blocks/client/component/index.d.ts +0 -6
  16. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  17. package/dist/features/blocks/client/component/index.js +133 -76
  18. package/dist/features/blocks/client/component/index.js.map +1 -1
  19. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  20. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  21. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  22. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  23. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  24. package/dist/features/blocks/client/componentInline/index.js +2 -2
  25. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  26. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  27. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  28. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  29. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  30. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  31. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  32. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  33. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  34. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  35. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  36. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  37. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  38. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  39. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  40. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  41. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  42. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  43. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  44. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  45. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  46. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  47. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  48. package/dist/features/heading/constants.d.ts +2 -0
  49. package/dist/features/heading/constants.d.ts.map +1 -0
  50. package/dist/features/heading/constants.js +2 -0
  51. package/dist/features/heading/constants.js.map +1 -0
  52. package/dist/features/heading/server/index.d.ts.map +1 -1
  53. package/dist/features/heading/server/index.js +5 -1
  54. package/dist/features/heading/server/index.js.map +1 -1
  55. package/dist/features/heading/server/validate.d.ts +6 -0
  56. package/dist/features/heading/server/validate.d.ts.map +1 -0
  57. package/dist/features/heading/server/validate.js +15 -0
  58. package/dist/features/heading/server/validate.js.map +1 -0
  59. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  60. package/dist/features/indent/client/IndentPlugin.js +122 -1
  61. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  62. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  63. package/dist/features/indent/server/i18n.js +74 -37
  64. package/dist/features/indent/server/i18n.js.map +1 -1
  65. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  66. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +8 -5
  67. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  68. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  69. package/dist/features/lists/checklist/server/index.js +5 -2
  70. package/dist/features/lists/checklist/server/index.js.map +1 -1
  71. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  72. package/dist/features/lists/orderedList/server/index.js +5 -2
  73. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  74. package/dist/features/lists/shared/constants.d.ts +2 -0
  75. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  76. package/dist/features/lists/shared/constants.js +2 -0
  77. package/dist/features/lists/shared/constants.js.map +1 -0
  78. package/dist/features/lists/shared/validate.d.ts +5 -0
  79. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  80. package/dist/features/lists/shared/validate.js +15 -0
  81. package/dist/features/lists/shared/validate.js.map +1 -0
  82. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  83. package/dist/features/lists/unorderedList/server/index.js +5 -2
  84. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  85. package/dist/features/relationship/client/index.d.ts +2 -2
  86. package/dist/features/relationship/client/index.d.ts.map +1 -1
  87. package/dist/features/relationship/client/index.js.map +1 -1
  88. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  89. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  90. package/dist/features/relationship/client/plugins/index.js +27 -31
  91. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  92. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  93. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  94. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  95. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  96. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  97. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  98. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  99. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  100. package/dist/features/relationship/server/index.d.ts +8 -1
  101. package/dist/features/relationship/server/index.d.ts.map +1 -1
  102. package/dist/features/relationship/server/index.js +28 -11
  103. package/dist/features/relationship/server/index.js.map +1 -1
  104. package/dist/features/relationship/server/schema.d.ts +2 -2
  105. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  106. package/dist/features/relationship/server/schema.js +5 -10
  107. package/dist/features/relationship/server/schema.js.map +1 -1
  108. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  109. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  110. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  111. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  112. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  113. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  114. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  115. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  116. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  117. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js +17 -44
  118. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  119. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  120. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js +41 -18
  121. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  122. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  123. package/dist/features/toolbars/inline/client/Toolbar/index.js +2 -2
  124. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  125. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  126. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  127. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  128. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  129. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  130. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  131. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -11
  132. package/dist/features/typesServer.d.ts +13 -8
  133. package/dist/features/typesServer.d.ts.map +1 -1
  134. package/dist/features/typesServer.js.map +1 -1
  135. package/dist/features/upload/client/index.d.ts +3 -2
  136. package/dist/features/upload/client/index.d.ts.map +1 -1
  137. package/dist/features/upload/client/index.js.map +1 -1
  138. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  139. package/dist/features/upload/client/plugin/index.js +50 -53
  140. package/dist/features/upload/client/plugin/index.js.map +1 -1
  141. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  142. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  143. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  144. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  145. package/dist/features/upload/server/index.d.ts +6 -2
  146. package/dist/features/upload/server/index.d.ts.map +1 -1
  147. package/dist/features/upload/server/index.js +18 -14
  148. package/dist/features/upload/server/index.js.map +1 -1
  149. package/dist/features/upload/server/schema.d.ts +2 -2
  150. package/dist/features/upload/server/schema.d.ts.map +1 -1
  151. package/dist/features/upload/server/schema.js +4 -8
  152. package/dist/features/upload/server/schema.js.map +1 -1
  153. package/dist/features/upload/server/validate.d.ts +2 -2
  154. package/dist/features/upload/server/validate.d.ts.map +1 -1
  155. package/dist/features/upload/server/validate.js +3 -0
  156. package/dist/features/upload/server/validate.js.map +1 -1
  157. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  158. package/dist/field/Diff/converters/listitem/index.js +2 -1
  159. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  160. package/dist/field/Diff/index.d.ts +3 -2
  161. package/dist/field/Diff/index.d.ts.map +1 -1
  162. package/dist/field/Diff/index.js +1 -0
  163. package/dist/field/Diff/index.js.map +1 -1
  164. package/dist/field/RenderLexical/index.d.ts +3 -1
  165. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  166. package/dist/field/RenderLexical/index.js +23 -23
  167. package/dist/field/RenderLexical/index.js.map +1 -1
  168. package/dist/field/ViewSelector.d.ts.map +1 -1
  169. package/dist/field/ViewSelector.js +1 -0
  170. package/dist/field/ViewSelector.js.map +1 -1
  171. package/dist/field/bundled.css +1 -1
  172. package/dist/index.d.ts +1 -1
  173. package/dist/index.js +1 -1
  174. package/dist/index.js.map +1 -1
  175. package/dist/lexical/LexicalEditor.css +20 -9
  176. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  177. package/dist/lexical/LexicalEditor.js +61 -64
  178. package/dist/lexical/LexicalEditor.js.map +1 -1
  179. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
  180. package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
  181. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  182. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +2 -1
  183. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +1 -1
  184. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  185. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
  186. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  187. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  188. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +1 -0
  189. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  190. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -2
  191. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  192. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  193. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  194. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  195. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  196. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  197. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  198. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  199. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  200. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  201. package/dist/lexical/ui/ContentEditable.js +9 -6
  202. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  203. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  204. package/dist/lexical/ui/icons/H3/index.js +13 -6
  205. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  206. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  207. package/dist/lexical/ui/icons/H4/index.js +13 -6
  208. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  209. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  210. package/dist/lexical/ui/icons/H5/index.js +13 -6
  211. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  212. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  213. package/dist/lexical/ui/icons/H6/index.js +13 -6
  214. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  215. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  216. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  217. package/dist/validate/hasText.d.ts +2 -2
  218. package/dist/validate/hasText.d.ts.map +1 -1
  219. package/dist/validate/hasText.js.map +1 -1
  220. package/dist/validate/index.d.ts +1 -1
  221. package/dist/validate/index.d.ts.map +1 -1
  222. package/package.json +22 -22
  223. package/dist/dependencyChecker.spec.js +0 -16
  224. package/dist/dependencyChecker.spec.js.map +0 -1
  225. package/dist/exports/client/Field-F22V5L4V.js +0 -2
  226. package/dist/exports/client/Field-F22V5L4V.js.map +0 -7
  227. package/dist/exports/client/chunk-LN6VX25I.js +0 -2
  228. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  229. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  230. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  231. package/dist/features/link/markdownTransformer.spec.js +0 -195
  232. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  233. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js +0 -65
  234. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js.map +0 -1
  235. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  236. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  237. package/dist/lexical/utils/url.spec.js +0 -114
  238. package/dist/lexical/utils/url.spec.js.map +0 -1
  239. package/dist/utilities/jsx/jsx.spec.js +0 -178
  240. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  241. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-55HZXGUS.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AdapterProps, LexicalEditorProps, LexicalRichTextAdapterProvider } from './types/index.js';
2
- export declare const lexicalTargetVersion = "0.48.0";
2
+ export declare const lexicalTargetVersion = "0.52.0";
3
3
  export declare function lexicalEditor(args?: LexicalEditorProps): LexicalRichTextAdapterProvider;
4
4
  export { AlignFeature } from './features/align/server/index.js';
5
5
  export { BlockquoteFeature } from './features/blockquote/server/index.js';
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { getGenerateSchemaMap } from './utilities/generateSchemaMap.js';
10
10
  import { getDefaultSanitizedEditorConfig } from './utilities/getDefaultSanitizedEditorConfig.js';
11
11
  import { richTextValidateHOC } from './validate/index.js';
12
12
  let checkedDependencies = false;
13
- export const lexicalTargetVersion = '0.48.0';
13
+ export const lexicalTargetVersion = '0.52.0';
14
14
  export function lexicalEditor(args) {
15
15
  if (process.env.NODE_ENV !== 'production' && process.env.PAYLOAD_DISABLE_DEPENDENCY_CHECKER !== 'true' && !checkedDependencies) {
16
16
  checkedDependencies = true;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["checkDependencies","deepMergeSimple","getLexicalHooks","i18n","defaultEditorFeatures","populateLexicalPopulationPromises","getFieldToJSONSchema","featuresInputToEditorConfig","getGenerateImportMap","getGenerateSchemaMap","getDefaultSanitizedEditorConfig","richTextValidateHOC","checkedDependencies","lexicalTargetVersion","lexicalEditor","args","process","env","NODE_ENV","PAYLOAD_DISABLE_DEPENDENCY_CHECKER","dependencyGroups","name","dependencies","targetVersion","config","isRoot","parentIsLocalized","features","resolvedFeatureMap","finalSanitizedEditorConfig","lexical","result","sanitizedConfig","featureI18n","supportedLanguages","supportedLanguagesToMerge","_lang","lang","lexicalI18nForLang","general","translations","CellComponent","DiffComponent","editorConfig","FieldComponent","path","serverProps","admin","views","generateImportMap","lexicalEditorArgs","generateSchemaMap","graphQLPopulationPromises","context","currentDepth","depth","draft","field","fieldPromises","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","size","editorPopulationPromises","hooks","jsonSchema","validate","AlignFeature","BlockquoteFeature","CodeBlock","BlocksFeature","$createServerBlockNode","$isServerBlockNode","ServerBlockNode","$createServerInlineBlockNode","$isServerInlineBlockNode","ServerInlineBlockNode","convertHTMLToLexical","lexicalHTMLField","convertLexicalToMarkdown","convertMarkdownToLexical","getPayloadPopulateFn","getRestPopulateFn","DebugJsxConverterFeature","TestRecorderFeature","TreeViewFeature","BoldFeature","InlineCodeFeature","ItalicFeature","StrikethroughFeature","SubscriptFeature","SuperscriptFeature","UnderlineFeature","HeadingFeature","HorizontalRuleFeature","IndentFeature","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$createLinkNode","$isLinkNode","LinkNode","LinkFeature","ChecklistFeature","OrderedListFeature","UnorderedListFeature","ParagraphFeature","RelationshipFeature","RelationshipServerNode","TableFeature","defaultColors","TextStateFeature","FixedToolbarFeature","InlineToolbarFeature","createNode","UploadFeature","UploadServerNode","defaultEditorConfig","defaultEditorLexicalConfig","loadFeatures","sortFeaturesForOptimalLoading","sanitizeServerEditorConfig","sanitizeServerFeatures","getEnabledNodes","getEnabledNodesFromServerNodes","$convertFromMarkdownString","DETAIL_TYPE_TO_DETAIL","DOUBLE_LINE_BREAK","ELEMENT_FORMAT_TO_TYPE","ELEMENT_TYPE_TO_FORMAT","IS_ALL_FORMATTING","LTR_REGEX","NodeFormat","NON_BREAKING_SPACE","RTL_REGEX","TEXT_MODE_TO_TYPE","TEXT_TYPE_TO_FORMAT","TEXT_TYPE_TO_MODE","sanitizeUrl","validateUrl","defaultRichTextValue","populate","buildDefaultEditorState","buildEditorState","createServerFeature","editorConfigFactory","extractPropsFromJSXPropsString","extractFrontmatter","frontmatterToObject","objectToFrontmatter","propsToJSXString","upgradeLexicalData"],"sources":["../src/index.ts"],"sourcesContent":["import type { GenericLanguages, GenericTranslationsObject } from '@payloadcms/translations'\n\nimport { checkDependencies, deepMergeSimple } from 'payload'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\nimport type {\n AdapterProps,\n LexicalEditorProps,\n LexicalRichTextAdapterProvider,\n} from './types/index.js'\n\nimport { getLexicalHooks } from './hooks.js'\nimport { i18n } from './i18n.js'\nimport { defaultEditorFeatures } from './lexical/config/server/default.js'\nimport { populateLexicalPopulationPromises } from './populateGraphQL/populateLexicalPopulationPromises.js'\nimport { getFieldToJSONSchema } from './types/schema.js'\nimport { featuresInputToEditorConfig } from './utilities/editorConfigFactory.js'\nimport { getGenerateImportMap } from './utilities/generateImportMap.js'\nimport { getGenerateSchemaMap } from './utilities/generateSchemaMap.js'\nimport { getDefaultSanitizedEditorConfig } from './utilities/getDefaultSanitizedEditorConfig.js'\nimport { richTextValidateHOC } from './validate/index.js'\n\nlet checkedDependencies = false\n\nexport const lexicalTargetVersion = '0.48.0'\n\nexport function lexicalEditor(args?: LexicalEditorProps): LexicalRichTextAdapterProvider {\n if (\n process.env.NODE_ENV !== 'production' &&\n process.env.PAYLOAD_DISABLE_DEPENDENCY_CHECKER !== 'true' &&\n !checkedDependencies\n ) {\n checkedDependencies = true\n void checkDependencies({\n dependencyGroups: [\n {\n name: 'lexical',\n dependencies: [\n 'lexical',\n '@lexical/headless',\n '@lexical/link',\n '@lexical/list',\n '@lexical/mark',\n '@lexical/markdown',\n '@lexical/react',\n '@lexical/rich-text',\n '@lexical/selection',\n '@lexical/utils',\n ],\n targetVersion: lexicalTargetVersion,\n },\n ],\n })\n }\n return ({ config, isRoot, parentIsLocalized }) => {\n let features: FeatureProviderServer<unknown, unknown, unknown>[] = []\n let resolvedFeatureMap: ResolvedServerFeatureMap\n\n let finalSanitizedEditorConfig: SanitizedServerEditorConfig // For server only\n if (!args || (!args.features && !args.lexical)) {\n finalSanitizedEditorConfig = getDefaultSanitizedEditorConfig({\n config,\n parentIsLocalized,\n })\n\n features = defaultEditorFeatures\n\n resolvedFeatureMap = finalSanitizedEditorConfig.resolvedFeatureMap\n } else {\n const result = featuresInputToEditorConfig({\n config,\n features: args?.features,\n isRoot,\n lexical: args?.lexical,\n parentIsLocalized,\n })\n finalSanitizedEditorConfig = result.sanitizedConfig\n features = result.features\n resolvedFeatureMap = result.resolvedFeatureMap\n }\n\n const featureI18n: Partial<GenericLanguages> = finalSanitizedEditorConfig.features.i18n\n const supportedLanguages = config.i18n?.supportedLanguages\n const supportedLanguagesToMerge: Partial<GenericLanguages> = {}\n for (const _lang in supportedLanguages) {\n if (!(_lang in i18n)) {\n if (featureI18n[_lang as keyof typeof i18n]) {\n supportedLanguagesToMerge[_lang as keyof typeof i18n] =\n featureI18n[_lang as keyof typeof i18n]\n }\n continue\n }\n const lang = _lang as keyof typeof i18n\n const lexicalI18nForLang = ((featureI18n[lang] ??= {}).lexical ??=\n {}) as GenericTranslationsObject\n\n lexicalI18nForLang.general = i18n[lang] ?? {}\n supportedLanguagesToMerge[lang] = featureI18n[lang]\n }\n\n config.i18n.translations = deepMergeSimple(config.i18n.translations, supportedLanguagesToMerge)\n\n return {\n CellComponent: '@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell',\n DiffComponent: '@payloadcms/richtext-lexical/rsc#LexicalDiffComponent',\n editorConfig: finalSanitizedEditorConfig,\n features,\n FieldComponent: {\n path: '@payloadcms/richtext-lexical/rsc#RscEntryLexicalField',\n serverProps: {\n admin: args?.admin,\n views: args?.views,\n },\n },\n generateImportMap: getGenerateImportMap({\n lexicalEditorArgs: args,\n resolvedFeatureMap,\n }),\n generateSchemaMap: getGenerateSchemaMap({\n resolvedFeatureMap,\n }),\n graphQLPopulationPromises({\n context,\n currentDepth,\n depth,\n draft,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) {\n // check if there are any features with nodes which have populationPromises for this field\n if (finalSanitizedEditorConfig?.features?.graphQLPopulationPromises?.size) {\n populateLexicalPopulationPromises({\n context,\n currentDepth: currentDepth ?? 0,\n depth,\n draft,\n editorPopulationPromises: finalSanitizedEditorConfig.features.graphQLPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n },\n hooks: getLexicalHooks({\n editorConfig: finalSanitizedEditorConfig,\n }),\n jsonSchema: getFieldToJSONSchema({ editorConfig: finalSanitizedEditorConfig }),\n validate: richTextValidateHOC({\n editorConfig: finalSanitizedEditorConfig,\n }),\n }\n }\n}\n\nexport { AlignFeature } from './features/align/server/index.js'\nexport { BlockquoteFeature } from './features/blockquote/server/index.js'\nexport { CodeBlock } from './features/blocks/premade/CodeBlock/index.js'\nexport { BlocksFeature } from './features/blocks/server/index.js'\nexport type {\n BlocksFeatureProps,\n LexicalBlockClientProps,\n LexicalBlockLabelClientProps,\n LexicalBlockLabelServerProps,\n LexicalBlockServerProps,\n LexicalInlineBlockClientProps,\n LexicalInlineBlockLabelClientProps,\n LexicalInlineBlockLabelServerProps,\n LexicalInlineBlockServerProps,\n} from './features/blocks/server/index.js'\n\nexport {\n $createServerBlockNode,\n $isServerBlockNode,\n ServerBlockNode,\n} from './features/blocks/server/nodes/BlocksNode.js'\nexport {\n $createServerInlineBlockNode,\n $isServerInlineBlockNode,\n ServerInlineBlockNode,\n} from './features/blocks/server/nodes/InlineBlocksNode.js'\n\nexport type { BlockFields, InlineBlockFields } from './features/blocks/server/schema.js'\n\nexport { convertHTMLToLexical } from './features/converters/htmlToLexical/index.js'\n\nexport { lexicalHTMLField } from './features/converters/lexicalToHtml/async/field/index.js'\n\nexport { convertLexicalToMarkdown } from './features/converters/lexicalToMarkdown/index.js'\nexport { convertMarkdownToLexical } from './features/converters/markdownToLexical/index.js'\nexport { getPayloadPopulateFn } from './features/converters/utilities/payloadPopulateFn.js'\n\nexport { getRestPopulateFn } from './features/converters/utilities/restPopulateFn.js'\nexport { DebugJsxConverterFeature } from './features/debug/jsxConverter/server/index.js'\nexport { TestRecorderFeature } from './features/debug/testRecorder/server/index.js'\nexport { TreeViewFeature } from './features/debug/treeView/server/index.js'\nexport { BoldFeature } from './features/format/bold/feature.server.js'\nexport { InlineCodeFeature } from './features/format/inlineCode/feature.server.js'\nexport { ItalicFeature } from './features/format/italic/feature.server.js'\n\nexport { StrikethroughFeature } from './features/format/strikethrough/feature.server.js'\nexport { SubscriptFeature } from './features/format/subscript/feature.server.js'\nexport { SuperscriptFeature } from './features/format/superscript/feature.server.js'\nexport { UnderlineFeature } from './features/format/underline/feature.server.js'\nexport { HeadingFeature, type HeadingFeatureProps } from './features/heading/server/index.js'\nexport { HorizontalRuleFeature } from './features/horizontalRule/server/index.js'\nexport { IndentFeature } from './features/indent/server/index.js'\n\nexport {\n $createAutoLinkNode,\n $isAutoLinkNode,\n AutoLinkNode,\n} from './features/link/nodes/AutoLinkNode.js'\nexport { $createLinkNode, $isLinkNode, LinkNode } from './features/link/nodes/LinkNode.js'\nexport { LinkFeature, type LinkFeatureServerProps } from './features/link/server/index.js'\n\nexport type { LinkFields } from './features/link/server/schema.js'\nexport { ChecklistFeature } from './features/lists/checklist/server/index.js'\n\nexport { OrderedListFeature } from './features/lists/orderedList/server/index.js'\nexport { UnorderedListFeature } from './features/lists/unorderedList/server/index.js'\n\nexport { ParagraphFeature } from './features/paragraph/server/index.js'\n\nexport {\n RelationshipFeature,\n type RelationshipFeatureProps,\n} from './features/relationship/server/index.js'\n\nexport { RelationshipServerNode } from './features/relationship/server/nodes/RelationshipNode.js'\n\nexport type { RelationshipData } from './features/relationship/server/schema.js'\nexport { TableFeature } from './features/table/server/index.js'\nexport { defaultColors } from './features/textState/defaultColors.js'\nexport { TextStateFeature } from './features/textState/feature.server.js'\n\nexport { FixedToolbarFeature } from './features/toolbars/fixed/server/index.js'\n\nexport { InlineToolbarFeature } from './features/toolbars/inline/server/index.js'\nexport type { ToolbarGroup, ToolbarGroupItem } from './features/toolbars/types.js'\nexport type {\n BaseClientFeatureProps,\n ClientFeature,\n ClientFeatureProviderMap,\n FeatureProviderClient,\n FeatureProviderProviderClient,\n PluginComponent,\n PluginComponentWithAnchor,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n SanitizedClientFeatures,\n SanitizedPlugin,\n} from './features/typesClient.js'\n\nexport type {\n AfterChangeNodeHook,\n AfterChangeNodeHookArgs,\n AfterReadNodeHook,\n AfterReadNodeHookArgs,\n BaseNodeHookArgs,\n BeforeChangeNodeHook,\n BeforeChangeNodeHookArgs,\n BeforeValidateNodeHook,\n BeforeValidateNodeHookArgs,\n FeatureProviderProviderServer,\n FeatureProviderServer,\n NodeValidation,\n NodeWithHooks,\n PopulationPromise,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n ServerFeature,\n ServerFeatureProviderMap,\n} from './features/typesServer.js'\n\nexport { createNode } from './features/typeUtilities.js' // Only useful in feature.server.ts\n\nexport { UploadFeature } from './features/upload/server/index.js'\nexport type { UploadFeatureProps } from './features/upload/server/index.js'\n\nexport { UploadServerNode } from './features/upload/server/nodes/UploadNode.js'\nexport type { UploadData } from './features/upload/server/schema.js'\nexport type { EditorConfigContextType } from './lexical/config/client/EditorConfigProvider.js'\n\nexport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultEditorLexicalConfig,\n} from './lexical/config/server/default.js'\nexport { loadFeatures, sortFeaturesForOptimalLoading } from './lexical/config/server/loader.js'\n\nexport {\n sanitizeServerEditorConfig,\n sanitizeServerFeatures,\n} from './lexical/config/server/sanitize.js'\nexport type {\n ClientEditorConfig,\n SanitizedClientEditorConfig,\n SanitizedServerEditorConfig,\n ServerEditorConfig,\n} from './lexical/config/types.js'\nexport type { AdapterProps }\n\nexport { getEnabledNodes, getEnabledNodesFromServerNodes } from './lexical/nodes/index.js'\n\nexport type {\n SlashMenuGroup,\n SlashMenuItem,\n} from './lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nexport { $convertFromMarkdownString } from './lexical/utils/markdown/convertFromMarkdownString.js'\n\nexport {\n DETAIL_TYPE_TO_DETAIL,\n DOUBLE_LINE_BREAK,\n ELEMENT_FORMAT_TO_TYPE,\n ELEMENT_TYPE_TO_FORMAT,\n IS_ALL_FORMATTING,\n LTR_REGEX,\n NodeFormat,\n NON_BREAKING_SPACE,\n RTL_REGEX,\n TEXT_MODE_TO_TYPE,\n TEXT_TYPE_TO_FORMAT,\n TEXT_TYPE_TO_MODE,\n} from './lexical/utils/nodeFormat.js'\n\nexport { sanitizeUrl, validateUrl } from './lexical/utils/url.js'\n\nexport { defaultRichTextValue } from './populateGraphQL/defaultValue.js'\nexport { populate } from './populateGraphQL/populate.js'\nexport type {\n ClientFeaturesMap,\n LexicalEditorNodeMap,\n LexicalEditorProps,\n LexicalEditorViewMap,\n LexicalFieldAdminProps,\n LexicalRichTextAdapter,\n NodeMapValue,\n SerializedNodeBase,\n ViewMapBlockComponentProps,\n} from './types/index.js'\n\nexport type * from './types/nodeTypes.js'\n\nexport { buildDefaultEditorState, buildEditorState } from './utilities/buildEditorState.js'\nexport { createServerFeature } from './utilities/createServerFeature.js'\n\nexport { editorConfigFactory } from './utilities/editorConfigFactory.js'\nexport type { FieldsDrawerProps } from './utilities/fieldsDrawer/Drawer.js'\n\nexport { extractPropsFromJSXPropsString } from './utilities/jsx/extractPropsFromJSXPropsString.js'\n\nexport {\n extractFrontmatter,\n frontmatterToObject,\n objectToFrontmatter,\n propsToJSXString,\n} from './utilities/jsx/jsx.js'\nexport { upgradeLexicalData } from './utilities/upgradeLexicalData/index.js'\n"],"mappings":"AAEA,SAASA,iBAAiB,EAAEC,eAAe,QAAQ;AAUnD,SAASC,eAAe,QAAQ;AAChC,SAASC,IAAI,Q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ACnBC,iBAAiB,QACZ;AAEP,SAASC,WAAW,EAAEC,WAAW,QAAQ;AAEzC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,QAAQ,QAAQ;AAezB,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ;AAC1D,SAASC,mBAAmB,QAAQ;AAEpC,SAASC,mBAAmB,QAAQ;AAGpC,SAASC,8BAA8B,QAAQ;AAE/C,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,QACX;AACP,SAASC,kBAAkB,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["checkDependencies","deepMergeSimple","getLexicalHooks","i18n","defaultEditorFeatures","populateLexicalPopulationPromises","getFieldToJSONSchema","featuresInputToEditorConfig","getGenerateImportMap","getGenerateSchemaMap","getDefaultSanitizedEditorConfig","richTextValidateHOC","checkedDependencies","lexicalTargetVersion","lexicalEditor","args","process","env","NODE_ENV","PAYLOAD_DISABLE_DEPENDENCY_CHECKER","dependencyGroups","name","dependencies","targetVersion","config","isRoot","parentIsLocalized","features","resolvedFeatureMap","finalSanitizedEditorConfig","lexical","result","sanitizedConfig","featureI18n","supportedLanguages","supportedLanguagesToMerge","_lang","lang","lexicalI18nForLang","general","translations","CellComponent","DiffComponent","editorConfig","FieldComponent","path","serverProps","admin","views","generateImportMap","lexicalEditorArgs","generateSchemaMap","graphQLPopulationPromises","context","currentDepth","depth","draft","field","fieldPromises","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","size","editorPopulationPromises","hooks","jsonSchema","validate","AlignFeature","BlockquoteFeature","CodeBlock","BlocksFeature","$createServerBlockNode","$isServerBlockNode","ServerBlockNode","$createServerInlineBlockNode","$isServerInlineBlockNode","ServerInlineBlockNode","convertHTMLToLexical","lexicalHTMLField","convertLexicalToMarkdown","convertMarkdownToLexical","getPayloadPopulateFn","getRestPopulateFn","DebugJsxConverterFeature","TestRecorderFeature","TreeViewFeature","BoldFeature","InlineCodeFeature","ItalicFeature","StrikethroughFeature","SubscriptFeature","SuperscriptFeature","UnderlineFeature","HeadingFeature","HorizontalRuleFeature","IndentFeature","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$createLinkNode","$isLinkNode","LinkNode","LinkFeature","ChecklistFeature","OrderedListFeature","UnorderedListFeature","ParagraphFeature","RelationshipFeature","RelationshipServerNode","TableFeature","defaultColors","TextStateFeature","FixedToolbarFeature","InlineToolbarFeature","createNode","UploadFeature","UploadServerNode","defaultEditorConfig","defaultEditorLexicalConfig","loadFeatures","sortFeaturesForOptimalLoading","sanitizeServerEditorConfig","sanitizeServerFeatures","getEnabledNodes","getEnabledNodesFromServerNodes","$convertFromMarkdownString","DETAIL_TYPE_TO_DETAIL","DOUBLE_LINE_BREAK","ELEMENT_FORMAT_TO_TYPE","ELEMENT_TYPE_TO_FORMAT","IS_ALL_FORMATTING","LTR_REGEX","NodeFormat","NON_BREAKING_SPACE","RTL_REGEX","TEXT_MODE_TO_TYPE","TEXT_TYPE_TO_FORMAT","TEXT_TYPE_TO_MODE","sanitizeUrl","validateUrl","defaultRichTextValue","populate","buildDefaultEditorState","buildEditorState","createServerFeature","editorConfigFactory","extractPropsFromJSXPropsString","extractFrontmatter","frontmatterToObject","objectToFrontmatter","propsToJSXString","upgradeLexicalData"],"sources":["../src/index.ts"],"sourcesContent":["import type { GenericLanguages, GenericTranslationsObject } from '@payloadcms/translations'\n\nimport { checkDependencies, deepMergeSimple } from 'payload'\n\nimport type { FeatureProviderServer, ResolvedServerFeatureMap } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\nimport type {\n AdapterProps,\n LexicalEditorProps,\n LexicalRichTextAdapterProvider,\n} from './types/index.js'\n\nimport { getLexicalHooks } from './hooks.js'\nimport { i18n } from './i18n.js'\nimport { defaultEditorFeatures } from './lexical/config/server/default.js'\nimport { populateLexicalPopulationPromises } from './populateGraphQL/populateLexicalPopulationPromises.js'\nimport { getFieldToJSONSchema } from './types/schema.js'\nimport { featuresInputToEditorConfig } from './utilities/editorConfigFactory.js'\nimport { getGenerateImportMap } from './utilities/generateImportMap.js'\nimport { getGenerateSchemaMap } from './utilities/generateSchemaMap.js'\nimport { getDefaultSanitizedEditorConfig } from './utilities/getDefaultSanitizedEditorConfig.js'\nimport { richTextValidateHOC } from './validate/index.js'\n\nlet checkedDependencies = false\n\nexport const lexicalTargetVersion = '0.52.0'\n\nexport function lexicalEditor(args?: LexicalEditorProps): LexicalRichTextAdapterProvider {\n if (\n process.env.NODE_ENV !== 'production' &&\n process.env.PAYLOAD_DISABLE_DEPENDENCY_CHECKER !== 'true' &&\n !checkedDependencies\n ) {\n checkedDependencies = true\n void checkDependencies({\n dependencyGroups: [\n {\n name: 'lexical',\n dependencies: [\n 'lexical',\n '@lexical/headless',\n '@lexical/link',\n '@lexical/list',\n '@lexical/mark',\n '@lexical/markdown',\n '@lexical/react',\n '@lexical/rich-text',\n '@lexical/selection',\n '@lexical/utils',\n ],\n targetVersion: lexicalTargetVersion,\n },\n ],\n })\n }\n return ({ config, isRoot, parentIsLocalized }) => {\n let features: FeatureProviderServer<unknown, unknown, unknown>[] = []\n let resolvedFeatureMap: ResolvedServerFeatureMap\n\n let finalSanitizedEditorConfig: SanitizedServerEditorConfig // For server only\n if (!args || (!args.features && !args.lexical)) {\n finalSanitizedEditorConfig = getDefaultSanitizedEditorConfig({\n config,\n parentIsLocalized,\n })\n\n features = defaultEditorFeatures\n\n resolvedFeatureMap = finalSanitizedEditorConfig.resolvedFeatureMap\n } else {\n const result = featuresInputToEditorConfig({\n config,\n features: args?.features,\n isRoot,\n lexical: args?.lexical,\n parentIsLocalized,\n })\n finalSanitizedEditorConfig = result.sanitizedConfig\n features = result.features\n resolvedFeatureMap = result.resolvedFeatureMap\n }\n\n const featureI18n: Partial<GenericLanguages> = finalSanitizedEditorConfig.features.i18n\n const supportedLanguages = config.i18n?.supportedLanguages\n const supportedLanguagesToMerge: Partial<GenericLanguages> = {}\n for (const _lang in supportedLanguages) {\n if (!(_lang in i18n)) {\n if (featureI18n[_lang as keyof typeof i18n]) {\n supportedLanguagesToMerge[_lang as keyof typeof i18n] =\n featureI18n[_lang as keyof typeof i18n]\n }\n continue\n }\n const lang = _lang as keyof typeof i18n\n const lexicalI18nForLang = ((featureI18n[lang] ??= {}).lexical ??=\n {}) as GenericTranslationsObject\n\n lexicalI18nForLang.general = i18n[lang] ?? {}\n supportedLanguagesToMerge[lang] = featureI18n[lang]\n }\n\n config.i18n.translations = deepMergeSimple(config.i18n.translations, supportedLanguagesToMerge)\n\n return {\n CellComponent: '@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell',\n DiffComponent: '@payloadcms/richtext-lexical/rsc#LexicalDiffComponent',\n editorConfig: finalSanitizedEditorConfig,\n features,\n FieldComponent: {\n path: '@payloadcms/richtext-lexical/rsc#RscEntryLexicalField',\n serverProps: {\n admin: args?.admin,\n views: args?.views,\n },\n },\n generateImportMap: getGenerateImportMap({\n lexicalEditorArgs: args,\n resolvedFeatureMap,\n }),\n generateSchemaMap: getGenerateSchemaMap({\n resolvedFeatureMap,\n }),\n graphQLPopulationPromises({\n context,\n currentDepth,\n depth,\n draft,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) {\n // check if there are any features with nodes which have populationPromises for this field\n if (finalSanitizedEditorConfig?.features?.graphQLPopulationPromises?.size) {\n populateLexicalPopulationPromises({\n context,\n currentDepth: currentDepth ?? 0,\n depth,\n draft,\n editorPopulationPromises: finalSanitizedEditorConfig.features.graphQLPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n parentIsLocalized,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n },\n hooks: getLexicalHooks({\n editorConfig: finalSanitizedEditorConfig,\n }),\n jsonSchema: getFieldToJSONSchema({ editorConfig: finalSanitizedEditorConfig }),\n validate: richTextValidateHOC({\n editorConfig: finalSanitizedEditorConfig,\n }),\n }\n }\n}\n\nexport { AlignFeature } from './features/align/server/index.js'\nexport { BlockquoteFeature } from './features/blockquote/server/index.js'\nexport { CodeBlock } from './features/blocks/premade/CodeBlock/index.js'\nexport { BlocksFeature } from './features/blocks/server/index.js'\nexport type {\n BlocksFeatureProps,\n LexicalBlockClientProps,\n LexicalBlockLabelClientProps,\n LexicalBlockLabelServerProps,\n LexicalBlockServerProps,\n LexicalInlineBlockClientProps,\n LexicalInlineBlockLabelClientProps,\n LexicalInlineBlockLabelServerProps,\n LexicalInlineBlockServerProps,\n} from './features/blocks/server/index.js'\n\nexport {\n $createServerBlockNode,\n $isServerBlockNode,\n ServerBlockNode,\n} from './features/blocks/server/nodes/BlocksNode.js'\nexport {\n $createServerInlineBlockNode,\n $isServerInlineBlockNode,\n ServerInlineBlockNode,\n} from './features/blocks/server/nodes/InlineBlocksNode.js'\n\nexport type { BlockFields, InlineBlockFields } from './features/blocks/server/schema.js'\n\nexport { convertHTMLToLexical } from './features/converters/htmlToLexical/index.js'\n\nexport { lexicalHTMLField } from './features/converters/lexicalToHtml/async/field/index.js'\n\nexport { convertLexicalToMarkdown } from './features/converters/lexicalToMarkdown/index.js'\nexport { convertMarkdownToLexical } from './features/converters/markdownToLexical/index.js'\nexport { getPayloadPopulateFn } from './features/converters/utilities/payloadPopulateFn.js'\n\nexport { getRestPopulateFn } from './features/converters/utilities/restPopulateFn.js'\nexport { DebugJsxConverterFeature } from './features/debug/jsxConverter/server/index.js'\nexport { TestRecorderFeature } from './features/debug/testRecorder/server/index.js'\nexport { TreeViewFeature } from './features/debug/treeView/server/index.js'\nexport { BoldFeature } from './features/format/bold/feature.server.js'\nexport { InlineCodeFeature } from './features/format/inlineCode/feature.server.js'\nexport { ItalicFeature } from './features/format/italic/feature.server.js'\n\nexport { StrikethroughFeature } from './features/format/strikethrough/feature.server.js'\nexport { SubscriptFeature } from './features/format/subscript/feature.server.js'\nexport { SuperscriptFeature } from './features/format/superscript/feature.server.js'\nexport { UnderlineFeature } from './features/format/underline/feature.server.js'\nexport { HeadingFeature, type HeadingFeatureProps } from './features/heading/server/index.js'\nexport { HorizontalRuleFeature } from './features/horizontalRule/server/index.js'\nexport { IndentFeature } from './features/indent/server/index.js'\n\nexport {\n $createAutoLinkNode,\n $isAutoLinkNode,\n AutoLinkNode,\n} from './features/link/nodes/AutoLinkNode.js'\nexport { $createLinkNode, $isLinkNode, LinkNode } from './features/link/nodes/LinkNode.js'\nexport { LinkFeature, type LinkFeatureServerProps } from './features/link/server/index.js'\n\nexport type { LinkFields } from './features/link/server/schema.js'\nexport { ChecklistFeature } from './features/lists/checklist/server/index.js'\n\nexport { OrderedListFeature } from './features/lists/orderedList/server/index.js'\nexport { UnorderedListFeature } from './features/lists/unorderedList/server/index.js'\n\nexport { ParagraphFeature } from './features/paragraph/server/index.js'\n\nexport {\n RelationshipFeature,\n type RelationshipFeatureProps,\n} from './features/relationship/server/index.js'\n\nexport { RelationshipServerNode } from './features/relationship/server/nodes/RelationshipNode.js'\n\nexport type { RelationshipData } from './features/relationship/server/schema.js'\nexport { TableFeature } from './features/table/server/index.js'\nexport { defaultColors } from './features/textState/defaultColors.js'\nexport { TextStateFeature } from './features/textState/feature.server.js'\n\nexport { FixedToolbarFeature } from './features/toolbars/fixed/server/index.js'\n\nexport { InlineToolbarFeature } from './features/toolbars/inline/server/index.js'\nexport type { ToolbarGroup, ToolbarGroupItem } from './features/toolbars/types.js'\nexport type {\n BaseClientFeatureProps,\n ClientFeature,\n ClientFeatureProviderMap,\n FeatureProviderClient,\n FeatureProviderProviderClient,\n PluginComponent,\n PluginComponentWithAnchor,\n ResolvedClientFeature,\n ResolvedClientFeatureMap,\n SanitizedClientFeatures,\n SanitizedPlugin,\n} from './features/typesClient.js'\n\nexport type {\n AfterChangeNodeHook,\n AfterChangeNodeHookArgs,\n AfterReadNodeHook,\n AfterReadNodeHookArgs,\n BaseNodeHookArgs,\n BeforeChangeNodeHook,\n BeforeChangeNodeHookArgs,\n BeforeValidateNodeHook,\n BeforeValidateNodeHookArgs,\n FeatureProviderProviderServer,\n FeatureProviderServer,\n NodeValidation,\n NodeWithHooks,\n PopulationPromise,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n ServerFeature,\n ServerFeatureProviderMap,\n} from './features/typesServer.js'\n\nexport { createNode } from './features/typeUtilities.js' // Only useful in feature.server.ts\n\nexport { UploadFeature } from './features/upload/server/index.js'\nexport type { UploadFeatureProps } from './features/upload/server/index.js'\n\nexport { UploadServerNode } from './features/upload/server/nodes/UploadNode.js'\nexport type { UploadData } from './features/upload/server/schema.js'\nexport type { EditorConfigContextType } from './lexical/config/client/EditorConfigProvider.js'\n\nexport {\n defaultEditorConfig,\n defaultEditorFeatures,\n defaultEditorLexicalConfig,\n} from './lexical/config/server/default.js'\nexport { loadFeatures, sortFeaturesForOptimalLoading } from './lexical/config/server/loader.js'\n\nexport {\n sanitizeServerEditorConfig,\n sanitizeServerFeatures,\n} from './lexical/config/server/sanitize.js'\nexport type {\n ClientEditorConfig,\n SanitizedClientEditorConfig,\n SanitizedServerEditorConfig,\n ServerEditorConfig,\n} from './lexical/config/types.js'\nexport type { AdapterProps }\n\nexport { getEnabledNodes, getEnabledNodesFromServerNodes } from './lexical/nodes/index.js'\n\nexport type {\n SlashMenuGroup,\n SlashMenuItem,\n} from './lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nexport { $convertFromMarkdownString } from './lexical/utils/markdown/convertFromMarkdownString.js'\n\nexport {\n DETAIL_TYPE_TO_DETAIL,\n DOUBLE_LINE_BREAK,\n ELEMENT_FORMAT_TO_TYPE,\n ELEMENT_TYPE_TO_FORMAT,\n IS_ALL_FORMATTING,\n LTR_REGEX,\n NodeFormat,\n NON_BREAKING_SPACE,\n RTL_REGEX,\n TEXT_MODE_TO_TYPE,\n TEXT_TYPE_TO_FORMAT,\n TEXT_TYPE_TO_MODE,\n} from './lexical/utils/nodeFormat.js'\n\nexport { sanitizeUrl, validateUrl } from './lexical/utils/url.js'\n\nexport { defaultRichTextValue } from './populateGraphQL/defaultValue.js'\nexport { populate } from './populateGraphQL/populate.js'\nexport type {\n ClientFeaturesMap,\n LexicalEditorNodeMap,\n LexicalEditorProps,\n LexicalEditorViewMap,\n LexicalFieldAdminProps,\n LexicalRichTextAdapter,\n NodeMapValue,\n SerializedNodeBase,\n ViewMapBlockComponentProps,\n} from './types/index.js'\n\nexport type * from './types/nodeTypes.js'\n\nexport { buildDefaultEditorState, buildEditorState } from './utilities/buildEditorState.js'\nexport { createServerFeature } from './utilities/createServerFeature.js'\n\nexport { editorConfigFactory } from './utilities/editorConfigFactory.js'\nexport type { FieldsDrawerProps } from './utilities/fieldsDrawer/Drawer.js'\n\nexport { extractPropsFromJSXPropsString } from './utilities/jsx/extractPropsFromJSXPropsString.js'\n\nexport {\n extractFrontmatter,\n frontmatterToObject,\n objectToFrontmatter,\n propsToJSXString,\n} from './utilities/jsx/jsx.js'\nexport { upgradeLexicalData } from './utilities/upgradeLexicalData/index.js'\n"],"mappings":"AAEA,SAASA,iBAAiB,EAAEC,eAAe,QAAQ;AAUnD,SAASC,eAAe,QAAQ;AAChC,SAASC,IAAI,QAAQ;AACrB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,oBAAoB,QAAQ;AACrC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,+BAA+B,QAAQ;AAChD,SAASC,mBAAmB,QAAQ;AAEpC,IAAIC,mBAAA,GAAsB;AAE1B,OAAO,MAAMC,oBAAA,GAAuB;AAEpC,OAAO,SAASC,cAAcC,IAAyB;EACrD,IACEC,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,gBACzBF,OAAA,CAAQC,GAAG,CAACE,kCAAkC,KAAK,UACnD,CAACP,mBAAA,EACD;IACAA,mBAAA,GAAsB;I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;AAEjC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,oBAAoB,QAAQ;AAErC,SAASC,gBAAgB,QAAQ;AAEjC,SACEC,mBAAmB,QAEd;AAEP,SAASC,sBAAsB,QAAQ;AAGvC,SAASC,YAAY,QAAQ;AAC7B,SAASC,aAAa,QAAQ;AAC9B,SAASC,gBAAgB,QAAQ;AAEjC,SAASC,mBAAmB,QAAQ;AAEpC,SAASC,oBAAoB,QAAQ;AAsCrC,SAASC,UAAU,QAAQ,8BAA6B,CAAC;AAEzD,SAASC,aAAa,QAAQ;AAG9B,SAASC,gBAAgB,QAAQ;AAIjC,SACEC,mBAAmB,EACnBrH,qBAAqB,EACrBsH,0BAA0B,QACrB;AACP,SAASC,YAAY,EAAEC,6BAA6B,QAAQ;AAE5D,SACEC,0BAA0B,EAC1BC,sBAAsB,QACjB;AASP,SAASC,eAAe,EAAEC,8BAA8B,QAAQ;AAMhE,SAASC,0BAA0B,QAAQ;AAE3C,SACEC,qBAAqB,EACrBC,iBAAiB,EACjBC,sBAAsB,EACtBC,sBAAsB,EACtBC,iBAAiB,EACjBC,SAAS,EACTC,UAAU,EACVC,kBAAkB,EAClBC,SAAS,EACTC,iBAAiB,EACjBC,mBAAmB,EACnBC,iBAAiB,QACZ;AAEP,SAASC,WAAW,EAAEC,WAAW,QAAQ;AAEzC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,QAAQ,QAAQ;AAezB,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ;AAC1D,SAASC,mBAAmB,QAAQ;AAEpC,SAASC,mBAAmB,QAAQ;AAGpC,SAASC,8BAA8B,QAAQ;AAE/C,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,QACX;AACP,SAASC,kBAAkB,QAAQ","ignoreList":[]}
@@ -1,9 +1,25 @@
1
1
  @layer payload-default {
2
+ .ContentEditable__keyboard-hint {
3
+ /* Reserve space so blur cannot move a pointer target between mouse-down and mouse-up. */
4
+ visibility: hidden;
5
+ margin: 0;
6
+ padding-block-start: var(--spacer-2);
7
+ padding-inline: calc(var(--content-editable-padding-inline-start) + var(--stroke-width-small));
8
+ color: var(--color-text);
9
+ font-size: var(--text-body-small-font-size);
10
+ }
11
+
12
+ .editor-container:has(> .editor-scroller > .editor > .ContentEditable__root:focus)
13
+ + .ContentEditable__keyboard-hint {
14
+ visibility: visible;
15
+ }
16
+
2
17
  .rich-text-lexical {
18
+ --content-editable-padding-block-start: var(--spacer-3);
19
+ --content-editable-padding-inline-start: var(--spacer-3);
20
+
3
21
  .editor {
4
22
  position: relative;
5
- --content-editable-padding-block-start: var(--spacer-3);
6
- --content-editable-padding-inline-start: var(--spacer-3);
7
23
  }
8
24
 
9
25
  .editor-container {
@@ -32,17 +48,12 @@
32
48
  }
33
49
 
34
50
  @media (min-width: 768px) {
35
- .rich-text-lexical .editor {
51
+ .rich-text-lexical {
36
52
  --content-editable-padding-block-start: var(--spacer-4);
37
53
  --content-editable-padding-inline-start: var(--spacer-5);
38
54
  }
39
55
 
40
- .rich-text-lexical:not(.rich-text-lexical--show-gutter)
41
- > .rich-text-lexical__wrap
42
- > .rich-text-lexical__editor-content
43
- > .editor-container
44
- > .editor-scroller
45
- > .editor {
56
+ .rich-text-lexical:not(.rich-text-lexical--show-gutter) {
46
57
  --content-editable-padding-block-start: var(--spacer-2);
47
58
  --content-editable-padding-inline-start: 0px;
48
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalEditor.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAGhE,OAAO,qBAAqB,CAAA;AAe5B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC;IACE,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC1D,oBAAoB,EAAE,OAAO,CAAA;CAC9B,GAAG,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,GAAG,KAAK,CAAC,CAsKpE,CAAA"}
1
+ {"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalEditor.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAGhE,OAAO,qBAAqB,CAAA;AAe5B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC;IACE,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC1D,oBAAoB,EAAE,OAAO,CAAA;CAC9B,GAAG,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,GAAG,KAAK,CAAC,CAiLpE,CAAA"}
@@ -8,6 +8,7 @@ import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js';
8
8
  import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js';
9
9
  import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js';
10
10
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
11
+ import { useTranslation } from '@payloadcms/ui';
11
12
  import { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical';
12
13
  import * as React from 'react';
13
14
  import { useEffect, useState } from 'react';
@@ -27,7 +28,7 @@ import { SlashMenuPlugin } from './plugins/SlashMenu/index.js';
27
28
  import { TextPlugin } from './plugins/TextPlugin/index.js';
28
29
  import { LexicalContentEditable } from './ui/ContentEditable.js';
29
30
  export const LexicalEditor = props => {
30
- const $ = _c(13);
31
+ const $ = _c(5);
31
32
  const {
32
33
  editorConfig,
33
34
  editorContainerRef,
@@ -38,6 +39,11 @@ export const LexicalEditor = props => {
38
39
  const editorConfigContext = useEditorConfigContext();
39
40
  const [editor] = useLexicalComposerContext();
40
41
  const isEditable = useLexicalEditable();
42
+ const {
43
+ t
44
+ } = useTranslation();
45
+ const instructionsID = React.useId();
46
+ const hasTabIndentation = isEditable && editorConfig.features.enabledFeatures.includes("indent");
41
47
  const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
42
48
  let t0;
43
49
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -92,73 +98,64 @@ export const LexicalEditor = props => {
92
98
  t2 = $[4];
93
99
  }
94
100
  useEffect(t1, t2);
95
- let t3;
96
- if ($[5] !== editorConfig || $[6] !== editorContainerRef || $[7] !== floatingAnchorElem || $[8] !== isEditable || $[9] !== isSmallWidthViewport || $[10] !== onChange || $[11] !== rtl) {
97
- t3 = _jsxs(React.Fragment, {
98
- children: [editorConfig.features.plugins?.map(_temp), _jsxs("div", {
99
- className: "editor-container",
100
- dir: rtl ? "rtl" : undefined,
101
- ref: editorContainerRef,
102
- children: [editorConfig.features.plugins?.map(_temp2), _jsx(RichTextPlugin, {
103
- contentEditable: _jsx("div", {
104
- className: "editor-scroller",
105
- children: _jsx("div", {
106
- className: "editor",
107
- ref: onRef,
108
- children: _jsx(LexicalContentEditable, {
109
- editorConfig
110
- })
101
+ return _jsxs(React.Fragment, {
102
+ children: [editorConfig.features.plugins?.map(_temp), _jsxs("div", {
103
+ className: "editor-container",
104
+ dir: rtl ? "rtl" : undefined,
105
+ ref: editorContainerRef,
106
+ children: [editorConfig.features.plugins?.map(_temp2), _jsx(RichTextPlugin, {
107
+ contentEditable: _jsx("div", {
108
+ className: "editor-scroller",
109
+ children: _jsx("div", {
110
+ className: "editor",
111
+ ref: onRef,
112
+ children: _jsx(LexicalContentEditable, {
113
+ editorConfig,
114
+ instructionsID: hasTabIndentation ? instructionsID : undefined
111
115
  })
112
- }),
113
- ErrorBoundary: LexicalErrorBoundary
114
- }), _jsx(NormalizeSelectionPlugin, {}), isEditable && _jsx(InsertParagraphAtEndPlugin, {}), _jsx(DecoratorPlugin, {}), _jsx(ClipboardPlugin, {}), _jsx(TextPlugin, {
115
- features: editorConfig.features
116
- }), _jsx(SelectAllPlugin, {}), _jsx(NodeViewOverridePlugin, {}), isEditable && _jsx(OnChangePlugin, {
117
- ignoreSelectionChange: true,
118
- onChange: (editorState, editor_0, tags) => {
119
- if (!tags.has("focus") || tags.size > 1) {
120
- if (onChange != null) {
121
- onChange(editorState, editor_0, tags);
122
- }
116
+ })
117
+ }),
118
+ ErrorBoundary: LexicalErrorBoundary
119
+ }), _jsx(NormalizeSelectionPlugin, {}), isEditable && _jsx(InsertParagraphAtEndPlugin, {}), _jsx(DecoratorPlugin, {}), _jsx(ClipboardPlugin, {}), _jsx(TextPlugin, {
120
+ features: editorConfig.features
121
+ }), _jsx(SelectAllPlugin, {}), _jsx(NodeViewOverridePlugin, {}), isEditable && _jsx(OnChangePlugin, {
122
+ ignoreSelectionChange: true,
123
+ onChange: (editorState, editor_0, tags) => {
124
+ if (!tags.has("focus") || tags.size > 1) {
125
+ if (onChange != null) {
126
+ onChange(editorState, editor_0, tags);
123
127
  }
124
128
  }
125
- }), floatingAnchorElem && _jsxs(React.Fragment, {
126
- children: [!isSmallWidthViewport && isEditable && _jsxs(React.Fragment, {
127
- children: [editorConfig.admin?.hideDraggableBlockElement ? null : _jsx(DraggableBlockPlugin, {
128
- anchorElem: floatingAnchorElem
129
- }), editorConfig.admin?.hideAddBlockButton ? null : _jsx(AddBlockHandlePlugin, {
130
- anchorElem: floatingAnchorElem
131
- })]
132
- }), editorConfig.features.plugins?.map(plugin_1 => {
133
- if (plugin_1.position === "floatingAnchorElem" && !(plugin_1.desktopOnly === true && isSmallWidthViewport)) {
134
- return _jsx(EditorPlugin, {
135
- anchorElem: floatingAnchorElem,
136
- clientProps: plugin_1.clientProps,
137
- plugin: plugin_1
138
- }, plugin_1.key);
139
- }
140
- }), isEditable && _jsx(React.Fragment, {
141
- children: _jsx(SlashMenuPlugin, {
142
- anchorElem: floatingAnchorElem
143
- })
129
+ }
130
+ }), floatingAnchorElem && _jsxs(React.Fragment, {
131
+ children: [!isSmallWidthViewport && isEditable && _jsxs(React.Fragment, {
132
+ children: [editorConfig.admin?.hideDraggableBlockElement ? null : _jsx(DraggableBlockPlugin, {
133
+ anchorElem: floatingAnchorElem
134
+ }), editorConfig.admin?.hideAddBlockButton ? null : _jsx(AddBlockHandlePlugin, {
135
+ anchorElem: floatingAnchorElem
144
136
  })]
145
- }), isEditable && _jsxs(React.Fragment, {
146
- children: [_jsx(HistoryPlugin, {}), editorConfig?.features?.markdownTransformers?.length > 0 && _jsx(MarkdownShortcutPlugin, {})]
147
- }), editorConfig.features.plugins?.map(_temp3), editorConfig.features.plugins?.map(_temp4)]
148
- }), editorConfig.features.plugins?.map(_temp5)]
149
- });
150
- $[5] = editorConfig;
151
- $[6] = editorContainerRef;
152
- $[7] = floatingAnchorElem;
153
- $[8] = isEditable;
154
- $[9] = isSmallWidthViewport;
155
- $[10] = onChange;
156
- $[11] = rtl;
157
- $[12] = t3;
158
- } else {
159
- t3 = $[12];
160
- }
161
- return t3;
137
+ }), editorConfig.features.plugins?.map(plugin_1 => {
138
+ if (plugin_1.position === "floatingAnchorElem" && !(plugin_1.desktopOnly === true && isSmallWidthViewport)) {
139
+ return _jsx(EditorPlugin, {
140
+ anchorElem: floatingAnchorElem,
141
+ clientProps: plugin_1.clientProps,
142
+ plugin: plugin_1
143
+ }, plugin_1.key);
144
+ }
145
+ }), isEditable && _jsx(React.Fragment, {
146
+ children: _jsx(SlashMenuPlugin, {
147
+ anchorElem: floatingAnchorElem
148
+ })
149
+ })]
150
+ }), isEditable && _jsxs(React.Fragment, {
151
+ children: [_jsx(HistoryPlugin, {}), editorConfig?.features?.markdownTransformers?.length > 0 && _jsx(MarkdownShortcutPlugin, {})]
152
+ }), editorConfig.features.plugins?.map(_temp3), editorConfig.features.plugins?.map(_temp4)]
153
+ }), hasTabIndentation && _jsx("p", {
154
+ className: "ContentEditable__keyboard-hint",
155
+ id: instructionsID,
156
+ children: t("lexical:indent:keyboardHint")
157
+ }), editorConfig.features.plugins?.map(_temp5)]
158
+ });
162
159
  };
163
160
  function _temp(plugin) {
164
161
  if (plugin.position === "aboveContainer") {
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalEditor.js","names":["c","_c","useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","useLexicalEditable","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NodeViewOverridePlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","rtl","editorConfigContext","editor","isEditable","floatingAnchorElem","setFloatingAnchorElem","t0","Symbol","for","_floatingAnchorElem","onRef","t1","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","_jsxs","Fragment","children","features","plugins","map","_temp","className","dir","undefined","ref","_temp2","_jsx","contentEditable","ignoreSelectionChange","editorState","editor_0","tags","has","size","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","plugin_1","plugin","position","desktopOnly","clientProps","key","markdownTransformers","length","_temp3","_temp4","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.css'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NodeViewOverridePlugin } from './plugins/NodeViewOverridePlugin/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange' | 'rtl'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange, rtl } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" dir={rtl ? 'rtl' : undefined} ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <NodeViewOverridePlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAA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RichTextPlugin","useLexicalEditable","useTranslation","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NodeViewOverridePlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","rtl","editorConfigContext","editor","isEditable","t","instructionsID","useId","hasTabIndentation","features","enabledFeatures","includes","floatingAnchorElem","setFloatingAnchorElem","t0","Symbol","for","_floatingAnchorElem","onRef","t1","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","_jsxs","Fragment","children","plugins","map","_temp","className","dir","undefined","ref","_temp2","_jsx","contentEditable","ignoreSelectionChange","editorState","editor_0","tags","has","size","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","plugin_1","plugin","position","desktopOnly","clientProps","key","markdownTransformers","length","_temp3","_temp4","id","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { useTranslation } from '@payloadcms/ui'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.css'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NodeViewOverridePlugin } from './plugins/NodeViewOverridePlugin/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange' | 'rtl'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange, rtl } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { t } = useTranslation<Record<string, never>, string>()\n const instructionsID = React.useId()\n const hasTabIndentation = isEditable && editorConfig.features.enabledFeatures.includes('indent')\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" dir={rtl ? 'rtl' : undefined} ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable\n editorConfig={editorConfig}\n instructionsID={hasTabIndentation ? instructionsID : undefined}\n />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <NodeViewOverridePlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {hasTabIndentation && (\n <p className=\"ContentEditable__keyboard-hint\" id={instructionsID}>\n {t('lexical:indent:keyboardHint')}\n </p>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,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AAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AA2BtE,OAAO,aAAa,CAAA;AAIpB,wBAAgB,eAAe,SA6K9B;AAiDD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,WAAW,CAgBjG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AA4BtE,OAAO,aAAa,CAAA;AAIpB,wBAAgB,eAAe,SAuL9B;AA4CD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,WAAW,CAgBjG"}
@@ -3,7 +3,7 @@
3
3
  import { c as _c } from "react/compiler-runtime";
4
4
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
5
5
  import { $findMatchingParent, mergeRegister } from '@lexical/utils';
6
- import { $createNodeSelection, $getEditor, $getNearestNodeFromDOMNode, $getSelection, $isDecoratorNode, $isElementNode, $isLineBreakNode, $isNodeSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, $setSelection, CLICK_COMMAND, COMMAND_PRIORITY_LOW, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
6
+ import { $createNodeSelection, $getEditor, $getNearestNodeFromDOMNode, $getSelection, $isDecoratorNode, $isElementNode, $isLineBreakNode, $isNodeSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, $onUpdate, $setSelection, CLICK_COMMAND, COMMAND_PRIORITY_LOW, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
7
7
  import { useEffect } from 'react';
8
8
  import './index.css';
9
9
  // TODO: This should ideally be fixed in Lexical. See
@@ -15,7 +15,22 @@ export function DecoratorPlugin() {
15
15
  let t0;
16
16
  let t1;
17
17
  if ($[0] !== editor) {
18
- t0 = () => mergeRegister(editor.registerCommand(CLICK_COMMAND, _temp3, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(SELECTION_CHANGE_COMMAND, _temp4, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_UP_COMMAND, _temp6, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_DOWN_COMMAND, _temp8, COMMAND_PRIORITY_LOW));
18
+ t0 = () => mergeRegister(editor.registerCommand(CLICK_COMMAND, _temp3, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(SELECTION_CHANGE_COMMAND, (_, activeEditor) => {
19
+ if (activeEditor !== editor) {
20
+ return false;
21
+ }
22
+ const hasSelectedDecorator = Boolean($getSelectedDecorator());
23
+ $onUpdate(() => {
24
+ activeEditor.read("latest", () => {
25
+ const decorator_0 = $getSelectedDecorator();
26
+ document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");
27
+ if (decorator_0) {
28
+ activeEditor.getElementByKey(decorator_0.getKey())?.classList.add("decorator-selected");
29
+ }
30
+ });
31
+ });
32
+ return hasSelectedDecorator;
33
+ }, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_UP_COMMAND, _temp5, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_DOWN_COMMAND, _temp7, COMMAND_PRIORITY_LOW));
19
34
  t1 = [editor];
20
35
  $[0] = editor;
21
36
  $[1] = t0;
@@ -27,7 +42,7 @@ export function DecoratorPlugin() {
27
42
  useEffect(t0, t1);
28
43
  return null;
29
44
  }
30
- function _temp8(event_2) {
45
+ function _temp7(event_2) {
31
46
  const selection_1 = $getSelection();
32
47
  if ($isNodeSelection(selection_1)) {
33
48
  event_2.preventDefault();
@@ -59,7 +74,7 @@ function _temp8(event_2) {
59
74
  }
60
75
  const lastPoint = selection_1.isBackward() ? selection_1.anchor : selection_1.focus;
61
76
  const lastNode = lastPoint.getNode();
62
- const lastSelectedBlock = $findMatchingParent(lastNode, _temp7);
77
+ const lastSelectedBlock = $findMatchingParent(lastNode, _temp6);
63
78
  const nextBlock = lastSelectedBlock?.getNextSibling();
64
79
  if (!lastSelectedBlock || nextBlock !== findLaterSiblingBlock(lastSelectedBlock)) {
65
80
  return false;
@@ -77,10 +92,10 @@ function _temp8(event_2) {
77
92
  }
78
93
  return false;
79
94
  }
80
- function _temp7(node_1) {
95
+ function _temp6(node_1) {
81
96
  return findLaterSiblingBlock(node_1) !== null;
82
97
  }
83
- function _temp6(event_1) {
98
+ function _temp5(event_1) {
84
99
  const selection_0 = $getSelection();
85
100
  if ($isNodeSelection(selection_0)) {
86
101
  const prevSibling = selection_0.getNodes()[0]?.getPreviousSibling();
@@ -113,7 +128,7 @@ function _temp6(event_1) {
113
128
  }
114
129
  const firstPoint = selection_0.isBackward() ? selection_0.anchor : selection_0.focus;
115
130
  const firstNode = firstPoint.getNode();
116
- const firstSelectedBlock = $findMatchingParent(firstNode, _temp5);
131
+ const firstSelectedBlock = $findMatchingParent(firstNode, _temp4);
117
132
  const prevBlock = firstSelectedBlock?.getPreviousSibling();
118
133
  if (!firstSelectedBlock || prevBlock !== findFirstSiblingBlock(firstSelectedBlock)) {
119
134
  return false;
@@ -131,18 +146,9 @@ function _temp6(event_1) {
131
146
  }
132
147
  return false;
133
148
  }
134
- function _temp5(node_0) {
149
+ function _temp4(node_0) {
135
150
  return findFirstSiblingBlock(node_0) !== null;
136
151
  }
137
- function _temp4() {
138
- const decorator_0 = $getSelectedDecorator();
139
- document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");
140
- if (decorator_0) {
141
- decorator_0.element?.classList.add("decorator-selected");
142
- return true;
143
- }
144
- return false;
145
- }
146
152
  function _temp3(event_0) {
147
153
  document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");
148
154
  const decorator = $getDecoratorByMouseEvent(event_0);
@@ -196,10 +202,7 @@ function $getSelectedDecorator() {
196
202
  return undefined;
197
203
  }
198
204
  const node = nodes[0];
199
- return $isDecoratorNode(node) ? {
200
- decorator: node,
201
- element: $getEditor().getElementByKey(node.getKey())
202
- } : undefined;
205
+ return $isDecoratorNode(node) ? node : undefined;
203
206
  }
204
207
  function $selectDecorator({
205
208
  element,