@payloadcms/richtext-lexical 3.68.0-internal-debug.35482da → 3.68.0-internal-debug.e9b66ee

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 (254) hide show
  1. package/dist/cell/rscEntry.js +2 -21
  2. package/dist/cell/rscEntry.js.map +1 -1
  3. package/dist/features/blocks/client/component/BlockContent.js +13 -48
  4. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  5. package/dist/features/blocks/client/component/components/BlockCollapsible.js +1 -10
  6. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  7. package/dist/features/blocks/client/component/components/BlockEditButton.js +1 -7
  8. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  9. package/dist/features/blocks/client/component/components/BlockRemoveButton.js +1 -7
  10. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  11. package/dist/features/blocks/client/component/index.js +81 -247
  12. package/dist/features/blocks/client/component/index.js.map +1 -1
  13. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +1 -9
  14. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  15. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +1 -7
  16. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  17. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +1 -7
  18. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  19. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +1 -7
  20. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  21. package/dist/features/blocks/client/componentInline/index.js +68 -217
  22. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  23. package/dist/features/blocks/client/getBlockImageComponent.js +4 -15
  24. package/dist/features/blocks/client/getBlockImageComponent.js.map +1 -1
  25. package/dist/features/blocks/client/nodes/BlocksNode.js +1 -12
  26. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  27. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +2 -12
  28. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  29. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +26 -127
  30. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  31. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +49 -65
  32. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  33. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +3 -16
  34. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
  35. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +4 -25
  36. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
  37. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  38. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  39. package/dist/features/converters/lexicalToJSX/Component/index.js +2 -13
  40. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  41. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js +1 -8
  42. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  43. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +1 -8
  44. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  45. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js +1 -6
  46. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  47. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js +1 -6
  48. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  49. package/dist/features/converters/lexicalToJSX/converter/converters/link.js +10 -19
  50. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  51. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +16 -63
  52. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  53. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js +4 -19
  54. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  55. package/dist/features/converters/lexicalToJSX/converter/converters/table.js +12 -45
  56. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  57. package/dist/features/converters/lexicalToJSX/converter/converters/text.js +11 -57
  58. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  59. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +7 -46
  60. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  61. package/dist/features/converters/lexicalToJSX/converter/index.js +5 -12
  62. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  63. package/dist/features/debug/jsxConverter/client/plugin/index.js +3 -16
  64. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  65. package/dist/features/debug/testRecorder/client/plugin/index.js +38 -113
  66. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  67. package/dist/features/debug/treeView/client/plugin/index.js +1 -15
  68. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  69. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +79 -357
  70. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  71. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +7 -41
  72. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  73. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +9 -39
  74. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  75. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +28 -59
  76. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  77. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +0 -1
  78. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  79. package/dist/features/indent/client/IndentPlugin.js +1 -6
  80. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  81. package/dist/features/link/client/plugins/clickableLink/index.js +1 -7
  82. package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
  83. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +59 -151
  84. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  85. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +1 -9
  86. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  87. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  88. package/dist/features/lists/checklist/client/plugin/index.js +1 -7
  89. package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
  90. package/dist/features/lists/plugin/index.js +1 -7
  91. package/dist/features/lists/plugin/index.js.map +1 -1
  92. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +3 -18
  93. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  94. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +2 -9
  95. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  96. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +3 -18
  97. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  98. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +2 -9
  99. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  100. package/dist/features/relationship/client/components/RelationshipComponent.js +31 -100
  101. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  102. package/dist/features/relationship/client/drawer/index.js +4 -21
  103. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  104. package/dist/features/relationship/client/nodes/RelationshipNode.js +2 -12
  105. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  106. package/dist/features/relationship/client/plugins/index.js +1 -8
  107. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  108. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  109. package/dist/features/textState/feature.client.js +5 -22
  110. package/dist/features/textState/feature.client.js.map +1 -1
  111. package/dist/features/toolbars/fixed/client/Toolbar/index.js +27 -123
  112. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  113. package/dist/features/toolbars/inline/client/Toolbar/index.js +18 -111
  114. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  115. package/dist/features/toolbars/shared/ToolbarButton/index.js +4 -14
  116. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  117. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +56 -135
  118. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  119. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +16 -70
  120. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  121. package/dist/features/upload/client/component/index.js +43 -167
  122. package/dist/features/upload/client/component/index.js.map +1 -1
  123. package/dist/features/upload/client/component/pending/index.js +3 -16
  124. package/dist/features/upload/client/component/pending/index.js.map +1 -1
  125. package/dist/features/upload/client/drawer/index.js +4 -21
  126. package/dist/features/upload/client/drawer/index.js.map +1 -1
  127. package/dist/features/upload/client/nodes/UploadNode.js +3 -17
  128. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  129. package/dist/features/upload/client/plugin/index.js +2 -9
  130. package/dist/features/upload/client/plugin/index.js.map +1 -1
  131. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  132. package/dist/field/Diff/converters/listitem/index.js +11 -54
  133. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  134. package/dist/field/Diff/converters/relationship/index.js +18 -60
  135. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  136. package/dist/field/Diff/converters/unknown/index.js +7 -42
  137. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  138. package/dist/field/Diff/converters/upload/index.js +21 -91
  139. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  140. package/dist/field/Diff/index.js +4 -17
  141. package/dist/field/Diff/index.js.map +1 -1
  142. package/dist/field/Field.js +25 -124
  143. package/dist/field/Field.js.map +1 -1
  144. package/dist/field/RenderLexical/index.js +15 -47
  145. package/dist/field/RenderLexical/index.js.map +1 -1
  146. package/dist/field/index.js +5 -24
  147. package/dist/field/index.js.map +1 -1
  148. package/dist/field/rscEntry.js +1 -9
  149. package/dist/field/rscEntry.js.map +1 -1
  150. package/dist/lexical/EditorPlugin.js +2 -17
  151. package/dist/lexical/EditorPlugin.js.map +1 -1
  152. package/dist/lexical/LexicalEditor.js +69 -232
  153. package/dist/lexical/LexicalEditor.js.map +1 -1
  154. package/dist/lexical/LexicalProvider.js +13 -64
  155. package/dist/lexical/LexicalProvider.js.map +1 -1
  156. package/dist/lexical/config/client/EditorConfigProvider.js +2 -11
  157. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  158. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +5 -28
  159. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  160. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +1 -14
  161. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  162. package/dist/lexical/plugins/SlashMenu/index.js +31 -98
  163. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  164. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +7 -27
  165. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  166. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +7 -45
  167. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  168. package/dist/lexical/ui/ContentEditable.js +3 -18
  169. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  170. package/dist/lexical/ui/icons/AI/index.js +10 -58
  171. package/dist/lexical/ui/icons/AI/index.js.map +1 -1
  172. package/dist/lexical/ui/icons/Add/index.js +4 -31
  173. package/dist/lexical/ui/icons/Add/index.js.map +1 -1
  174. package/dist/lexical/ui/icons/AlignCenter/index.js +5 -45
  175. package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  176. package/dist/lexical/ui/icons/AlignJustify/index.js +5 -45
  177. package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  178. package/dist/lexical/ui/icons/AlignLeft/index.js +5 -45
  179. package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  180. package/dist/lexical/ui/icons/AlignRight/index.js +5 -45
  181. package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
  182. package/dist/lexical/ui/icons/Block/index.js +5 -54
  183. package/dist/lexical/ui/icons/Block/index.js.map +1 -1
  184. package/dist/lexical/ui/icons/Blockquote/index.js +3 -24
  185. package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
  186. package/dist/lexical/ui/icons/Bold/index.js +3 -24
  187. package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
  188. package/dist/lexical/ui/icons/Checklist/index.js +4 -39
  189. package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
  190. package/dist/lexical/ui/icons/Code/index.js +4 -34
  191. package/dist/lexical/ui/icons/Code/index.js.map +1 -1
  192. package/dist/lexical/ui/icons/CodeBlock/index.js +3 -22
  193. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  194. package/dist/lexical/ui/icons/Collapse/index.js +3 -23
  195. package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
  196. package/dist/lexical/ui/icons/H1/index.js +3 -24
  197. package/dist/lexical/ui/icons/H1/index.js.map +1 -1
  198. package/dist/lexical/ui/icons/H2/index.js +3 -24
  199. package/dist/lexical/ui/icons/H2/index.js.map +1 -1
  200. package/dist/lexical/ui/icons/H3/index.js +3 -24
  201. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  202. package/dist/lexical/ui/icons/H4/index.js +3 -24
  203. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  204. package/dist/lexical/ui/icons/H5/index.js +3 -24
  205. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  206. package/dist/lexical/ui/icons/H6/index.js +3 -24
  207. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  208. package/dist/lexical/ui/icons/HorizontalRule/index.js +3 -27
  209. package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  210. package/dist/lexical/ui/icons/IndentDecrease/index.js +6 -53
  211. package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  212. package/dist/lexical/ui/icons/IndentIncrease/index.js +6 -53
  213. package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  214. package/dist/lexical/ui/icons/InlineBlocks/index.js +3 -26
  215. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
  216. package/dist/lexical/ui/icons/Italic/index.js +3 -24
  217. package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
  218. package/dist/lexical/ui/icons/Link/index.js +3 -25
  219. package/dist/lexical/ui/icons/Link/index.js.map +1 -1
  220. package/dist/lexical/ui/icons/Meatballs/index.js +5 -39
  221. package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
  222. package/dist/lexical/ui/icons/OrderedList/index.js +7 -61
  223. package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
  224. package/dist/lexical/ui/icons/Relationship/index.js +10 -58
  225. package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
  226. package/dist/lexical/ui/icons/Strikethrough/index.js +4 -34
  227. package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  228. package/dist/lexical/ui/icons/Subscript/index.js +3 -24
  229. package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
  230. package/dist/lexical/ui/icons/Superscript/index.js +3 -24
  231. package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
  232. package/dist/lexical/ui/icons/Table/index.js +3 -24
  233. package/dist/lexical/ui/icons/Table/index.js.map +1 -1
  234. package/dist/lexical/ui/icons/Text/index.js +3 -24
  235. package/dist/lexical/ui/icons/Text/index.js.map +1 -1
  236. package/dist/lexical/ui/icons/TextState/index.js +12 -18
  237. package/dist/lexical/ui/icons/TextState/index.js.map +1 -1
  238. package/dist/lexical/ui/icons/Underline/index.js +4 -34
  239. package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
  240. package/dist/lexical/ui/icons/UnorderedList/index.js +8 -81
  241. package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  242. package/dist/lexical/ui/icons/Upload/index.js +5 -48
  243. package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
  244. package/dist/lexical/utils/point.js.map +1 -1
  245. package/dist/lexical/utils/rect.js.map +1 -1
  246. package/dist/utilities/fieldsDrawer/Drawer.js +16 -41
  247. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  248. package/dist/utilities/fieldsDrawer/DrawerContent.js +10 -42
  249. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  250. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +1 -9
  251. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  252. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +3 -11
  253. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  254. package/package.json +7 -7
@@ -1,5 +1,4 @@
1
1
  'use client';
2
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
2
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
4
3
  import { TablePlugin as LexicalReactTablePlugin } from '@lexical/react/LexicalTablePlugin';
5
4
  import { INSERT_TABLE_COMMAND, TableCellNode, TableNode, TableRowNode } from '@lexical/table';
@@ -13,7 +12,7 @@ import { FieldsDrawer } from '../../../../../utilities/fieldsDrawer/Drawer.js';
13
12
  import { useLexicalDrawer } from '../../../../../utilities/fieldsDrawer/useLexicalDrawer.js';
14
13
  import './index.scss';
15
14
  export const OPEN_TABLE_DRAWER_COMMAND = createCommand('OPEN_EMBED_DRAWER_COMMAND');
16
- export const CellContext = /*#__PURE__*/ createContext({
15
+ export const CellContext = createContext({
17
16
  cellEditorConfig: null,
18
17
  cellEditorPlugins: null,
19
18
  set: ()=>{}
@@ -24,26 +23,21 @@ export function TableContext({ children }) {
24
23
  cellEditorConfig: null,
25
24
  cellEditorPlugins: null
26
25
  });
27
- return /*#__PURE__*/ _jsxDEV(CellContext, {
28
- value: useMemo(()=>({
29
- cellEditorConfig: contextValue.cellEditorConfig,
30
- cellEditorPlugins: contextValue.cellEditorPlugins,
31
- set: (cellEditorConfig, cellEditorPlugins)=>{
32
- setContextValue({
33
- cellEditorConfig,
34
- cellEditorPlugins
35
- });
36
- }
37
- }), [
38
- contextValue.cellEditorConfig,
39
- contextValue.cellEditorPlugins
40
- ]),
41
- children: children
42
- }, void 0, false, {
43
- fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
44
- lineNumber: 67,
45
- columnNumber: 5
46
- }, this);
26
+ return <CellContext value={useMemo(()=>({
27
+ cellEditorConfig: contextValue.cellEditorConfig,
28
+ cellEditorPlugins: contextValue.cellEditorPlugins,
29
+ set: (cellEditorConfig, cellEditorPlugins)=>{
30
+ setContextValue({
31
+ cellEditorConfig,
32
+ cellEditorPlugins
33
+ });
34
+ }
35
+ }), [
36
+ contextValue.cellEditorConfig,
37
+ contextValue.cellEditorPlugins
38
+ ])}>
39
+ {children}
40
+ </CellContext>;
47
41
  }
48
42
  export const TablePlugin = ()=>{
49
43
  const [editor] = useLexicalComposerContext();
@@ -81,43 +75,18 @@ export const TablePlugin = ()=>{
81
75
  editor,
82
76
  toggleDrawer
83
77
  ]);
84
- return /*#__PURE__*/ _jsxDEV(React.Fragment, {
85
- children: [
86
- /*#__PURE__*/ _jsxDEV(FieldsDrawer, {
87
- drawerSlug: drawerSlug,
88
- drawerTitle: "Create Table",
89
- featureKey: "experimental_table",
90
- handleDrawerSubmit: (_fields, data)=>{
91
- if (!data.columns || !data.rows) {
92
- return;
93
- }
94
- editor.dispatchCommand(INSERT_TABLE_COMMAND, {
95
- columns: String(data.columns),
96
- rows: String(data.rows)
97
- });
98
- },
99
- schemaPath: schemaPath,
100
- schemaPathSuffix: "fields"
101
- }, void 0, false, {
102
- fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
103
- lineNumber: 131,
104
- columnNumber: 7
105
- }, this),
106
- /*#__PURE__*/ _jsxDEV(LexicalReactTablePlugin, {
107
- hasCellBackgroundColor: false,
108
- hasCellMerge: true,
109
- hasHorizontalScroll: true
110
- }, void 0, false, {
111
- fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
112
- lineNumber: 148,
113
- columnNumber: 7
114
- }, this)
115
- ]
116
- }, void 0, true, {
117
- fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
118
- lineNumber: 130,
119
- columnNumber: 5
120
- }, this);
78
+ return <React.Fragment>
79
+ <FieldsDrawer drawerSlug={drawerSlug} drawerTitle="Create Table" featureKey="experimental_table" handleDrawerSubmit={(_fields, data)=>{
80
+ if (!data.columns || !data.rows) {
81
+ return;
82
+ }
83
+ editor.dispatchCommand(INSERT_TABLE_COMMAND, {
84
+ columns: String(data.columns),
85
+ rows: String(data.rows)
86
+ });
87
+ }} schemaPath={schemaPath} schemaPathSuffix="fields"/>
88
+ <LexicalReactTablePlugin hasCellBackgroundColor={false} hasCellMerge hasHorizontalScroll={true}/>
89
+ </React.Fragment>;
121
90
  };
122
91
 
123
92
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/experimental_table/client/plugins/TablePlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type {\n EditorThemeClasses,\n Klass,\n LexicalCommand,\n LexicalEditor,\n LexicalNode,\n RangeSelection,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TablePlugin as LexicalReactTablePlugin } from '@lexical/react/LexicalTablePlugin'\nimport { INSERT_TABLE_COMMAND, TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { mergeRegister } from '@lexical/utils'\nimport { formatDrawerSlug, useEditDepth } from '@payloadcms/ui'\nimport { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical'\nimport { createContext, use, useEffect, useMemo, useState } from 'react'\nimport * as React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDrawer } from '../../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport './index.scss'\n\nexport type CellContextShape = {\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n set: (\n cellEditorConfig: CellEditorConfig | null,\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null,\n ) => void\n}\n\nexport type CellEditorConfig = Readonly<{\n namespace: string\n nodes?: ReadonlyArray<Klass<LexicalNode>>\n onError: (error: Error, editor: LexicalEditor) => void\n readOnly?: boolean\n theme?: EditorThemeClasses\n}>\n\nexport const OPEN_TABLE_DRAWER_COMMAND: LexicalCommand<{}> = createCommand(\n 'OPEN_EMBED_DRAWER_COMMAND',\n)\n\nexport const CellContext = createContext<CellContextShape>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n set: () => {\n // Empty\n },\n})\n\nexport function TableContext({ children }: { children: JSX.Element }) {\n const [contextValue, setContextValue] = useState<{\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n }>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n })\n return (\n <CellContext\n value={useMemo(\n () => ({\n cellEditorConfig: contextValue.cellEditorConfig,\n cellEditorPlugins: contextValue.cellEditorPlugins,\n set: (cellEditorConfig, cellEditorPlugins) => {\n setContextValue({ cellEditorConfig, cellEditorPlugins })\n },\n }),\n [contextValue.cellEditorConfig, contextValue.cellEditorPlugins],\n )}\n >\n {children}\n </CellContext>\n )\n}\n\nexport const TablePlugin: PluginComponent = () => {\n const [editor] = useLexicalComposerContext()\n const cellContext = use(CellContext)\n const editDepth = useEditDepth()\n const {\n fieldProps: { schemaPath },\n uuid,\n } = useEditorConfigContext()\n\n const drawerSlug = formatDrawerSlug({\n slug: 'lexical-table-create-' + uuid,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n useEffect(() => {\n if (!editor.hasNodes([TableNode, TableRowNode, TableCellNode])) {\n throw new Error(\n 'TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor',\n )\n }\n\n return mergeRegister(\n editor.registerCommand(\n OPEN_TABLE_DRAWER_COMMAND,\n () => {\n let rangeSelection: null | RangeSelection = null\n\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if ($isRangeSelection(selection)) {\n rangeSelection = selection\n }\n })\n\n if (rangeSelection) {\n toggleDrawer()\n }\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n ),\n )\n }, [cellContext, editor, toggleDrawer])\n\n return (\n <React.Fragment>\n <FieldsDrawer\n drawerSlug={drawerSlug}\n drawerTitle=\"Create Table\"\n featureKey=\"experimental_table\"\n handleDrawerSubmit={(_fields, data) => {\n if (!data.columns || !data.rows) {\n return\n }\n\n editor.dispatchCommand(INSERT_TABLE_COMMAND, {\n columns: String(data.columns),\n rows: String(data.rows),\n })\n }}\n schemaPath={schemaPath}\n schemaPathSuffix=\"fields\"\n />\n <LexicalReactTablePlugin\n hasCellBackgroundColor={false}\n hasCellMerge\n hasHorizontalScroll={true}\n />\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","TablePlugin","LexicalReactTablePlugin","INSERT_TABLE_COMMAND","TableCellNode","TableNode","TableRowNode","mergeRegister","formatDrawerSlug","useEditDepth","$getSelection","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","createContext","use","useEffect","useMemo","useState","React","useEditorConfigContext","FieldsDrawer","useLexicalDrawer","OPEN_TABLE_DRAWER_COMMAND","CellContext","cellEditorConfig","cellEditorPlugins","set","TableContext","children","contextValue","setContextValue","value","editor","cellContext","editDepth","fieldProps","schemaPath","uuid","drawerSlug","slug","depth","toggleDrawer","hasNodes","Error","registerCommand","rangeSelection","getEditorState","read","selection","Fragment","drawerTitle","featureKey","handleDrawerSubmit","_fields","data","columns","rows","dispatchCommand","String","schemaPathSuffix","hasCellBackgroundColor","hasCellMerge","hasHorizontalScroll"],"mappings":"AAAA;;AAYA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,eAAeC,uBAAuB,QAAQ,oCAAmC;AAC1F,SAASC,oBAAoB,EAAEC,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ,iBAAgB;AAC7F,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,iBAAgB;AAC/D,SAASC,aAAa,EAAEC,iBAAiB,EAAEC,uBAAuB,EAAEC,aAAa,QAAQ,UAAS;AAClG,SAASC,aAAa,EAAEC,GAAG,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACxE,YAAYC,WAAW,QAAO;AAI9B,SAASC,sBAAsB,QAAQ,+DAA8D;AACrG,SAASC,YAAY,QAAQ,kDAAiD;AAC9E,SAASC,gBAAgB,QAAQ,4DAA2D;AAC5F,OAAO,eAAc;AAmBrB,OAAO,MAAMC,4BAAgDV,cAC3D,6BACD;AAED,OAAO,MAAMW,4BAAcV,cAAgC;IACzDW,kBAAkB;IAClBC,mBAAmB;IACnBC,KAAK,KAEL;AACF,GAAE;AAFE,QAAQ;AAIZ,OAAO,SAASC,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ACXC,oBAAoB,CAACC,SAASC;oBAC5B,IAAI,CAACA,KAAKC,OAAO,IAAI,CAACD,KAAKE,IAAI,EAAE;wBAC/B;oBACF;oBAEAxB,OAAOyB,eAAe,CAACvD,sBAAsB;wBAC3CqD,SAASG,OAAOJ,KAAKC,OAAO;wBAC5BC,MAAME,OAAOJ,KAAKE,IAAI;oBACxB;gBACF;gBACApB,YAAYA;gBACZuB,kBAAiB;;;;;;0BAEnB,QAAC1D;gBACC2D,wBAAwB;gBACxBC,YAAY;gBACZC,qBAAqB;;;;;;;;;;;;AAI7B,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/experimental_table/client/plugins/TablePlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type {\n EditorThemeClasses,\n Klass,\n LexicalCommand,\n LexicalEditor,\n LexicalNode,\n RangeSelection,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TablePlugin as LexicalReactTablePlugin } from '@lexical/react/LexicalTablePlugin'\nimport { INSERT_TABLE_COMMAND, TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { mergeRegister } from '@lexical/utils'\nimport { formatDrawerSlug, useEditDepth } from '@payloadcms/ui'\nimport { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical'\nimport { createContext, use, useEffect, useMemo, useState } from 'react'\nimport * as React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDrawer } from '../../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport './index.scss'\n\nexport type CellContextShape = {\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n set: (\n cellEditorConfig: CellEditorConfig | null,\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null,\n ) => void\n}\n\nexport type CellEditorConfig = Readonly<{\n namespace: string\n nodes?: ReadonlyArray<Klass<LexicalNode>>\n onError: (error: Error, editor: LexicalEditor) => void\n readOnly?: boolean\n theme?: EditorThemeClasses\n}>\n\nexport const OPEN_TABLE_DRAWER_COMMAND: LexicalCommand<{}> = createCommand(\n 'OPEN_EMBED_DRAWER_COMMAND',\n)\n\nexport const CellContext = createContext<CellContextShape>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n set: () => {\n // Empty\n },\n})\n\nexport function TableContext({ children }: { children: JSX.Element }) {\n const [contextValue, setContextValue] = useState<{\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n }>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n })\n return (\n <CellContext\n value={useMemo(\n () => ({\n cellEditorConfig: contextValue.cellEditorConfig,\n cellEditorPlugins: contextValue.cellEditorPlugins,\n set: (cellEditorConfig, cellEditorPlugins) => {\n setContextValue({ cellEditorConfig, cellEditorPlugins })\n },\n }),\n [contextValue.cellEditorConfig, contextValue.cellEditorPlugins],\n )}\n >\n {children}\n </CellContext>\n )\n}\n\nexport const TablePlugin: PluginComponent = () => {\n const [editor] = useLexicalComposerContext()\n const cellContext = use(CellContext)\n const editDepth = useEditDepth()\n const {\n fieldProps: { schemaPath },\n uuid,\n } = useEditorConfigContext()\n\n const drawerSlug = formatDrawerSlug({\n slug: 'lexical-table-create-' + uuid,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n useEffect(() => {\n if (!editor.hasNodes([TableNode, TableRowNode, TableCellNode])) {\n throw new Error(\n 'TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor',\n )\n }\n\n return mergeRegister(\n editor.registerCommand(\n OPEN_TABLE_DRAWER_COMMAND,\n () => {\n let rangeSelection: null | RangeSelection = null\n\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if ($isRangeSelection(selection)) {\n rangeSelection = selection\n }\n })\n\n if (rangeSelection) {\n toggleDrawer()\n }\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n ),\n )\n }, [cellContext, editor, toggleDrawer])\n\n return (\n <React.Fragment>\n <FieldsDrawer\n drawerSlug={drawerSlug}\n drawerTitle=\"Create Table\"\n featureKey=\"experimental_table\"\n handleDrawerSubmit={(_fields, data) => {\n if (!data.columns || !data.rows) {\n return\n }\n\n editor.dispatchCommand(INSERT_TABLE_COMMAND, {\n columns: String(data.columns),\n rows: String(data.rows),\n })\n }}\n schemaPath={schemaPath}\n schemaPathSuffix=\"fields\"\n />\n <LexicalReactTablePlugin\n hasCellBackgroundColor={false}\n hasCellMerge\n hasHorizontalScroll={true}\n />\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","TablePlugin","LexicalReactTablePlugin","INSERT_TABLE_COMMAND","TableCellNode","TableNode","TableRowNode","mergeRegister","formatDrawerSlug","useEditDepth","$getSelection","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","createContext","use","useEffect","useMemo","useState","React","useEditorConfigContext","FieldsDrawer","useLexicalDrawer","OPEN_TABLE_DRAWER_COMMAND","CellContext","cellEditorConfig","cellEditorPlugins","set","TableContext","children","contextValue","setContextValue","value","editor","cellContext","editDepth","fieldProps","schemaPath","uuid","drawerSlug","slug","depth","toggleDrawer","hasNodes","Error","registerCommand","rangeSelection","getEditorState","read","selection","Fragment","drawerTitle","featureKey","handleDrawerSubmit","_fields","data","columns","rows","dispatchCommand","String","schemaPathSuffix","hasCellBackgroundColor","hasCellMerge","hasHorizontalScroll"],"mappings":"AAAA;AAYA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,eAAeC,uBAAuB,QAAQ,oCAAmC;AAC1F,SAASC,oBAAoB,EAAEC,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ,iBAAgB;AAC7F,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SAASC,gBAAgB,EAAEC,YAAY,QAAQ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,UAAU;QACR,IAAI,CAACiB,OAAOU,QAAQ,CAAC;YAACtC;YAAWC;YAAcF;SAAc,GAAG;YAC9D,MAAM,IAAIwC,MACR;QAEJ;QAEA,OAAOrC,cACL0B,OAAOY,eAAe,CACpBtB,2BACA;YACE,IAAIuB,iBAAwC;YAE5Cb,OAAOc,cAAc,GAAGC,IAAI,CAAC;gBAC3B,MAAMC,YAAYvC;gBAClB,IAAIC,kBAAkBsC,YAAY;oBAChCH,iBAAiBG;gBACnB;YACF;YAEA,IAAIH,gBAAgB;gBAClBJ;YACF;YACA,OAAO;QACT,GACA9B;IAGN,GAAG;QAACsB;QAAaD;QAAQS;KAAa;IAEtC,QACGvB,MAAM+B,SAAS;MACd,CAAC7B,aACCkB,YAAYA,YACZY,YAAY,eACZC,WAAW,qBACXC,oBAAoB,CAACC,SAASC;QAC5B,IAAI,CAACA,KAAKC,OAAO,IAAI,CAACD,KAAKE,IAAI,EAAE;YAC/B;QACF;QAEAxB,OAAOyB,eAAe,CAACvD,sBAAsB;YAC3CqD,SAASG,OAAOJ,KAAKC,OAAO;YAC5BC,MAAME,OAAOJ,KAAKE,IAAI;QACxB;IACF,GACApB,YAAYA,YACZuB,iBAAiB,UACjB;MACF,CAAC1D,wBACC2D,wBAAwB,OACxBC,aACAC,qBAAqB,OACrB;IACJ,EAAE5C,MAAM+B;AAEZ,EAAC"}
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
  import { $applyNodeReplacement } from 'lexical';
3
- import * as React from 'react';
4
3
  import { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js';
5
4
  export class HorizontalRuleNode extends HorizontalRuleServerNode {
6
5
  static clone(node) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["'use client'\nimport type { DOMConversionOutput, LexicalNode, SerializedLexicalNode } from 'lexical'\n\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { SerializedHorizontalRuleNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nimport { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nexport class HorizontalRuleNode extends HorizontalRuleServerNode {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n override decorate() {\n return null\n }\n\n override exportJSON(): SerializedLexicalNode {\n return super.exportJSON()\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleNode() }\n}\n\nexport function $createHorizontalRuleNode(): HorizontalRuleNode {\n return $applyNodeReplacement(new HorizontalRuleNode())\n}\n\nexport function $isHorizontalRuleNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleNode {\n return node instanceof HorizontalRuleNode\n}\n"],"names":["$applyNodeReplacement","React","HorizontalRuleServerNode","HorizontalRuleNode","clone","node","getType","importJSON","serializedNode","$createHorizontalRuleNode","decorate","exportJSON","$convertHorizontalRuleElement","$isHorizontalRuleNode"],"mappings":"AAAA;AAGA,SAASA,qBAAqB,QAAQ,UAAS;AAC/C,YAAYC,WAAW,QAAO;AAI9B,SAASC,wBAAwB,QAAQ,2CAA0C;AAEnF,OAAO,MAAMC,2BAA2BD;IACtC,OAAgBE,MAAMC,IAA8B,EAA4B;QAC9E,OAAO,KAAK,CAACD,MAAMC;IACrB;IAEA,OAAgBC,UAAkB;QAChC,OAAO,KAAK,CAACA;IACf;IAEA;;GAEC,GACD,OAAgBC,WAAWC,cAA4C,EAAsB;QAC3F,OAAOC;IACT;IAEA;;GAEC,GACD,AAASC,WAAW;QAClB,OAAO;IACT;IAESC,aAAoC;QAC3C,OAAO,KAAK,CAACA;IACf;AACF;AAEA,SAASC;IACP,OAAO;QAAEP,MAAMI;IAA4B;AAC7C;AAEA,OAAO,SAASA;IACd,OAAOT,sBAAsB,IAAIG;AACnC;AAEA,OAAO,SAASU,sBACdR,IAAoC;IAEpC,OAAOA,gBAAgBF;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["'use client'\nimport type { DOMConversionOutput, LexicalNode, SerializedLexicalNode } from 'lexical'\n\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { SerializedHorizontalRuleNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nimport { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nexport class HorizontalRuleNode extends HorizontalRuleServerNode {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n override decorate() {\n return null\n }\n\n override exportJSON(): SerializedLexicalNode {\n return super.exportJSON()\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleNode() }\n}\n\nexport function $createHorizontalRuleNode(): HorizontalRuleNode {\n return $applyNodeReplacement(new HorizontalRuleNode())\n}\n\nexport function $isHorizontalRuleNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleNode {\n return node instanceof HorizontalRuleNode\n}\n"],"names":["$applyNodeReplacement","HorizontalRuleServerNode","HorizontalRuleNode","clone","node","getType","importJSON","serializedNode","$createHorizontalRuleNode","decorate","exportJSON","$convertHorizontalRuleElement","$isHorizontalRuleNode"],"mappings":"AAAA;AAGA,SAASA,qBAAqB,QAAQ,UAAS;AAK/C,SAASC,wBAAwB,QAAQ,2CAA0C;AAEnF,OAAO,MAAMC,2BAA2BD;IACtC,OAAgBE,MAAMC,IAA8B,EAA4B;QAC9E,OAAO,KAAK,CAACD,MAAMC;IACrB;IAEA,OAAgBC,UAAkB;QAChC,OAAO,KAAK,CAACA;IACf;IAEA;;GAEC,GACD,OAAgBC,WAAWC,cAA4C,EAAsB;QAC3F,OAAOC;IACT;IAEA;;GAEC,GACD,AAASC,WAAW;QAClB,OAAO;IACT;IAESC,aAAoC;QAC3C,OAAO,KAAK,CAACA;IACf;AACF;AAEA,SAASC;IACP,OAAO;QAAEP,MAAMI;IAA4B;AAC7C;AAEA,OAAO,SAASA;IACd,OAAOR,sBAAsB,IAAIE;AACnC;AAEA,OAAO,SAASU,sBACdR,IAAoC;IAEpC,OAAOA,gBAAgBF;AACzB"}
@@ -1,4 +1,3 @@
1
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
1
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
2
  import { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin';
4
3
  import { $findMatchingParent, mergeRegister } from '@lexical/utils';
@@ -56,11 +55,7 @@ export const IndentPlugin = ({ clientProps })=>{
56
55
  editor,
57
56
  disableTabNode
58
57
  ]);
59
- return /*#__PURE__*/ _jsxDEV(TabIndentationPlugin, {}, void 0, false, {
60
- fileName: "src/features/indent/client/IndentPlugin.tsx",
61
- lineNumber: 87,
62
- columnNumber: 10
63
- }, this);
58
+ return <TabIndentationPlugin/>;
64
59
  };
65
60
  function $handleIndentAndOutdent(indentOrOutdent) {
66
61
  const selection = $getSelection();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/features/indent/client/IndentPlugin.tsx"],"sourcesContent":["import type { ElementNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n INDENT_CONTENT_COMMAND,\n KEY_TAB_COMMAND,\n OUTDENT_CONTENT_COMMAND,\n TabNode,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../typesClient.js'\nimport type { IndentFeatureProps } from '../server/index.js'\n\nexport const IndentPlugin: PluginComponent<IndentFeatureProps> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n const { disabledNodes, disableTabNode } = clientProps\n\n useEffect(() => {\n if (!editor || !disabledNodes?.length) {\n return\n }\n return mergeRegister(\n editor.registerCommand(\n INDENT_CONTENT_COMMAND,\n () => {\n return $handleIndentAndOutdent((block) => {\n if (!disabledNodes.includes(block.getType())) {\n const indent = block.getIndent()\n block.setIndent(indent + 1)\n }\n })\n },\n COMMAND_PRIORITY_LOW,\n ),\n // If we disable indenting for certain nodes, we need to ensure that these are not indented,\n // if they get transformed from an indented state (e.g. an indented list node gets transformed into a\n // paragraph node for which indenting is disabled).\n editor.registerUpdateListener(({ dirtyElements, editorState }) => {\n editor.update(() => {\n for (const [nodeKey] of dirtyElements) {\n const node = editorState._nodeMap.get(nodeKey)\n if ($isElementNode(node) && disabledNodes.includes(node.getType())) {\n const currentIndent = node.getIndent()\n if (currentIndent > 0) {\n node.setIndent(0)\n }\n }\n }\n })\n }),\n )\n }, [editor, disabledNodes])\n\n useEffect(() => {\n if (!editor || !disableTabNode) {\n return\n }\n return mergeRegister(\n // This is so that when you press Tab in the middle of a paragraph,\n // it indents the paragraph, instead of inserting a TabNode.\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (event) => {\n event.preventDefault()\n return editor.dispatchCommand(\n event.shiftKey ? OUTDENT_CONTENT_COMMAND : INDENT_CONTENT_COMMAND,\n undefined,\n )\n },\n COMMAND_PRIORITY_LOW,\n ),\n // Tab isn't the only way to insert a TabNode. We have to make sure\n // it doesn't happen, for example, when pasting from the clipboard.\n editor.registerNodeTransform(TabNode, (node) => {\n node.remove()\n }),\n )\n }, [editor, disableTabNode])\n\n return <TabIndentationPlugin />\n}\n\nfunction $handleIndentAndOutdent(indentOrOutdent: (block: ElementNode) => void): boolean {\n const selection = $getSelection()\n if (!$isRangeSelection(selection)) {\n return false\n }\n const alreadyHandled = new Set()\n const nodes = selection.getNodes()\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]!\n const key = node.getKey()\n if (alreadyHandled.has(key)) {\n continue\n }\n const parentBlock = $findMatchingParent(\n node,\n (parentNode): parentNode is ElementNode =>\n $isElementNode(parentNode) && !parentNode.isInline(),\n )\n if (parentBlock === null) {\n continue\n }\n const parentKey = parentBlock.getKey()\n if (parentBlock.canIndent() && !alreadyHandled.has(parentKey)) {\n alreadyHandled.add(parentKey)\n indentOrOutdent(parentBlock)\n }\n }\n return alreadyHandled.size > 0\n}\n"],"names":["useLexicalComposerContext","TabIndentationPlugin","$findMatchingParent","mergeRegister","$getSelection","$isElementNode","$isRangeSelection","COMMAND_PRIORITY_LOW","INDENT_CONTENT_COMMAND","KEY_TAB_COMMAND","OUTDENT_CONTENT_COMMAND","TabNode","useEffect","IndentPlugin","clientProps","editor","disabledNodes","disableTabNode","length","registerCommand","$handleIndentAndOutdent","block","includes","getType","indent","getIndent","setIndent","registerUpdateListener","dirtyElements","editorState","update","nodeKey","node","_nodeMap","get","currentIndent","event","preventDefault","dispatchCommand","shiftKey","undefined","registerNodeTransform","remove","indentOrOutdent","selection","alreadyHandled","Set","nodes","getNodes","i","key","getKey","has","parentBlock","parentNode","isInline","parentKey","canIndent","add","size"],"mappings":";AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,oBAAoB,QAAQ,6CAA4C;AACjF,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SACEC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,oBAAoB,EACpB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,wBAC3CgC;QAEJ,GACAjC,uBAEF,mEAAmE;QACnE,mEAAmE;QACnEQ,OAAO0B,qBAAqB,CAAC9B,SAAS,CAACqB;YACrCA,KAAKU,MAAM;QACb;IAEJ,GAAG;QAAC3B;QAAQE;KAAe;IAE3B,qBAAO,QAAChB;;;;;AACV,EAAC;AAED,SAASmB,wBAAwBuB,eAA6C;IAC5E,MAAMC,YAAYxC;IAClB,IAAI,CAACE,kBAAkBsC,YAAY;QACjC,OAAO;IACT;IACA,MAAMC,iBAAiB,IAAIC;IAC3B,MAAMC,QAAQH,UAAUI,QAAQ;IAChC,IAAK,IAAIC,IAAI,GAAGA,IAAIF,MAAM7B,MAAM,EAAE+B,IAAK;QACrC,MAAMjB,OAAOe,KAAK,CAACE,EAAE;QACrB,MAAMC,MAAMlB,KAAKmB,MAAM;QACvB,IAAIN,eAAeO,GAAG,CAACF,MAAM;YAC3B;QACF;QACA,MAAMG,cAAcnD,oBAClB8B,MACA,CAACsB,aACCjD,eAAeiD,eAAe,CAACA,WAAWC,QAAQ;QAEtD,IAAIF,gBAAgB,MAAM;YACxB;QACF;QACA,MAAMG,YAAYH,YAAYF,MAAM;QACpC,IAAIE,YAAYI,SAAS,MAAM,CAACZ,eAAeO,GAAG,CAACI,YAAY;YAC7DX,eAAea,GAAG,CAACF;YACnBb,gBAAgBU;QAClB;IACF;IACA,OAAOR,eAAec,IAAI,GAAG;AAC/B"}
1
+ {"version":3,"sources":["../../../../src/features/indent/client/IndentPlugin.tsx"],"sourcesContent":["import type { ElementNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n INDENT_CONTENT_COMMAND,\n KEY_TAB_COMMAND,\n OUTDENT_CONTENT_COMMAND,\n TabNode,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../typesClient.js'\nimport type { IndentFeatureProps } from '../server/index.js'\n\nexport const IndentPlugin: PluginComponent<IndentFeatureProps> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n const { disabledNodes, disableTabNode } = clientProps\n\n useEffect(() => {\n if (!editor || !disabledNodes?.length) {\n return\n }\n return mergeRegister(\n editor.registerCommand(\n INDENT_CONTENT_COMMAND,\n () => {\n return $handleIndentAndOutdent((block) => {\n if (!disabledNodes.includes(block.getType())) {\n const indent = block.getIndent()\n block.setIndent(indent + 1)\n }\n })\n },\n COMMAND_PRIORITY_LOW,\n ),\n // If we disable indenting for certain nodes, we need to ensure that these are not indented,\n // if they get transformed from an indented state (e.g. an indented list node gets transformed into a\n // paragraph node for which indenting is disabled).\n editor.registerUpdateListener(({ dirtyElements, editorState }) => {\n editor.update(() => {\n for (const [nodeKey] of dirtyElements) {\n const node = editorState._nodeMap.get(nodeKey)\n if ($isElementNode(node) && disabledNodes.includes(node.getType())) {\n const currentIndent = node.getIndent()\n if (currentIndent > 0) {\n node.setIndent(0)\n }\n }\n }\n })\n }),\n )\n }, [editor, disabledNodes])\n\n useEffect(() => {\n if (!editor || !disableTabNode) {\n return\n }\n return mergeRegister(\n // This is so that when you press Tab in the middle of a paragraph,\n // it indents the paragraph, instead of inserting a TabNode.\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (event) => {\n event.preventDefault()\n return editor.dispatchCommand(\n event.shiftKey ? OUTDENT_CONTENT_COMMAND : INDENT_CONTENT_COMMAND,\n undefined,\n )\n },\n COMMAND_PRIORITY_LOW,\n ),\n // Tab isn't the only way to insert a TabNode. We have to make sure\n // it doesn't happen, for example, when pasting from the clipboard.\n editor.registerNodeTransform(TabNode, (node) => {\n node.remove()\n }),\n )\n }, [editor, disableTabNode])\n\n return <TabIndentationPlugin />\n}\n\nfunction $handleIndentAndOutdent(indentOrOutdent: (block: ElementNode) => void): boolean {\n const selection = $getSelection()\n if (!$isRangeSelection(selection)) {\n return false\n }\n const alreadyHandled = new Set()\n const nodes = selection.getNodes()\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]!\n const key = node.getKey()\n if (alreadyHandled.has(key)) {\n continue\n }\n const parentBlock = $findMatchingParent(\n node,\n (parentNode): parentNode is ElementNode =>\n $isElementNode(parentNode) && !parentNode.isInline(),\n )\n if (parentBlock === null) {\n continue\n }\n const parentKey = parentBlock.getKey()\n if (parentBlock.canIndent() && !alreadyHandled.has(parentKey)) {\n alreadyHandled.add(parentKey)\n indentOrOutdent(parentBlock)\n }\n }\n return alreadyHandled.size > 0\n}\n"],"names":["useLexicalComposerContext","TabIndentationPlugin","$findMatchingParent","mergeRegister","$getSelection","$isElementNode","$isRangeSelection","COMMAND_PRIORITY_LOW","INDENT_CONTENT_COMMAND","KEY_TAB_COMMAND","OUTDENT_CONTENT_COMMAND","TabNode","useEffect","IndentPlugin","clientProps","editor","disabledNodes","disableTabNode","length","registerCommand","$handleIndentAndOutdent","block","includes","getType","indent","getIndent","setIndent","registerUpdateListener","dirtyElements","editorState","update","nodeKey","node","_nodeMap","get","currentIndent","event","preventDefault","dispatchCommand","shiftKey","undefined","registerNodeTransform","remove","indentOrOutdent","selection","alreadyHandled","Set","nodes","getNodes","i","key","getKey","has","parentBlock","parentNode","isInline","parentKey","canIndent","add","size"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,oBAAoB,QAAQ,6CAA4C;AACjF,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SACEC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,EACtBC,eAAe,EACfC,uBAAuB,EACvBC,OAAO,QACF,UAAS;AAChB,SAASC,SAAS,QAAQ,QAAO;AAKjC,OAAO,MAAMC,eAAoD,CAAC,EAAEC,WAAW,EAAE;IAC/E,MAAM,CAACC,OAAO,GAAGf;IAC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V,EAAC;AAED,SAASmB,wBAAwBuB,eAA6C;IAC5E,MAAMC,YAAYxC;IAClB,IAAI,CAACE,kBAAkBsC,YAAY;QACjC,OAAO;IACT;IACA,MAAMC,iBAAiB,IAAIC;IAC3B,MAAMC,QAAQH,UAAUI,QAAQ;IAChC,IAAK,IAAIC,IAAI,GAAGA,IAAIF,MAAM7B,MAAM,EAAE+B,IAAK;QACrC,MAAMjB,OAAOe,KAAK,CAACE,EAAE;QACrB,MAAMC,MAAMlB,KAAKmB,MAAM;QACvB,IAAIN,eAAeO,GAAG,CAACF,MAAM;YAC3B;QACF;QACA,MAAMG,cAAcnD,oBAClB8B,MACA,CAACsB,aACCjD,eAAeiD,eAAe,CAACA,WAAWC,QAAQ;QAEtD,IAAIF,gBAAgB,MAAM;YACxB;QACF;QACA,MAAMG,YAAYH,YAAYF,MAAM;QACpC,IAAIE,YAAYI,SAAS,MAAM,CAACZ,eAAeO,GAAG,CAACI,YAAY;YAC7DX,eAAea,GAAG,CAACF;YACnBb,gBAAgBU;QAClB;IACF;IACA,OAAOR,eAAec,IAAI,GAAG;AAC/B"}
@@ -1,13 +1,7 @@
1
1
  'use client';
2
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
2
  import { ClickableLinkPlugin as LexicalClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin.js';
4
- import React from 'react';
5
3
  export const ClickableLinkPlugin = ()=>{
6
- return /*#__PURE__*/ _jsxDEV(LexicalClickableLinkPlugin, {}, void 0, false, {
7
- fileName: "src/features/link/client/plugins/clickableLink/index.tsx",
8
- lineNumber: 9,
9
- columnNumber: 10
10
- }, this);
4
+ return <LexicalClickableLinkPlugin/>;
11
5
  };
12
6
 
13
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/link/client/plugins/clickableLink/index.tsx"],"sourcesContent":["'use client'\nimport { ClickableLinkPlugin as LexicalClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin.js'\nimport React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\nimport type { ClientProps } from '../../index.js'\n\nexport const ClickableLinkPlugin: PluginComponent<ClientProps> = () => {\n return <LexicalClickableLinkPlugin />\n}\n"],"names":["ClickableLinkPlugin","LexicalClickableLinkPlugin","React"],"mappings":"AAAA;;AACA,SAASA,uBAAuBC,0BAA0B,QAAQ,+CAA8C;AAChH,OAAOC,WAAW,QAAO;AAKzB,OAAO,MAAMF,sBAAoD;IAC/D,qBAAO,QAACC;;;;;AACV,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/link/client/plugins/clickableLink/index.tsx"],"sourcesContent":["'use client'\nimport { ClickableLinkPlugin as LexicalClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin.js'\nimport React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\nimport type { ClientProps } from '../../index.js'\n\nexport const ClickableLinkPlugin: PluginComponent<ClientProps> = () => {\n return <LexicalClickableLinkPlugin />\n}\n"],"names":["ClickableLinkPlugin","LexicalClickableLinkPlugin"],"mappings":"AAAA;AACA,SAASA,uBAAuBC,0BAA0B,QAAQ,+CAA8C;AAMhH,OAAO,MAAMD,sBAAoD;IAC/D,QAAQC;AACV,EAAC"}
@@ -1,5 +1,4 @@
1
1
  'use client';
2
- import { jsxDEV as _jsxDEV, Fragment as _Fragment } from "react/jsx-dev-runtime";
3
2
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
4
3
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
5
4
  import { $findMatchingParent, mergeRegister } from '@lexical/utils';
@@ -248,156 +247,65 @@ export function LinkEditor({ anchorElem }) {
248
247
  editor,
249
248
  $updateLinkEditor
250
249
  ]);
251
- return /*#__PURE__*/ _jsxDEV(React.Fragment, {
252
- children: [
253
- /*#__PURE__*/ _jsxDEV("div", {
254
- className: "link-editor",
255
- ref: editorRef,
256
- children: /*#__PURE__*/ _jsxDEV("div", {
257
- className: "link-input",
258
- children: [
259
- linkUrl && linkUrl.length > 0 ? /*#__PURE__*/ _jsxDEV("a", {
260
- href: linkUrl,
261
- rel: "noopener noreferrer",
262
- target: "_blank",
263
- children: [
264
- linkNode?.__fields.newTab ? /*#__PURE__*/ _jsxDEV(ExternalLinkIcon, {}, void 0, false, {
265
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
266
- lineNumber: 348,
267
- columnNumber: 44
268
- }, this) : null,
269
- linkLabel != null && linkLabel.length > 0 ? linkLabel : linkUrl
270
- ]
271
- }, void 0, true, {
272
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
273
- lineNumber: 347,
274
- columnNumber: 13
275
- }, this) : linkLabel != null && linkLabel.length > 0 ? /*#__PURE__*/ _jsxDEV(_Fragment, {
276
- children: [
277
- linkNode?.__fields.newTab ? /*#__PURE__*/ _jsxDEV(ExternalLinkIcon, {}, void 0, false, {
278
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
279
- lineNumber: 353,
280
- columnNumber: 44
281
- }, this) : null,
282
- /*#__PURE__*/ _jsxDEV("span", {
283
- className: "link-input__label-pure",
284
- children: linkLabel
285
- }, void 0, false, {
286
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
287
- lineNumber: 354,
288
- columnNumber: 15
289
- }, this)
290
- ]
291
- }, void 0, true) : null,
292
- isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
293
- children: [
294
- /*#__PURE__*/ _jsxDEV("button", {
295
- "aria-label": "Edit link",
296
- className: "link-edit",
297
- onClick: (event)=>{
298
- event.preventDefault();
299
- toggleDrawer();
300
- },
301
- onMouseDown: preventDefault,
302
- tabIndex: 0,
303
- type: "button",
304
- children: /*#__PURE__*/ _jsxDEV(EditIcon, {}, void 0, false, {
305
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
306
- lineNumber: 371,
307
- columnNumber: 17
308
- }, this)
309
- }, void 0, false, {
310
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
311
- lineNumber: 360,
312
- columnNumber: 15
313
- }, this),
314
- !isAutoLink && /*#__PURE__*/ _jsxDEV("button", {
315
- "aria-label": "Remove link",
316
- className: "link-trash",
317
- onClick: ()=>{
318
- editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
319
- },
320
- onMouseDown: preventDefault,
321
- tabIndex: 0,
322
- type: "button",
323
- children: /*#__PURE__*/ _jsxDEV(CloseMenuIcon, {}, void 0, false, {
324
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
325
- lineNumber: 384,
326
- columnNumber: 19
327
- }, this)
328
- }, void 0, false, {
329
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
330
- lineNumber: 374,
331
- columnNumber: 17
332
- }, this)
333
- ]
334
- }, void 0, true, {
335
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
336
- lineNumber: 359,
337
- columnNumber: 13
338
- }, this)
339
- ]
340
- }, void 0, true, {
341
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
342
- lineNumber: 345,
343
- columnNumber: 9
344
- }, this)
345
- }, void 0, false, {
346
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
347
- lineNumber: 344,
348
- columnNumber: 7
349
- }, this),
350
- /*#__PURE__*/ _jsxDEV(FieldsDrawer, {
351
- className: "lexical-link-edit-drawer",
352
- data: stateData,
353
- drawerSlug: drawerSlug,
354
- drawerTitle: t('fields:editLink'),
355
- featureKey: "link",
356
- handleDrawerSubmit: (fields, data)=>{
357
- const newLinkPayload = data;
358
- const bareLinkFields = {
359
- ...newLinkPayload
360
- };
361
- delete bareLinkFields.text;
362
- // See: https://github.com/facebook/lexical/pull/5536. This updates autolink nodes to link nodes whenever a change was made (which is good!).
363
- editor.update(()=>{
364
- const selection = $getSelection();
365
- let linkParent = null;
366
- if ($isRangeSelection(selection)) {
367
- linkParent = getSelectedNode(selection).getParent();
368
- } else {
369
- if (selectedNodes.length) {
370
- linkParent = selectedNodes[0]?.getParent() ?? null;
371
- }
372
- }
373
- if (linkParent && $isAutoLinkNode(linkParent)) {
374
- const linkNode = $createLinkNode({
375
- fields: bareLinkFields
376
- });
377
- linkParent.replace(linkNode, true);
378
- }
379
- });
380
- // Needs to happen AFTER a potential auto link => link node conversion, as otherwise, the updated text to display may be lost due to
381
- // it being applied to the auto link node instead of the link node.
382
- editor.dispatchCommand(TOGGLE_LINK_COMMAND, {
383
- fields: bareLinkFields,
384
- selectedNodes,
385
- text: newLinkPayload.text
386
- });
387
- },
388
- schemaPath: schemaPath,
389
- schemaPathSuffix: "fields"
390
- }, void 0, false, {
391
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
392
- lineNumber: 391,
393
- columnNumber: 7
394
- }, this)
395
- ]
396
- }, void 0, true, {
397
- fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
398
- lineNumber: 343,
399
- columnNumber: 5
400
- }, this);
250
+ return <React.Fragment>
251
+ <div className="link-editor" ref={editorRef}>
252
+ <div className="link-input">
253
+ {linkUrl && linkUrl.length > 0 ? <a href={linkUrl} rel="noopener noreferrer" target="_blank">
254
+ {linkNode?.__fields.newTab ? <ExternalLinkIcon/> : null}
255
+ {linkLabel != null && linkLabel.length > 0 ? linkLabel : linkUrl}
256
+ </a> : linkLabel != null && linkLabel.length > 0 ? <>
257
+ {linkNode?.__fields.newTab ? <ExternalLinkIcon/> : null}
258
+ <span className="link-input__label-pure">{linkLabel}</span>
259
+ </> : null}
260
+
261
+ {isEditable && <React.Fragment>
262
+ <button aria-label="Edit link" className="link-edit" onClick={(event)=>{
263
+ event.preventDefault();
264
+ toggleDrawer();
265
+ }} onMouseDown={preventDefault} tabIndex={0} type="button">
266
+ <EditIcon/>
267
+ </button>
268
+ {!isAutoLink && <button aria-label="Remove link" className="link-trash" onClick={()=>{
269
+ editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
270
+ }} onMouseDown={preventDefault} tabIndex={0} type="button">
271
+ <CloseMenuIcon/>
272
+ </button>}
273
+ </React.Fragment>}
274
+ </div>
275
+ </div>
276
+ <FieldsDrawer className="lexical-link-edit-drawer" data={stateData} drawerSlug={drawerSlug} drawerTitle={t('fields:editLink')} featureKey="link" handleDrawerSubmit={(fields, data)=>{
277
+ const newLinkPayload = data;
278
+ const bareLinkFields = {
279
+ ...newLinkPayload
280
+ };
281
+ delete bareLinkFields.text;
282
+ // See: https://github.com/facebook/lexical/pull/5536. This updates autolink nodes to link nodes whenever a change was made (which is good!).
283
+ editor.update(()=>{
284
+ const selection = $getSelection();
285
+ let linkParent = null;
286
+ if ($isRangeSelection(selection)) {
287
+ linkParent = getSelectedNode(selection).getParent();
288
+ } else {
289
+ if (selectedNodes.length) {
290
+ linkParent = selectedNodes[0]?.getParent() ?? null;
291
+ }
292
+ }
293
+ if (linkParent && $isAutoLinkNode(linkParent)) {
294
+ const linkNode = $createLinkNode({
295
+ fields: bareLinkFields
296
+ });
297
+ linkParent.replace(linkNode, true);
298
+ }
299
+ });
300
+ // Needs to happen AFTER a potential auto link => link node conversion, as otherwise, the updated text to display may be lost due to
301
+ // it being applied to the auto link node instead of the link node.
302
+ editor.dispatchCommand(TOGGLE_LINK_COMMAND, {
303
+ fields: bareLinkFields,
304
+ selectedNodes,
305
+ text: newLinkPayload.text
306
+ });
307
+ }} schemaPath={schemaPath} schemaPathSuffix="fields"/>
308
+ </React.Fragment>;
401
309
  }
402
310
 
403
311
  //# sourceMappingURL=index.js.map