@webiny/lexical-editor 6.0.0-beta.0 → 6.0.0-rc.1

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 (264) hide show
  1. package/README.md +6 -12
  2. package/commands/image.d.ts +2 -2
  3. package/commands/image.js +2 -8
  4. package/commands/image.js.map +1 -1
  5. package/commands/index.d.ts +5 -3
  6. package/commands/index.js +5 -38
  7. package/commands/index.js.map +1 -1
  8. package/commands/list.d.ts +2 -2
  9. package/commands/list.js +4 -10
  10. package/commands/list.js.map +1 -1
  11. package/commands/quote.d.ts +2 -2
  12. package/commands/quote.js +2 -8
  13. package/commands/quote.js.map +1 -1
  14. package/commands/toolbar.d.ts +1 -0
  15. package/commands/toolbar.js +4 -0
  16. package/commands/toolbar.js.map +1 -0
  17. package/commands/typography.d.ts +8 -0
  18. package/commands/typography.js +4 -0
  19. package/commands/typography.js.map +1 -0
  20. package/components/Editor/EnsureHeadingTagPlugin.d.ts +6 -0
  21. package/components/Editor/EnsureHeadingTagPlugin.js +20 -0
  22. package/components/Editor/EnsureHeadingTagPlugin.js.map +1 -0
  23. package/components/Editor/RichTextEditor.d.ts +29 -12
  24. package/components/Editor/RichTextEditor.js +89 -110
  25. package/components/Editor/RichTextEditor.js.map +1 -1
  26. package/components/Editor/normalizeInputValue.d.ts +6 -0
  27. package/components/Editor/normalizeInputValue.js +16 -0
  28. package/components/Editor/normalizeInputValue.js.map +1 -0
  29. package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +14 -16
  30. package/components/LexicalEditorConfig/LexicalEditorConfig.js +21 -69
  31. package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -1
  32. package/components/LexicalEditorConfig/components/Node.d.ts +1 -1
  33. package/components/LexicalEditorConfig/components/Node.js +17 -26
  34. package/components/LexicalEditorConfig/components/Node.js.map +1 -1
  35. package/components/LexicalEditorConfig/components/Plugin.js +17 -26
  36. package/components/LexicalEditorConfig/components/Plugin.js.map +1 -1
  37. package/components/LexicalEditorConfig/components/ToolbarElement.js +17 -26
  38. package/components/LexicalEditorConfig/components/ToolbarElement.js.map +1 -1
  39. package/components/LexicalHtmlRenderer.d.ts +5 -8
  40. package/components/LexicalHtmlRenderer.js +35 -50
  41. package/components/LexicalHtmlRenderer.js.map +1 -1
  42. package/components/Toolbar/StaticToolbar.css +416 -0
  43. package/components/Toolbar/StaticToolbar.d.ts +3 -1
  44. package/components/Toolbar/StaticToolbar.js +19 -23
  45. package/components/Toolbar/StaticToolbar.js.map +1 -1
  46. package/components/ToolbarActions/BoldAction.js +16 -21
  47. package/components/ToolbarActions/BoldAction.js.map +1 -1
  48. package/components/ToolbarActions/BulletListAction.js +25 -31
  49. package/components/ToolbarActions/BulletListAction.js.map +1 -1
  50. package/components/ToolbarActions/CodeHighlightAction.js +16 -21
  51. package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
  52. package/components/ToolbarActions/FontColorAction.d.ts +16 -4
  53. package/components/ToolbarActions/FontColorAction.js +32 -43
  54. package/components/ToolbarActions/FontColorAction.js.map +1 -1
  55. package/components/ToolbarActions/ImageAction.js +19 -34
  56. package/components/ToolbarActions/ImageAction.js.map +1 -1
  57. package/components/ToolbarActions/ItalicAction.js +16 -21
  58. package/components/ToolbarActions/ItalicAction.js.map +1 -1
  59. package/components/ToolbarActions/LinkAction.js +19 -24
  60. package/components/ToolbarActions/LinkAction.js.map +1 -1
  61. package/components/ToolbarActions/NumberedListAction.js +25 -36
  62. package/components/ToolbarActions/NumberedListAction.js.map +1 -1
  63. package/components/ToolbarActions/QuoteAction.js +20 -25
  64. package/components/ToolbarActions/QuoteAction.js.map +1 -1
  65. package/components/ToolbarActions/TextAlignmentAction.d.ts +16 -4
  66. package/components/ToolbarActions/TextAlignmentAction.js +36 -45
  67. package/components/ToolbarActions/TextAlignmentAction.js.map +1 -1
  68. package/components/ToolbarActions/TypographyAction.d.ts +16 -4
  69. package/components/ToolbarActions/TypographyAction.js +57 -79
  70. package/components/ToolbarActions/TypographyAction.js.map +1 -1
  71. package/components/ToolbarActions/UnderlineAction.js +16 -21
  72. package/components/ToolbarActions/UnderlineAction.js.map +1 -1
  73. package/context/FontColorActionContext.js +2 -9
  74. package/context/FontColorActionContext.js.map +1 -1
  75. package/context/RichTextEditorContext.d.ts +7 -8
  76. package/context/RichTextEditorContext.js +28 -26
  77. package/context/RichTextEditorContext.js.map +1 -1
  78. package/context/SharedHistoryContext.d.ts +3 -3
  79. package/context/SharedHistoryContext.js +12 -20
  80. package/context/SharedHistoryContext.js.map +1 -1
  81. package/context/TextAlignmentActionContextProps.d.ts +1 -1
  82. package/context/TextAlignmentActionContextProps.js +2 -9
  83. package/context/TextAlignmentActionContextProps.js.map +1 -1
  84. package/context/TypographyActionContext.d.ts +3 -2
  85. package/context/TypographyActionContext.js +2 -9
  86. package/context/TypographyActionContext.js.map +1 -1
  87. package/exports/admin/lexical.d.ts +15 -0
  88. package/exports/admin/lexical.js +23 -0
  89. package/exports/admin/lexical.js.map +1 -0
  90. package/hooks/index.d.ts +7 -8
  91. package/hooks/index.js +7 -93
  92. package/hooks/index.js.map +1 -1
  93. package/hooks/useCurrentElement.d.ts +3 -3
  94. package/hooks/useCurrentElement.js +11 -18
  95. package/hooks/useCurrentElement.js.map +1 -1
  96. package/hooks/useCurrentSelection.d.ts +2 -1
  97. package/hooks/useCurrentSelection.js +27 -40
  98. package/hooks/useCurrentSelection.js.map +1 -1
  99. package/hooks/useFontColorPicker.d.ts +1 -1
  100. package/hooks/useFontColorPicker.js +5 -11
  101. package/hooks/useFontColorPicker.js.map +1 -1
  102. package/hooks/useIsMounted.js +6 -14
  103. package/hooks/useIsMounted.js.map +1 -1
  104. package/hooks/useRichTextEditor.d.ts +1 -1
  105. package/hooks/useRichTextEditor.js +5 -11
  106. package/hooks/useRichTextEditor.js.map +1 -1
  107. package/hooks/useTextAlignmentAction.d.ts +1 -1
  108. package/hooks/useTextAlignmentAction.js +5 -11
  109. package/hooks/useTextAlignmentAction.js.map +1 -1
  110. package/hooks/useTypographyAction.d.ts +1 -1
  111. package/hooks/useTypographyAction.js +5 -11
  112. package/hooks/useTypographyAction.js.map +1 -1
  113. package/index.d.ts +33 -38
  114. package/index.js +44 -322
  115. package/index.js.map +1 -1
  116. package/package.json +18 -22
  117. package/plugins/BlurEventPlugin/BlurEventPlugin.d.ts +2 -2
  118. package/plugins/BlurEventPlugin/BlurEventPlugin.js +16 -22
  119. package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
  120. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +9 -14
  121. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
  122. package/plugins/CodeHighlightPlugin/index.d.ts +1 -1
  123. package/plugins/CodeHighlightPlugin/index.js +1 -16
  124. package/plugins/CodeHighlightPlugin/index.js.map +1 -1
  125. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.d.ts +10 -0
  126. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +28 -0
  127. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js.map +1 -0
  128. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.d.ts +7 -0
  129. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js +61 -0
  130. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js.map +1 -0
  131. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.css +2 -136
  132. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.d.ts +4 -16
  133. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +7 -180
  134. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
  135. package/plugins/FloatingLinkEditorPlugin/index.d.ts +1 -1
  136. package/plugins/FloatingLinkEditorPlugin/index.js +1 -16
  137. package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -1
  138. package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js +2 -8
  139. package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js.map +1 -1
  140. package/plugins/FloatingLinkEditorPlugin/types.d.ts +10 -0
  141. package/plugins/FloatingLinkEditorPlugin/types.js +3 -0
  142. package/plugins/FloatingLinkEditorPlugin/types.js.map +1 -0
  143. package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.d.ts +8 -2
  144. package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js +119 -63
  145. package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js.map +1 -1
  146. package/plugins/FontColorPlugin/FontColorPlugin.js +19 -28
  147. package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -1
  148. package/plugins/FontColorPlugin/applyColorToNode.d.ts +3 -0
  149. package/plugins/FontColorPlugin/applyColorToNode.js +8 -0
  150. package/plugins/FontColorPlugin/applyColorToNode.js.map +1 -0
  151. package/plugins/FontColorPlugin/applyColorToSelection.d.ts +3 -0
  152. package/plugins/FontColorPlugin/applyColorToSelection.js +66 -0
  153. package/plugins/FontColorPlugin/applyColorToSelection.js.map +1 -0
  154. package/plugins/ImagesPlugin/ImagesPlugin.d.ts +2 -3
  155. package/plugins/ImagesPlugin/ImagesPlugin.js +58 -60
  156. package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -1
  157. package/plugins/LinkPlugin/LinkPlugin.d.ts +1 -1
  158. package/plugins/LinkPlugin/LinkPlugin.js +29 -37
  159. package/plugins/LinkPlugin/LinkPlugin.js.map +1 -1
  160. package/plugins/ListPLugin/ListPlugin.js +52 -15
  161. package/plugins/ListPLugin/ListPlugin.js.map +1 -1
  162. package/plugins/QuoteNodePlugin/QuoteNodePlugin.js +19 -16
  163. package/plugins/QuoteNodePlugin/QuoteNodePlugin.js.map +1 -1
  164. package/plugins/StateHandlingPlugin.d.ts +8 -0
  165. package/plugins/StateHandlingPlugin.js +75 -0
  166. package/plugins/StateHandlingPlugin.js.map +1 -0
  167. package/plugins/TypographyPlugin/TypographyPlugin.js +17 -21
  168. package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -1
  169. package/types.d.ts +8 -8
  170. package/types.js +6 -38
  171. package/types.js.map +1 -1
  172. package/ui/ContentEditable.d.ts +0 -1
  173. package/ui/ContentEditable.js +7 -14
  174. package/ui/ContentEditable.js.map +1 -1
  175. package/ui/Divider.d.ts +0 -1
  176. package/ui/Divider.js +3 -10
  177. package/ui/Divider.js.map +1 -1
  178. package/ui/DropDown.d.ts +1 -1
  179. package/ui/DropDown.js +64 -90
  180. package/ui/DropDown.js.map +1 -1
  181. package/ui/ImageResizer.d.ts +0 -1
  182. package/ui/ImageResizer.js +84 -89
  183. package/ui/ImageResizer.js.map +1 -1
  184. package/ui/LinkPreview.d.ts +0 -1
  185. package/ui/LinkPreview.js +22 -29
  186. package/ui/LinkPreview.js.map +1 -1
  187. package/ui/Placeholder.d.ts +1 -1
  188. package/ui/Placeholder.js +10 -16
  189. package/ui/Placeholder.js.map +1 -1
  190. package/ui/TextInput.d.ts +1 -2
  191. package/ui/TextInput.js +11 -18
  192. package/ui/TextInput.js.map +1 -1
  193. package/ui/ToolbarActionDialog.js +30 -42
  194. package/ui/ToolbarActionDialog.js.map +1 -1
  195. package/utils/canUseDOM.js +1 -7
  196. package/utils/canUseDOM.js.map +1 -1
  197. package/utils/files.d.ts +6 -7
  198. package/utils/files.js +5 -56
  199. package/utils/files.js.map +1 -1
  200. package/utils/getDOMRangeRect.js +4 -10
  201. package/utils/getDOMRangeRect.js.map +1 -1
  202. package/utils/getSelectedNode.d.ts +1 -1
  203. package/utils/getSelectedNode.js +9 -16
  204. package/utils/getSelectedNode.js.map +1 -1
  205. package/utils/getTransparentImage.js +1 -7
  206. package/utils/getTransparentImage.js.map +1 -1
  207. package/utils/insertImage.d.ts +1 -1
  208. package/utils/insertImage.js +8 -14
  209. package/utils/insertImage.js.map +1 -1
  210. package/utils/isAnchorLink.js +1 -7
  211. package/utils/isAnchorLink.js.map +1 -1
  212. package/utils/isChildOfFloatingToolbar.js +2 -8
  213. package/utils/isChildOfFloatingToolbar.js.map +1 -1
  214. package/utils/isHTMLElement.js +1 -7
  215. package/utils/isHTMLElement.js.map +1 -1
  216. package/utils/isValidJSON.js +3 -9
  217. package/utils/isValidJSON.js.map +1 -1
  218. package/utils/isValidLexicalData.d.ts +3 -3
  219. package/utils/isValidLexicalData.js +6 -12
  220. package/utils/isValidLexicalData.js.map +1 -1
  221. package/utils/point.js +35 -60
  222. package/utils/point.js.map +1 -1
  223. package/utils/rect.d.ts +2 -2
  224. package/utils/rect.js +115 -149
  225. package/utils/rect.js.map +1 -1
  226. package/utils/sanitizeUrl.js +6 -13
  227. package/utils/sanitizeUrl.js.map +1 -1
  228. package/utils/setFloatingElemPosition.d.ts +1 -1
  229. package/utils/setFloatingElemPosition.js +29 -39
  230. package/utils/setFloatingElemPosition.js.map +1 -1
  231. package/components/Editor/HeadingEditor.d.ts +0 -7
  232. package/components/Editor/HeadingEditor.js +0 -29
  233. package/components/Editor/HeadingEditor.js.map +0 -1
  234. package/components/Editor/ParagraphEditor.d.ts +0 -7
  235. package/components/Editor/ParagraphEditor.js +0 -29
  236. package/components/Editor/ParagraphEditor.js.map +0 -1
  237. package/components/Toolbar/Toolbar.css +0 -647
  238. package/components/Toolbar/Toolbar.d.ts +0 -6
  239. package/components/Toolbar/Toolbar.js +0 -162
  240. package/components/Toolbar/Toolbar.js.map +0 -1
  241. package/components/ToolbarActions/FontSizeAction.d.ts +0 -2
  242. package/components/ToolbarActions/FontSizeAction.js +0 -88
  243. package/components/ToolbarActions/FontSizeAction.js.map +0 -1
  244. package/hooks/useList.d.ts +0 -2
  245. package/hooks/useList.js +0 -54
  246. package/hooks/useList.js.map +0 -1
  247. package/hooks/useQuote.d.ts +0 -2
  248. package/hooks/useQuote.js +0 -22
  249. package/hooks/useQuote.js.map +0 -1
  250. package/plugins/FloatingLinkEditorPlugin/LinkEditForm.d.ts +0 -9
  251. package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js +0 -118
  252. package/plugins/FloatingLinkEditorPlugin/LinkEditForm.js.map +0 -1
  253. package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.d.ts +0 -9
  254. package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js +0 -44
  255. package/plugins/FloatingLinkEditorPlugin/LinkPreviewForm.js.map +0 -1
  256. package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.d.ts +0 -9
  257. package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.js +0 -45
  258. package/plugins/LexicalUpdateStatePlugin/UpdateStatePlugin.js.map +0 -1
  259. package/plugins/LexicalUpdateStatePlugin/index.d.ts +0 -1
  260. package/plugins/LexicalUpdateStatePlugin/index.js +0 -18
  261. package/plugins/LexicalUpdateStatePlugin/index.js.map +0 -1
  262. package/utils/generateInitialLexicalValue.d.ts +0 -5
  263. package/utils/generateInitialLexicalValue.js +0 -33
  264. package/utils/generateInitialLexicalValue.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_emotion","_LexicalComposer","_LexicalOnChangePlugin","_LexicalAutoFocusPlugin","_LexicalClearEditorPlugin","_LexicalRichTextPlugin","_LexicalErrorBoundary","_interopRequireDefault","_reactComposition","_LexicalHistoryPlugin","_LexicalContentEditable","_RichTextEditorContext","_isValidLexicalData","_LexicalUpdateStatePlugin","_BlurEventPlugin","_Placeholder","_generateInitialLexicalValue","_lexicalTheme","_lexicalNodes","_SharedHistoryContext","_LexicalEditorConfig","_excluded","BaseRichTextEditor","_ref","toolbar","staticToolbar","onChange","value","nodes","placeholder","children","onBlur","focus","styles","width","height","contentEditableStyles","placeholderStyles","props","_objectWithoutProperties2","default","themeEmotionMap","toTypographyEmotionMap","css","theme","themeStylesTransformer","editorTheme","useRef","createTheme","config","useLexicalEditorConfig","_useSharedHistoryCont","useSharedHistoryContext","historyState","placeholderElem","createElement","Placeholder","scrollRef","_useState","useState","undefined","_useState2","_slicedToArray2","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","sizeStyle","configNodes","map","node","configPlugins","plugins","plugin","Fragment","key","name","element","editorValue","isValidLexicalData","generateInitialLexicalValue","initialConfig","editorState","namespace","onError","concat","_toConsumableArray2","allNodes","_objectSpread2","current","emotionMap","handleOnChange","editor","read","getEditorState","JSON","stringify","toJSON","SharedHistoryContext","LexicalComposer","length","RichTextEditorProvider","toolbarActionPlugins","className","ref","style","overflow","position","OnChangePlugin","UpdateStatePlugin","ClearEditorPlugin","HistoryPlugin","externalHistoryState","BlurEventPlugin","AutoFocusPlugin","RichTextPlugin","contentEditable","ContentEditable","outline","ErrorBoundary","LexicalErrorBoundary","RichTextEditor","exports","makeDecoratable","LexicalEditorWithConfig"],"sources":["RichTextEditor.tsx"],"sourcesContent":["import React, { Fragment, useRef, useState } from \"react\";\nimport { css } from \"emotion\";\nimport { CSSObject } from \"@emotion/react\";\nimport { Klass, LexicalEditor, LexicalNode } from \"lexical\";\nimport { EditorState } from \"lexical/LexicalEditorState\";\nimport { LexicalComposer } from \"@lexical/react/LexicalComposer\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\nimport { AutoFocusPlugin } from \"@lexical/react/LexicalAutoFocusPlugin\";\nimport { ClearEditorPlugin } from \"@lexical/react/LexicalClearEditorPlugin\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport LexicalErrorBoundary from \"@lexical/react/LexicalErrorBoundary\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport { HistoryPlugin } from \"@lexical/react/LexicalHistoryPlugin\";\nimport { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport { RichTextEditorProvider } from \"~/context/RichTextEditorContext\";\nimport { isValidLexicalData } from \"~/utils/isValidLexicalData\";\nimport { UpdateStatePlugin } from \"~/plugins/LexicalUpdateStatePlugin\";\nimport { BlurEventPlugin } from \"~/plugins/BlurEventPlugin/BlurEventPlugin\";\nimport { LexicalValue, ToolbarActionPlugin } from \"~/types\";\nimport { Placeholder } from \"~/ui/Placeholder\";\nimport { generateInitialLexicalValue } from \"~/utils/generateInitialLexicalValue\";\nimport {\n createTheme,\n WebinyTheme,\n ThemeEmotionMap,\n toTypographyEmotionMap\n} from \"@webiny/lexical-theme\";\nimport { allNodes } from \"@webiny/lexical-nodes\";\nimport { SharedHistoryContext, useSharedHistoryContext } from \"~/context/SharedHistoryContext\";\nimport {\n LexicalEditorWithConfig,\n useLexicalEditorConfig\n} from \"~/components/LexicalEditorConfig/LexicalEditorConfig\";\n\nexport interface RichTextEditorProps {\n children?: React.ReactNode | React.ReactNode[];\n classes?: string;\n contentEditableStyles?: React.CSSProperties;\n focus?: boolean;\n height?: number | string;\n nodes?: Klass<LexicalNode>[];\n onBlur?: (editorState: LexicalValue) => void;\n onChange?: (json: LexicalValue) => void;\n placeholder?: string;\n placeholderStyles?: React.CSSProperties;\n staticToolbar?: React.ReactNode;\n styles?: React.CSSProperties;\n tag?: string;\n theme: WebinyTheme;\n themeEmotionMap?: ThemeEmotionMap;\n toolbarActionPlugins?: ToolbarActionPlugin[];\n themeStylesTransformer?: (cssObject: Record<string, any>) => CSSObject;\n toolbar?: React.ReactNode;\n value: LexicalValue | null;\n width?: number | string;\n}\n\nconst BaseRichTextEditor = ({\n toolbar,\n staticToolbar,\n onChange,\n value,\n nodes,\n placeholder,\n children,\n onBlur,\n focus,\n styles,\n width,\n height,\n contentEditableStyles,\n placeholderStyles,\n ...props\n}: RichTextEditorProps) => {\n const themeEmotionMap =\n props.themeEmotionMap ??\n toTypographyEmotionMap(css, props.theme, props.themeStylesTransformer);\n\n const editorTheme = useRef(createTheme());\n const config = useLexicalEditorConfig();\n const { historyState } = useSharedHistoryContext();\n const placeholderElem = (\n <Placeholder styles={placeholderStyles}>{placeholder || \"Enter text...\"}</Placeholder>\n );\n const scrollRef = useRef(null);\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLElement | undefined>(\n undefined\n );\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem);\n }\n };\n\n const sizeStyle = {\n height: height || \"\",\n width: width || \"\"\n };\n\n const configNodes = config.nodes.map(node => node.node);\n const configPlugins = config.plugins.map(plugin => (\n <Fragment key={plugin.name}>{plugin.element}</Fragment>\n ));\n\n const editorValue = isValidLexicalData(value) ? value : generateInitialLexicalValue();\n\n const initialConfig = {\n // We update the state via the `<LexicalUpdateStatePlugin/>`.\n editorState: null,\n namespace: \"webiny\",\n onError: () => {\n // Ignore errors. We don't want to break the app because of errors caused by config/value updates.\n // These are usually resolved in the next component render cycle.\n },\n nodes: [...allNodes, ...configNodes, ...(nodes || [])],\n theme: { ...editorTheme.current, emotionMap: themeEmotionMap }\n };\n\n function handleOnChange(editorState: EditorState, editor: LexicalEditor) {\n editorState.read(() => {\n if (typeof onChange === \"function\") {\n const editorState = editor.getEditorState();\n onChange(JSON.stringify(editorState.toJSON()));\n }\n });\n }\n\n return (\n /**\n * Once the LexicalComposer is mounted, it caches the `initialConfig` internally, and all future\n * updates to the config will be ignored. This is a problem because we pull in Nodes from our config,\n * and initially, there can be multiple re-renders, while the config object is settled.\n *\n * To bypass this issue, we generate a naive `key` based on the number of Nodes.\n */\n <SharedHistoryContext>\n <LexicalComposer initialConfig={initialConfig} key={initialConfig.nodes.length}>\n <RichTextEditorProvider\n theme={props.theme}\n themeEmotionMap={themeEmotionMap}\n toolbarActionPlugins={props.toolbarActionPlugins}\n >\n {staticToolbar && staticToolbar}\n <div\n /* This className is necessary for targeting of editor container from CSS files. */\n className={\"editor-shell\"}\n ref={scrollRef}\n style={{ ...styles, ...sizeStyle, overflow: \"auto\", position: \"relative\" }}\n >\n {/* State plugins. */}\n <OnChangePlugin onChange={handleOnChange} />\n <UpdateStatePlugin value={editorValue} />\n <ClearEditorPlugin />\n <HistoryPlugin externalHistoryState={historyState} />\n {/* Event plugins. */}\n {onBlur && <BlurEventPlugin onBlur={onBlur} />}\n {focus && <AutoFocusPlugin />}\n {/* External plugins and components. */}\n {configPlugins}\n {children}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\" style={{ ...sizeStyle }}>\n <div className=\"editor\" ref={onRef}>\n <ContentEditable\n style={{ outline: 0, ...contentEditableStyles }}\n />\n </div>\n </div>\n }\n placeholder={placeholderElem}\n ErrorBoundary={LexicalErrorBoundary}\n />\n {/* Toolbar. */}\n {floatingAnchorElem && toolbar}\n </div>\n </RichTextEditorProvider>\n </LexicalComposer>\n </SharedHistoryContext>\n );\n};\n\n/**\n * @description Main editor container\n */\nexport const RichTextEditor = makeDecoratable(\"RichTextEditor\", (props: RichTextEditorProps) => {\n return (\n <LexicalEditorWithConfig>\n <BaseRichTextEditor {...props} />\n </LexicalEditorWithConfig>\n );\n});\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAIA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,qBAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAX,OAAA;AACA,IAAAY,sBAAA,GAAAZ,OAAA;AACA,IAAAa,mBAAA,GAAAb,OAAA;AACA,IAAAc,yBAAA,GAAAd,OAAA;AACA,IAAAe,gBAAA,GAAAf,OAAA;AAEA,IAAAgB,YAAA,GAAAhB,OAAA;AACA,IAAAiB,4BAAA,GAAAjB,OAAA;AACA,IAAAkB,aAAA,GAAAlB,OAAA;AAMA,IAAAmB,aAAA,GAAAnB,OAAA;AACA,IAAAoB,qBAAA,GAAApB,OAAA;AACA,IAAAqB,oBA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CACnD,CACA,CACJ,CACR;MACDP,WAAW,EAAEyB,eAAgB;MAC7BiE,aAAa,EAAEC;IAAqB,CACvC,CAAC,EAEDzD,kBAAkB,IAAIvC,OACtB,CACe,CACX,CACC;EAAC;AAE/B,CAAC;;AAED;AACA;AACA;AACO,IAAMiG,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,IAAAE,iCAAe,EAAC,gBAAgB,EAAE,UAACrF,KAA0B,EAAK;EAC5F,oBACIzC,MAAA,CAAA2C,OAAA,CAAAe,aAAA,CAACnC,oBAAA,CAAAwG,uBAAuB,qBACpB/H,MAAA,CAAA2C,OAAA,CAAAe,aAAA,CAACjC,kBAAkB,EAAKgB,KAAQ,CACX,CAAC;AAElC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Fragment","useId","useRef","useState","LexicalComposer","AutoFocusPlugin","ClearEditorPlugin","RichTextPlugin","LexicalErrorBoundary","makeDecoratable","HistoryPlugin","ContentEditable","allNodes","RichTextEditorProvider","BlurEventPlugin","Placeholder","SharedHistoryContext","useSharedHistoryContext","LexicalEditorWithConfig","useLexicalEditorConfig","StateHandlingPlugin","BaseRichTextEditor","onChange","toolbar","staticToolbar","nodes","placeholder","children","onBlur","focus","styles","width","height","contentEditableStyles","placeholderStyles","props","editorTheme","theme","config","historyState","placeholderElem","createElement","scrollRef","floatingAnchorElem","setFloatingAnchorElem","undefined","onRef","_floatingAnchorElem","sizeStyle","configNodes","map","node","configPlugins","plugins","plugin","key","name","element","initialConfig","editorId","namespace","onError","current","tokens","$colors","colors","$typography","typography","$cacheKey","JSON","stringify","configRef","length","toolbarActionPlugins","className","ref","style","overflow","position","value","externalHistoryState","contentEditable","outline","ErrorBoundary","RichTextEditor"],"sources":["RichTextEditor.tsx"],"sourcesContent":["import React, { Fragment, useId, useRef, useState } from \"react\";\nimport type { Klass, LexicalNode } from \"lexical\";\nimport { LexicalComposer } from \"@lexical/react/LexicalComposer\";\nimport { AutoFocusPlugin } from \"@lexical/react/LexicalAutoFocusPlugin\";\nimport { ClearEditorPlugin } from \"@lexical/react/LexicalClearEditorPlugin\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport { HistoryPlugin } from \"@lexical/react/LexicalHistoryPlugin\";\nimport { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport type { EditorTheme } from \"@webiny/lexical-theme\";\nimport { allNodes } from \"@webiny/lexical-nodes\";\nimport { RichTextEditorProvider } from \"~/context/RichTextEditorContext.js\";\nimport { BlurEventPlugin } from \"~/plugins/BlurEventPlugin/BlurEventPlugin.js\";\nimport type { LexicalValue, ToolbarActionPlugin } from \"~/types.js\";\nimport { Placeholder } from \"~/ui/Placeholder.js\";\nimport { SharedHistoryContext, useSharedHistoryContext } from \"~/context/SharedHistoryContext.js\";\nimport {\n LexicalEditorWithConfig,\n useLexicalEditorConfig\n} from \"~/components/LexicalEditorConfig/LexicalEditorConfig.js\";\nimport { StateHandlingPlugin } from \"~/plugins/StateHandlingPlugin.js\";\n\nexport type InitialEditorConfig = React.ComponentProps<typeof LexicalComposer>[\"initialConfig\"] & {\n editorId: string;\n};\n\nexport interface RichTextEditorProps {\n children?: React.ReactNode | React.ReactNode[];\n classes?: string;\n contentEditableStyles?: React.CSSProperties;\n focus?: boolean;\n height?: number | string;\n nodes?: Klass<LexicalNode>[];\n onBlur?: (editorState: LexicalValue) => void;\n onChange?: (value: LexicalValue) => void;\n placeholder?: string;\n placeholderStyles?: React.CSSProperties;\n staticToolbar?: React.ReactNode;\n styles?: React.CSSProperties;\n tag?: string;\n theme: EditorTheme;\n toolbarActionPlugins?: ToolbarActionPlugin[];\n toolbar?: React.ReactNode;\n value: LexicalValue | null | undefined;\n configRef?: React.MutableRefObject<InitialEditorConfig | undefined>;\n width?: number | string;\n}\n\nconst BaseRichTextEditor = ({\n onChange,\n toolbar,\n staticToolbar,\n nodes,\n placeholder,\n children,\n onBlur,\n focus,\n styles,\n width,\n height,\n contentEditableStyles,\n placeholderStyles,\n ...props\n}: RichTextEditorProps) => {\n const editorTheme = useRef(props.theme);\n const config = useLexicalEditorConfig();\n const { historyState } = useSharedHistoryContext();\n const placeholderElem = (\n <Placeholder styles={placeholderStyles}>{placeholder || \"Enter text...\"}</Placeholder>\n );\n const scrollRef = useRef(null);\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLElement | undefined>(\n undefined\n );\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem);\n }\n };\n\n const sizeStyle = {\n height: height || \"\",\n width: width || \"\"\n };\n\n const configNodes = config.nodes.map(node => node.node);\n const configPlugins = config.plugins.map(plugin => (\n <Fragment key={plugin.name}>{plugin.element}</Fragment>\n ));\n\n const initialConfig = {\n editorId: useId(),\n namespace: \"webiny\",\n onError: () => {\n // Ignore errors. We don't want to break the app because of errors caused by config/value updates.\n // These are usually resolved in the next component render cycle.\n },\n nodes: [...allNodes, ...configNodes, ...(nodes || [])],\n theme: {\n ...editorTheme.current.tokens,\n // I'm not aware of a better way to pass custom data to nodes.\n // For now, we're using Lexical's theme to pass colors and typography.\n $colors: editorTheme.current.colors,\n $typography: editorTheme.current.typography,\n $cacheKey: JSON.stringify(editorTheme.current)\n }\n };\n\n if (props.configRef) {\n props.configRef.current = initialConfig;\n }\n\n return (\n /**\n * Once the LexicalComposer is mounted, it caches the `initialConfig` internally, and all future\n * updates to the config will be ignored. This is a problem because we pull in Nodes from our config,\n * and initially, there can be multiple re-renders, while the config object is settled.\n *\n * To bypass this issue, we generate a naive `key` based on the number of Nodes.\n */\n <SharedHistoryContext>\n <LexicalComposer initialConfig={initialConfig} key={initialConfig.nodes.length}>\n <RichTextEditorProvider\n theme={props.theme}\n toolbarActionPlugins={props.toolbarActionPlugins}\n >\n {staticToolbar ? staticToolbar : null}\n <div data-role={\"overlays\"} className={\"relative\"}></div>\n <div\n /* This className is necessary for targeting of editor container from CSS files. */\n className={\"editor-shell\"}\n ref={scrollRef}\n style={{\n ...styles,\n ...sizeStyle,\n overflow: \"auto\",\n position: \"relative\"\n }}\n >\n {/* State plugins. */}\n <StateHandlingPlugin value={props.value} onChange={onChange} />\n <ClearEditorPlugin />\n <HistoryPlugin externalHistoryState={historyState} />\n {/* Event plugins. */}\n {onBlur && <BlurEventPlugin onBlur={onBlur} />}\n {focus && <AutoFocusPlugin />}\n {/* External plugins and components. */}\n {configPlugins}\n {children}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\" style={{ ...sizeStyle }}>\n <div className=\"editor\" ref={onRef}>\n <ContentEditable\n style={{ outline: 0, ...contentEditableStyles }}\n />\n </div>\n </div>\n }\n placeholder={placeholderElem}\n ErrorBoundary={LexicalErrorBoundary}\n />\n {/* Toolbar. */}\n {floatingAnchorElem && toolbar}\n </div>\n </RichTextEditorProvider>\n </LexicalComposer>\n </SharedHistoryContext>\n );\n};\n\n/**\n * @description Main editor container\n */\nexport const RichTextEditor = makeDecoratable(\"RichTextEditor\", (props: RichTextEditorProps) => {\n return (\n <LexicalEditorWithConfig>\n <BaseRichTextEditor {...props} />\n </LexicalEditorWithConfig>\n );\n});\n\nexport namespace RichTextEditor {\n export type InitialConfig = InitialEditorConfig;\n}\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEhE,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,iBAAiB,QAAQ,yCAAyC;AAC3E,SAASC,cAAc,QAAQ,sCAAsC;AACrE,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,aAAa,QAAQ,qCAAqC;AACnE,SAASC,eAAe,QAAQ,uCAAuC;AAEvE,S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Ac,GAAG3E,eAAe,CAAC,gBAAgB,EAAG0B,KAA0B,IAAK;EAC5F,oBACIpC,KAAA,CAAA0C,aAAA,CAACvB,uBAAuB,qBACpBnB,KAAA,CAAA0C,aAAA,CAACpB,kBAAkB,EAAKc,KAAQ,CACX,CAAC;AAElC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import type { LexicalValue, NormalizedInputValue } from "../../types.js";
2
+ /**
3
+ * Value passed to the `RichTextEditor` component can be anything. This function normalizes some of the more common shapes
4
+ * of input into a value that is either a `null` or a `LexicalValue`.
5
+ */
6
+ export declare function normalizeInputValue(value: LexicalValue | null | undefined): NormalizedInputValue;
@@ -0,0 +1,16 @@
1
+ const isValueEmpty = value => {
2
+ return [undefined, null, "", '""', "null"].includes(value);
3
+ };
4
+
5
+ /**
6
+ * Value passed to the `RichTextEditor` component can be anything. This function normalizes some of the more common shapes
7
+ * of input into a value that is either a `null` or a `LexicalValue`.
8
+ */
9
+ export function normalizeInputValue(value) {
10
+ if (isValueEmpty(value)) {
11
+ return null;
12
+ }
13
+ return value;
14
+ }
15
+
16
+ //# sourceMappingURL=normalizeInputValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isValueEmpty","value","undefined","includes","normalizeInputValue"],"sources":["normalizeInputValue.ts"],"sourcesContent":["import type { LexicalValue, NormalizedInputValue } from \"~/types.js\";\n\nconst isValueEmpty = (value: any) => {\n return [undefined, null, \"\", '\"\"', \"null\"].includes(value);\n};\n\n/**\n * Value passed to the `RichTextEditor` component can be anything. This function normalizes some of the more common shapes\n * of input into a value that is either a `null` or a `LexicalValue`.\n */\nexport function normalizeInputValue(value: LexicalValue | null | undefined) {\n if (isValueEmpty(value)) {\n return null;\n }\n\n return value as NormalizedInputValue;\n}\n"],"mappings":"AAEA,MAAMA,YAAY,GAAIC,KAAU,IAAK;EACjC,OAAO,CAACC,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAACC,QAAQ,CAACF,KAAK,CAAC;AAC9D,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASG,mBAAmBA,CAACH,KAAsC,EAAE;EACxE,IAAID,YAAY,CAACC,KAAK,CAAC,EAAE;IACrB,OAAO,IAAI;EACf;EAEA,OAAOA,KAAK;AAChB","ignoreList":[]}
@@ -1,20 +1,18 @@
1
- import React from "react";
2
- import { ToolbarElementConfig } from "./components/ToolbarElement";
3
- import { PluginConfig } from "./components/Plugin";
4
- import { NodeConfig } from "./components/Node";
5
- export declare const LexicalEditorConfig: {
6
- ({ children }: {
7
- children: React.ReactNode;
8
- }): React.JSX.Element;
9
- ToolbarElement: ({ name, element, after, before, remove }: import("./components/ToolbarElement").ToolbarElementProps) => React.JSX.Element;
10
- Plugin: ({ name, element, after, before, remove }: import("./components/Plugin").PluginProps) => React.JSX.Element;
11
- Node: ({ name, node, after, before, remove }: import("./components/Node").NodeProps) => React.JSX.Element;
1
+ import type { ToolbarElementConfig } from "./components/ToolbarElement.js";
2
+ import type { PluginConfig } from "./components/Plugin.js";
3
+ import type { NodeConfig } from "./components/Node.js";
4
+ export type { ToolbarElementConfig } from "./components/ToolbarElement.js";
5
+ export type { PluginConfig } from "./components/Plugin.js";
6
+ export type { NodeConfig } from "./components/Node.js";
7
+ export declare const LexicalEditorConfig: (({ priority, children }: import("@webiny/react-properties").ConfigProps) => React.JSX.Element) & {
8
+ ToolbarElement: ({ name, element, after, before, remove }: import("./components/ToolbarElement.js").ToolbarElementProps) => import("react").JSX.Element;
9
+ Plugin: ({ name, element, after, before, remove }: import("./components/Plugin.js").PluginProps) => import("react").JSX.Element;
10
+ Node: ({ name, node, after, before, remove }: import("./components/Node.js").NodeProps) => import("react").JSX.Element;
12
11
  };
13
- export declare const LexicalEditorWithConfig: ({ children }: {
14
- children: React.ReactNode;
15
- }) => React.JSX.Element;
16
- export declare function useLexicalEditorConfig(): {
12
+ export declare const LexicalEditorWithConfig: ({ onProperties, children }: import("@webiny/react-properties").WithConfigProps) => React.JSX.Element;
13
+ interface LexicalEditorConfigData {
17
14
  toolbarElements: ToolbarElementConfig[];
18
15
  plugins: PluginConfig[];
19
16
  nodes: NodeConfig[];
20
- };
17
+ }
18
+ export declare function useLexicalEditorConfig(): LexicalEditorConfigData;
@@ -1,73 +1,25 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.LexicalEditorWithConfig = exports.LexicalEditorConfig = void 0;
9
- exports.useLexicalEditorConfig = useLexicalEditorConfig;
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
- var _react = _interopRequireWildcard(require("react"));
12
- var _reactComposition = require("@webiny/react-composition");
13
- var _reactProperties = require("@webiny/react-properties");
14
- var _ToolbarElement = require("./components/ToolbarElement");
15
- var _Plugin = require("./components/Plugin");
16
- var _Node = require("./components/Node");
17
- var LexicalEditorConfigApply = (0, _reactComposition.makeDecoratable)("LexicalEditorConfigApply", function (_ref) {
18
- var children = _ref.children;
19
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
20
- });
21
- var createHOC = function createHOC(newChildren) {
22
- return function (BaseComponent) {
23
- return function ConfigHOC(_ref2) {
24
- var children = _ref2.children;
25
- return /*#__PURE__*/_react.default.createElement(BaseComponent, null, newChildren, children);
26
- };
27
- };
28
- };
29
- var LexicalEditorConfig = exports.LexicalEditorConfig = function LexicalEditorConfig(_ref3) {
30
- var children = _ref3.children;
31
- return /*#__PURE__*/_react.default.createElement(_reactComposition.Compose, {
32
- component: LexicalEditorConfigApply,
33
- with: createHOC(children)
34
- });
35
- };
36
- LexicalEditorConfig.ToolbarElement = _ToolbarElement.ToolbarElement;
37
- LexicalEditorConfig.Plugin = _Plugin.Plugin;
38
- LexicalEditorConfig.Node = _Node.Node;
39
- var ViewContext = /*#__PURE__*/_react.default.createContext({
40
- properties: []
1
+ import { useMemo } from "react";
2
+ import { createConfigurableComponent } from "@webiny/react-properties";
3
+ import { ToolbarElement } from "./components/ToolbarElement.js";
4
+ import { Plugin } from "./components/Plugin.js";
5
+ import { Node } from "./components/Node.js";
6
+ const base = createConfigurableComponent("LexicalEditor");
7
+ export const LexicalEditorConfig = Object.assign(base.Config, {
8
+ ToolbarElement,
9
+ Plugin,
10
+ Node
41
11
  });
42
- var LexicalEditorWithConfig = exports.LexicalEditorWithConfig = function LexicalEditorWithConfig(_ref4) {
43
- var children = _ref4.children;
44
- var _useState = (0, _react.useState)([]),
45
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
46
- properties = _useState2[0],
47
- setProperties = _useState2[1];
48
- var context = {
49
- properties: properties
50
- };
51
- var stateUpdater = function stateUpdater(properties) {
52
- setProperties(properties);
53
- };
54
- return /*#__PURE__*/_react.default.createElement(ViewContext.Provider, {
55
- value: context
56
- }, /*#__PURE__*/_react.default.createElement(_reactProperties.Properties, {
57
- onChange: stateUpdater
58
- }, /*#__PURE__*/_react.default.createElement(LexicalEditorConfigApply, null), children));
59
- };
60
- function useLexicalEditorConfig() {
61
- var _useContext = (0, _react.useContext)(ViewContext),
62
- properties = _useContext.properties;
63
- var config = (0, _react.useMemo)(function () {
64
- return (0, _reactProperties.toObject)(properties);
65
- }, [properties]);
66
- return {
67
- toolbarElements: config.toolbarElements || [],
68
- plugins: config.plugins || [],
69
- nodes: config.nodes || []
70
- };
12
+ export const LexicalEditorWithConfig = base.WithConfig;
13
+ export function useLexicalEditorConfig() {
14
+ const config = base.useConfig();
15
+ const toolbarElements = config.toolbarElements || [];
16
+ const plugins = config.plugins || [];
17
+ const nodes = config.nodes || [];
18
+ return useMemo(() => ({
19
+ toolbarElements: [...toolbarElements],
20
+ plugins: [...plugins],
21
+ nodes: [...nodes]
22
+ }), [config]);
71
23
  }
72
24
 
73
25
  //# sourceMappingURL=LexicalEditorConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactComposition","_reactProperties","_ToolbarElement","_Plugin","_Node","LexicalEditorConfigApply","makeDecoratable","_ref","children","default","createElement","Fragment","createHOC","newChildren","BaseComponent","ConfigHOC","_ref2","LexicalEditorConfig","exports","_ref3","Compose","component","with","ToolbarElement","Plugin","Node","ViewContext","React","createContext","properties","LexicalEditorWithConfig","_ref4","_useState","useState","_useState2","_slicedToArray2","setProperties","context","stateUpdater","Provider","value","Properties","onChange","useLexicalEditorConfig","_useContext","useContext","config","useMemo","toObject","toolbarElements","plugins","nodes"],"sources":["LexicalEditorConfig.tsx"],"sourcesContent":["import React, { useContext, useMemo, useState } from \"react\";\nimport { makeDecoratable, Compose, Decorator, GenericComponent } from \"@webiny/react-composition\";\nimport { Property, Properties, toObject } from \"@webiny/react-properties\";\nimport { ToolbarElement, ToolbarElementConfig } from \"./components/ToolbarElement\";\nimport { Plugin, PluginConfig } from \"./components/Plugin\";\nimport { Node, NodeConfig } from \"./components/Node\";\n\nconst LexicalEditorConfigApply = makeDecoratable(\"LexicalEditorConfigApply\", ({ children }) => {\n return <>{children}</>;\n});\n\nconst createHOC =\n (newChildren: React.ReactNode): Decorator<GenericComponent> =>\n BaseComponent => {\n return function ConfigHOC({ children }) {\n return (\n <BaseComponent>\n {newChildren}\n {children}\n </BaseComponent>\n );\n };\n };\n\nexport const LexicalEditorConfig = ({ children }: { children: React.ReactNode }) => {\n return <Compose component={LexicalEditorConfigApply} with={createHOC(children)} />;\n};\n\nLexicalEditorConfig.ToolbarElement = ToolbarElement;\nLexicalEditorConfig.Plugin = Plugin;\nLexicalEditorConfig.Node = Node;\n\ninterface ViewContext {\n properties: Property[];\n}\n\nconst ViewContext = React.createContext<ViewContext>({ properties: [] });\n\nexport const LexicalEditorWithConfig = ({ children }: { children: React.ReactNode }) => {\n const [properties, setProperties] = useState<Property[]>([]);\n const context = { properties };\n\n const stateUpdater = (properties: Property[]) => {\n setProperties(properties);\n };\n\n return (\n <ViewContext.Provider value={context}>\n <Properties onChange={stateUpdater}>\n <LexicalEditorConfigApply />\n {children}\n </Properties>\n </ViewContext.Provider>\n );\n};\n\ninterface LexicalEditorConfigData {\n toolbarElements: ToolbarElementConfig[];\n plugins: PluginConfig[];\n nodes: NodeConfig[];\n}\n\nexport function useLexicalEditorConfig() {\n const { properties } = useContext(ViewContext);\n\n const config = useMemo(() => {\n return toObject<LexicalEditorConfigData>(properties);\n }, [properties]);\n\n return {\n toolbarElements: config.toolbarElements || [],\n plugins: config.plugins || [],\n nodes: config.nodes || []\n };\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAEA,IAAMM,wBAAwB,GAAG,IAAAC,iCAAe,EAAC,0BAA0B,EAAE,UAAAC,IAAA,EAAkB;EAAA,IAAfC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EACpF,oBAAOX,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAAAb,MAAA,CAAAY,OAAA,CAAAE,QAAA,QAAGH,QAAW,CAAC;AAC1B,CAAC,CAAC;AAEF,IAAMI,SAAS,GACX,SADEA,SAASA,CACVC,WAA4B;EAAA,OAC7B,UAAAC,aAAa,EAAI;IACb,OAAO,SAASC,SAASA,CAAAC,KAAA,EAAe;MAAA,IAAZR,QAAQ,GAAAQ,KAAA,CAARR,QAAQ;MAChC,oBACIX,MAAA,CAAAY,OAAA,CAAAC,aAAA,CAACI,aAAa,QACTD,WAAW,EACXL,QACU,CAAC;IAExB,CAAC;EACL,CAAC;AAAA;AAEE,IAAMS,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,SAAtBA,mBAAmBA,CAAAE,KAAA,EAAoD;EAA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,sBAAsBA,CAAA,EAAG;EACrC,IAAAC,WAAA,GAAuB,IAAAC,iBAAU,EAACnB,WAAW,CAAC;IAAtCG,UAAU,GAAAe,WAAA,CAAVf,UAAU;EAElB,IAAMiB,MAAM,GAAG,IAAAC,cAAO,EAAC,YAAM;IACzB,OAAO,IAAAC,yBAAQ,EAA0BnB,UAAU,CAAC;EACxD,CAAC,EAAE,CAACA,UAAU,CAAC,CAAC;EAEhB,OAAO;IACHoB,eAAe,EAAEH,MAAM,CAACG,eAAe,IAAI,EAAE;IAC7CC,OAAO,EAAEJ,MAAM,CAACI,OAAO,IAAI,EAAE;IAC7BC,KAAK,EAAEL,MAAM,CAACK,KAAK,IAAI;EAC3B,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","createConfigurableComponent","ToolbarElement","Plugin","Node","base","LexicalEditorConfig","Object","assign","Config","LexicalEditorWithConfig","WithConfig","useLexicalEditorConfig","config","useConfig","toolbarElements","plugins","nodes"],"sources":["LexicalEditorConfig.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { createConfigurableComponent } from \"@webiny/react-properties\";\nimport type { ToolbarElementConfig } from \"./components/ToolbarElement.js\";\nimport { ToolbarElement } from \"./components/ToolbarElement.js\";\nimport type { PluginConfig } from \"./components/Plugin.js\";\nimport { Plugin } from \"./components/Plugin.js\";\nimport type { NodeConfig } from \"./components/Node.js\";\nimport { Node } from \"./components/Node.js\";\n\nexport type { ToolbarElementConfig } from \"./components/ToolbarElement.js\";\nexport type { PluginConfig } from \"./components/Plugin.js\";\nexport type { NodeConfig } from \"./components/Node.js\";\n\nconst base = createConfigurableComponent<LexicalEditorConfigData>(\"LexicalEditor\");\n\nexport const LexicalEditorConfig = Object.assign(base.Config, {\n ToolbarElement,\n Plugin,\n Node\n});\n\nexport const LexicalEditorWithConfig = base.WithConfig;\n\ninterface LexicalEditorConfigData {\n toolbarElements: ToolbarElementConfig[];\n plugins: PluginConfig[];\n nodes: NodeConfig[];\n}\n\nexport function useLexicalEditorConfig(): LexicalEditorConfigData {\n const config = base.useConfig();\n const toolbarElements = config.toolbarElements || [];\n const plugins = config.plugins || [];\n const nodes = config.nodes || [];\n\n return useMemo(\n () => ({\n toolbarElements: [...toolbarElements],\n plugins: [...plugins],\n nodes: [...nodes]\n }),\n [config]\n );\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,2BAA2B,QAAQ,0BAA0B;AAEtE,SAASC,cAAc;AAEvB,SAASC,MAAM;AAEf,SAASC,IAAI;AAMb,MAAMC,IAAI,GAAGJ,2BAA2B,CAA0B,eAAe,CAAC;AAElF,OAAO,MAAMK,mBAAmB,GAAGC,MAAM,CAACC,MAAM,CAACH,IAAI,CAACI,MAAM,EAAE;EAC1DP,cAAc;EACdC,MAAM;EACNC;AACJ,CAAC,CAAC;AAEF,OAAO,MAAMM,uBAAuB,GAAGL,IAAI,CAACM,UAAU;AAQtD,OAAO,SAASC,sBAAsBA,CAAA,EAA4B;EAC9D,MAAMC,MAAM,GAAGR,IAAI,CAACS,SAAS,CAAC,CAAC;EAC/B,MAAMC,eAAe,GAAGF,MAAM,CAACE,eAAe,IAAI,EAAE;EACpD,MAAMC,OAAO,GAAGH,MAAM,CAACG,OAAO,IAAI,EAAE;EACpC,MAAMC,KAAK,GAAGJ,MAAM,CAACI,KAAK,IAAI,EAAE;EAEhC,OAAOjB,OAAO,CACV,OAAO;IACHe,eAAe,EAAE,CAAC,GAAGA,eAAe,CAAC;IACrCC,OAAO,EAAE,CAAC,GAAGA,OAAO,CAAC;IACrBC,KAAK,EAAE,CAAC,GAAGA,KAAK;EACpB,CAAC,CAAC,EACF,CAACJ,MAAM,CACX,CAAC;AACL","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Klass, LexicalNode } from "lexical";
2
+ import type { Klass, LexicalNode } from "lexical";
3
3
  export interface NodeConfig {
4
4
  name: string;
5
5
  node: Klass<LexicalNode>;
@@ -1,36 +1,27 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.Node = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _reactProperties = require("@webiny/react-properties");
10
- var Node = exports.Node = function Node(_ref) {
11
- var name = _ref.name,
12
- node = _ref.node,
13
- _ref$after = _ref.after,
14
- after = _ref$after === void 0 ? undefined : _ref$after,
15
- _ref$before = _ref.before,
16
- before = _ref$before === void 0 ? undefined : _ref$before,
17
- _ref$remove = _ref.remove,
18
- remove = _ref$remove === void 0 ? false : _ref$remove;
19
- var placeBefore = before !== undefined ? "node:".concat(before) : undefined;
20
- var placeAfter = after !== undefined ? "node:".concat(after) : undefined;
21
- return /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
22
- id: "nodes:".concat(name),
1
+ import React from "react";
2
+ import { Property } from "@webiny/react-properties";
3
+ export const Node = ({
4
+ name,
5
+ node,
6
+ after = undefined,
7
+ before = undefined,
8
+ remove = false
9
+ }) => {
10
+ const placeBefore = before !== undefined ? `node:${before}` : undefined;
11
+ const placeAfter = after !== undefined ? `node:${after}` : undefined;
12
+ return /*#__PURE__*/React.createElement(Property, {
13
+ id: `nodes:${name}`,
23
14
  name: "nodes",
24
15
  array: true,
25
16
  before: placeBefore,
26
17
  after: placeAfter,
27
18
  remove: remove
28
- }, /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
29
- id: "node:".concat(name, ":name"),
19
+ }, /*#__PURE__*/React.createElement(Property, {
20
+ id: `node:${name}:name`,
30
21
  name: "name",
31
22
  value: name
32
- }), node ? /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
33
- id: "node:".concat(name, ":node"),
23
+ }), node ? /*#__PURE__*/React.createElement(Property, {
24
+ id: `node:${name}:node`,
34
25
  name: "node",
35
26
  value: node
36
27
  }) : null);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactProperties","Node","exports","_ref","name","node","_ref$after","after","undefined","_ref$before","before","_ref$remove","remove","placeBefore","concat","placeAfter","default","createElement","Property","id","array","value"],"sources":["Node.tsx"],"sourcesContent":["import React from \"react\";\nimport { Property } from \"@webiny/react-properties\";\nimport { Klass, LexicalNode } from \"lexical\";\n\nexport interface NodeConfig {\n name: string;\n node: Klass<LexicalNode>;\n}\n\nexport interface NodeProps {\n name: string;\n node?: Klass<LexicalNode>;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport const Node = ({\n name,\n node,\n after = undefined,\n before = undefined,\n remove = false\n}: NodeProps) => {\n const placeBefore = before !== undefined ? `node:${before}` : undefined;\n const placeAfter = after !== undefined ? `node:${after}` : undefined;\n\n return (\n <Property\n id={`nodes:${name}`}\n name={\"nodes\"}\n array={true}\n before={placeBefore}\n after={placeAfter}\n remove={remove}\n >\n <Property id={`node:${name}:name`} name={\"name\"} value={name} />\n {node ? <Property id={`node:${name}:node`} name={\"node\"} value={node} /> : null}\n </Property>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAgBO,IAAME,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAG,SAAPA,IAAIA,CAAAE,IAAA,EAMA;EAAA,IALbC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAAC,UAAA,GAAAH,IAAA,CACJI,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAGE,SAAS,GAAAF,UAAA;IAAAG,WAAA,GAAAN,IAAA,CACjBO,MAAM;IAANA,MAAM,GAAAD,WAAA,cAAGD,SAAS,GAAAC,WAAA;IAAAE,WAAA,GAAAR,IAAA,CAClBS,MAAM;IAANA,MAAM,GAAAD,WAAA,cAAG,KAAK,GAAAA,WAAA;EAEd,IAAME,WAAW,GAAGH,MAAM,KAAKF,SAAS,WAAAM,MAAA,CAAWJ,MAAM,IAAKF,SAAS;EACvE,IAAMO,UAAU,GAAGR,KAAK,KAAKC,SAAS,WAAAM,MAAA,CAAWP,KAAK,IAAKC,SAAS;EAEpE,oBACIX,MAAA,CAAAmB,OAAA,CAAAC,aAAA,CAACjB,gBAAA,CAAAkB,QAAQ;IACLC,EAAE,WAAAL,MAAA,CAAWV,IAAI,CAAG;IACpBA,IAAI,EAAE,OAAQ;IACdgB,KAAK,EAAE,IAAK;IACZV,MAAM,EAAEG,WAAY;IACpBN,KAAK,EAAEQ,UAAW;IAClBH,MAAM,EAAEA;EAAO,gBAEff,MAAA,CAAAmB,OAAA,CAAAC,aAAA,CAACjB,gBAAA,CAAAkB,QAAQ;IAACC,EAAE,UAAAL,MAAA,CAAUV,IAAI,UAAQ;IAACA,IAAI,EAAE,MAAO;IAACiB,KAAK,EAAEjB;EAAK,CAAE,CAAC,EAC/DC,IAAI,gBAAGR,MAAA,CAAAmB,OAAA,CAAAC,aAAA,CAACjB,gBAAA,CAAAkB,QAAQ;IAACC,EAAE,UAAAL,MAAA,CAAUV,IAAI,UAAQ;IAACA,IAAI,EAAE,MAAO;IAACiB,KAAK,EAAEhB;EAAK,CAAE,CAAC,GAAG,IACrE,CAAC;AAEnB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Property","Node","name","node","after","undefined","before","remove","placeBefore","placeAfter","createElement","id","array","value"],"sources":["Node.tsx"],"sourcesContent":["import React from \"react\";\nimport { Property } from \"@webiny/react-properties\";\nimport type { Klass, LexicalNode } from \"lexical\";\n\nexport interface NodeConfig {\n name: string;\n node: Klass<LexicalNode>;\n}\n\nexport interface NodeProps {\n name: string;\n node?: Klass<LexicalNode>;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport const Node = ({\n name,\n node,\n after = undefined,\n before = undefined,\n remove = false\n}: NodeProps) => {\n const placeBefore = before !== undefined ? `node:${before}` : undefined;\n const placeAfter = after !== undefined ? `node:${after}` : undefined;\n\n return (\n <Property\n id={`nodes:${name}`}\n name={\"nodes\"}\n array={true}\n before={placeBefore}\n after={placeAfter}\n remove={remove}\n >\n <Property id={`node:${name}:name`} name={\"name\"} value={name} />\n {node ? <Property id={`node:${name}:node`} name={\"node\"} value={node} /> : null}\n </Property>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,0BAA0B;AAgBnD,OAAO,MAAMC,IAAI,GAAGA,CAAC;EACjBC,IAAI;EACJC,IAAI;EACJC,KAAK,GAAGC,SAAS;EACjBC,MAAM,GAAGD,SAAS;EAClBE,MAAM,GAAG;AACF,CAAC,KAAK;EACb,MAAMC,WAAW,GAAGF,MAAM,KAAKD,SAAS,GAAG,QAAQC,MAAM,EAAE,GAAGD,SAAS;EACvE,MAAMI,UAAU,GAAGL,KAAK,KAAKC,SAAS,GAAG,QAAQD,KAAK,EAAE,GAAGC,SAAS;EAEpE,oBACIN,KAAA,CAAAW,aAAA,CAACV,QAAQ;IACLW,EAAE,EAAE,SAAST,IAAI,EAAG;IACpBA,IAAI,EAAE,OAAQ;IACdU,KAAK,EAAE,IAAK;IACZN,MAAM,EAAEE,WAAY;IACpBJ,KAAK,EAAEK,UAAW;IAClBF,MAAM,EAAEA;EAAO,gBAEfR,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,QAAQT,IAAI,OAAQ;IAACA,IAAI,EAAE,MAAO;IAACW,KAAK,EAAEX;EAAK,CAAE,CAAC,EAC/DC,IAAI,gBAAGJ,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,QAAQT,IAAI,OAAQ;IAACA,IAAI,EAAE,MAAO;IAACW,KAAK,EAAEV;EAAK,CAAE,CAAC,GAAG,IACrE,CAAC;AAEnB,CAAC","ignoreList":[]}
@@ -1,36 +1,27 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.Plugin = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _reactProperties = require("@webiny/react-properties");
10
- var Plugin = exports.Plugin = function Plugin(_ref) {
11
- var name = _ref.name,
12
- element = _ref.element,
13
- _ref$after = _ref.after,
14
- after = _ref$after === void 0 ? undefined : _ref$after,
15
- _ref$before = _ref.before,
16
- before = _ref$before === void 0 ? undefined : _ref$before,
17
- _ref$remove = _ref.remove,
18
- remove = _ref$remove === void 0 ? false : _ref$remove;
19
- var placeBefore = before !== undefined ? "plugin:".concat(before) : undefined;
20
- var placeAfter = after !== undefined ? "plugin:".concat(after) : undefined;
21
- return /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
22
- id: "plugins:".concat(name),
1
+ import React from "react";
2
+ import { Property } from "@webiny/react-properties";
3
+ export const Plugin = ({
4
+ name,
5
+ element,
6
+ after = undefined,
7
+ before = undefined,
8
+ remove = false
9
+ }) => {
10
+ const placeBefore = before !== undefined ? `plugin:${before}` : undefined;
11
+ const placeAfter = after !== undefined ? `plugin:${after}` : undefined;
12
+ return /*#__PURE__*/React.createElement(Property, {
13
+ id: `plugins:${name}`,
23
14
  name: "plugins",
24
15
  array: true,
25
16
  before: placeBefore,
26
17
  after: placeAfter,
27
18
  remove: remove
28
- }, /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
29
- id: "plugin:".concat(name, ":name"),
19
+ }, /*#__PURE__*/React.createElement(Property, {
20
+ id: `plugin:${name}:name`,
30
21
  name: "name",
31
22
  value: name
32
- }), element ? /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
33
- id: "plugin:".concat(name, ":element"),
23
+ }), element ? /*#__PURE__*/React.createElement(Property, {
24
+ id: `plugin:${name}:element`,
34
25
  name: "element",
35
26
  value: element
36
27
  }) : null);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactProperties","Plugin","exports","_ref","name","element","_ref$after","after","undefined","_ref$before","before","_ref$remove","remove","placeBefore","concat","placeAfter","default","createElement","Property","id","array","value"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Property } from \"@webiny/react-properties\";\n\nexport interface PluginConfig {\n name: string;\n element: React.ReactElement;\n}\n\nexport interface PluginProps {\n name: string;\n element?: React.ReactElement<unknown>;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport const Plugin = ({\n name,\n element,\n after = undefined,\n before = undefined,\n remove = false\n}: PluginProps) => {\n const placeBefore = before !== undefined ? `plugin:${before}` : undefined;\n const placeAfter = after !== undefined ? `plugin:${after}` : undefined;\n\n return (\n <Property\n id={`plugins:${name}`}\n name={\"plugins\"}\n array={true}\n before={placeBefore}\n after={placeAfter}\n remove={remove}\n >\n <Property id={`plugin:${name}:name`} name={\"name\"} value={name} />\n {element ? (\n <Property id={`plugin:${name}:element`} name={\"element\"} value={element} />\n ) : null}\n </Property>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAeO,IAAME,MAAM,GAAAC,OAAA,CAAAD,MAAA,GAAG,SAATA,MAAMA,CAAAE,IAAA,EAMA;EAAA,IALfC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IAAAC,UAAA,GAAAH,IAAA,CACPI,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAGE,SAAS,GAAAF,UAAA;IAAAG,WAAA,GAAAN,IAAA,CACjBO,MAAM;IAANA,MAAM,GAAAD,WAAA,cAAGD,SAAS,GAAAC,WAAA;IAAAE,WAAA,GAAAR,IAAA,CAClBS,MAAM;IAANA,MAAM,GAAAD,WAAA,cAAG,KAAK,GAAAA,WAAA;EAEd,IAAME,WAAW,GAAGH,MAAM,KAAKF,SAAS,aAAAM,MAAA,CAAaJ,MAAM,IAAKF,SAAS;EACzE,IAAMO,UAAU,GAAGR,KAAK,KAAKC,SAAS,aAAAM,MAAA,CAAaP,KAAK,IAAKC,SAAS;EAEtE,oBACIX,MAAA,CAAAmB,OAAA,CAAAC,aAAA,CAACjB,gBAAA,CAAAkB,QAAQ;IACLC,EAAE,aAAAL,MAAA,CAAaV,IAAI,CAAG;IACtBA,IAAI,EAAE,SAAU;IAChBgB,KAAK,EAAE,IAAK;IACZV,MAAM,EAAEG,WAAY;IACpBN,KAAK,EAAEQ,UAAW;IAClBH,MAAM,EAAEA;EAAO,gBAEff,MAAA,CAAAmB,OAAA,CAAAC,aAAA,CAACjB,gBAAA,CAAAkB,QAAQ;IAACC,EAAE,YAAAL,MAAA,CAAYV,IAAI,UAAQ;IAACA,IAAI,EAAE,MAAO;IAACiB,KAAK,EAAEjB;EAAK,CAAE,CAAC,EACjEC,OAAO,gBACJR,MAAA,CAAAmB,OAAA,CAAAC,aAAA,CAACjB,gBAAA,CAAAkB,QAAQ;IAACC,EAAE,YAAAL,MAAA,CAAYV,IAAI,aAAW;IAACA,IAAI,EAAE,SAAU;IAACiB,KAAK,EAAEhB;EAAQ,CAAE,CAAC,GAC3E,IACE,CAAC;AAEnB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Property","Plugin","name","element","after","undefined","before","remove","placeBefore","placeAfter","createElement","id","array","value"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Property } from \"@webiny/react-properties\";\n\nexport interface PluginConfig {\n name: string;\n element: React.ReactElement;\n}\n\nexport interface PluginProps {\n name: string;\n element?: React.ReactElement<unknown>;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport const Plugin = ({\n name,\n element,\n after = undefined,\n before = undefined,\n remove = false\n}: PluginProps) => {\n const placeBefore = before !== undefined ? `plugin:${before}` : undefined;\n const placeAfter = after !== undefined ? `plugin:${after}` : undefined;\n\n return (\n <Property\n id={`plugins:${name}`}\n name={\"plugins\"}\n array={true}\n before={placeBefore}\n after={placeAfter}\n remove={remove}\n >\n <Property id={`plugin:${name}:name`} name={\"name\"} value={name} />\n {element ? (\n <Property id={`plugin:${name}:element`} name={\"element\"} value={element} />\n ) : null}\n </Property>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,0BAA0B;AAenD,OAAO,MAAMC,MAAM,GAAGA,CAAC;EACnBC,IAAI;EACJC,OAAO;EACPC,KAAK,GAAGC,SAAS;EACjBC,MAAM,GAAGD,SAAS;EAClBE,MAAM,GAAG;AACA,CAAC,KAAK;EACf,MAAMC,WAAW,GAAGF,MAAM,KAAKD,SAAS,GAAG,UAAUC,MAAM,EAAE,GAAGD,SAAS;EACzE,MAAMI,UAAU,GAAGL,KAAK,KAAKC,SAAS,GAAG,UAAUD,KAAK,EAAE,GAAGC,SAAS;EAEtE,oBACIN,KAAA,CAAAW,aAAA,CAACV,QAAQ;IACLW,EAAE,EAAE,WAAWT,IAAI,EAAG;IACtBA,IAAI,EAAE,SAAU;IAChBU,KAAK,EAAE,IAAK;IACZN,MAAM,EAAEE,WAAY;IACpBJ,KAAK,EAAEK,UAAW;IAClBF,MAAM,EAAEA;EAAO,gBAEfR,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,UAAUT,IAAI,OAAQ;IAACA,IAAI,EAAE,MAAO;IAACW,KAAK,EAAEX;EAAK,CAAE,CAAC,EACjEC,OAAO,gBACJJ,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,UAAUT,IAAI,UAAW;IAACA,IAAI,EAAE,SAAU;IAACW,KAAK,EAAEV;EAAQ,CAAE,CAAC,GAC3E,IACE,CAAC;AAEnB,CAAC","ignoreList":[]}
@@ -1,36 +1,27 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.ToolbarElement = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _reactProperties = require("@webiny/react-properties");
10
- var ToolbarElement = exports.ToolbarElement = function ToolbarElement(_ref) {
11
- var name = _ref.name,
12
- element = _ref.element,
13
- _ref$after = _ref.after,
14
- after = _ref$after === void 0 ? undefined : _ref$after,
15
- _ref$before = _ref.before,
16
- before = _ref$before === void 0 ? undefined : _ref$before,
17
- _ref$remove = _ref.remove,
18
- remove = _ref$remove === void 0 ? false : _ref$remove;
19
- var placeBefore = before !== undefined ? "element:".concat(before) : undefined;
20
- var placeAfter = after !== undefined ? "element:".concat(after) : undefined;
21
- return /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
22
- id: "element:".concat(name),
1
+ import React from "react";
2
+ import { Property } from "@webiny/react-properties";
3
+ export const ToolbarElement = ({
4
+ name,
5
+ element,
6
+ after = undefined,
7
+ before = undefined,
8
+ remove = false
9
+ }) => {
10
+ const placeBefore = before !== undefined ? `element:${before}` : undefined;
11
+ const placeAfter = after !== undefined ? `element:${after}` : undefined;
12
+ return /*#__PURE__*/React.createElement(Property, {
13
+ id: `element:${name}`,
23
14
  name: "toolbarElements",
24
15
  array: true,
25
16
  before: placeBefore,
26
17
  after: placeAfter,
27
18
  remove: remove
28
- }, /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
29
- id: "element:".concat(name, ":name"),
19
+ }, /*#__PURE__*/React.createElement(Property, {
20
+ id: `element:${name}:name`,
30
21
  name: "name",
31
22
  value: name
32
- }), element ? /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
33
- id: "element:".concat(name, ":element"),
23
+ }), element ? /*#__PURE__*/React.createElement(Property, {
24
+ id: `element:${name}:element`,
34
25
  name: "element",
35
26
  value: element
36
27
  }) : null);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactProperties","ToolbarElement","exports","_ref","name","element","_ref$after","after","undefined","_ref$before","before","_ref$remove","remove","placeBefore","concat","placeAfter","default","createElement","Property","id","array","value"],"sources":["ToolbarElement.tsx"],"sourcesContent":["import React from \"react\";\nimport { Property } from \"@webiny/react-properties\";\n\nexport interface ToolbarElementConfig {\n name: string;\n element: React.ReactElement;\n}\n\nexport interface ToolbarElementProps {\n name: string;\n element?: React.ReactElement<unknown>;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport const ToolbarElement = ({\n name,\n element,\n after = undefined,\n before = undefined,\n remove = false\n}: ToolbarElementProps) => {\n const placeBefore = before !== undefined ? `element:${before}` : undefined;\n const placeAfter = after !== undefined ? `element:${after}` : undefined;\n\n return (\n <Property\n id={`element:${name}`}\n name={\"toolbarElements\"}\n array={true}\n before={placeBefore}\n after={placeAfter}\n remove={remove}\n >\n <Property id={`element:${name}:name`} name={\"name\"} value={name} />\n {element ? (\n <Property id={`element:${name}:element`} name={\"element\"} value={element} />\n ) : null}\n </Property>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAeO,IAAME,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAjBA,cAAcA,CAAAE,IAAA,EAMA;EAAA,IALvBC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IAAAC,UAAA,GAAAH,IAAA,CACPI,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAGE,SAAS,GAAAF,UAAA;IAAAG,WAAA,GAAAN,IAAA,CACjBO,MAAM;IAANA,MAAM,GAAAD,WAAA,cAAGD,SAAS,GAAAC,WAAA;IAAAE,WAAA,GAAAR,IAAA,CAClBS,MAAM;IAANA,MAAM,GAAAD,WAAA,cAAG,KAAK,GAAAA,WAAA;EAEd,IAAME,WAAW,GAAGH,MAAM,KAAKF,SAAS,cAAAM,MAAA,CAAcJ,MAAM,IAAKF,SAAS;EAC1E,IAAMO,UAAU,GAAGR,KAAK,KAAKC,SAAS,cAAAM,MAAA,CAAcP,KAAK,IAAKC,SAAS;EAEvE,oBACIX,MAAA,CAAAmB,OAAA,CAAAC,aAAA,CAACjB,gBAAA,CAAAkB,QAAQ;IACLC,EAAE,aAAAL,MAAA,CAAaV,IAAI,CAAG;IACtBA,IAAI,EAAE,iBAAkB;IACxBgB,KAAK,EAAE,IAAK;IACZV,MAAM,EAAEG,WAAY;IACpBN,KAAK,EAAEQ,UAAW;IAClBH,MAAM,EAAEA;EAAO,gBAEff,MAAA,CAAAmB,OAAA,CAAAC,aAAA,CAACjB,gBAAA,CAAAkB,QAAQ;IAACC,EAAE,aAAAL,MAAA,CAAaV,IAAI,UAAQ;IAACA,IAAI,EAAE,MAAO;IAACiB,KAAK,EAAEjB;EAAK,CAAE,CAAC,EAClEC,OAAO,gBACJR,MAAA,CAAAmB,OAAA,CAAAC,aAAA,CAACjB,gBAAA,CAAAkB,QAAQ;IAACC,EAAE,aAAAL,MAAA,CAAaV,IAAI,aAAW;IAACA,IAAI,EAAE,SAAU;IAACiB,KAAK,EAAEhB;EAAQ,CAAE,CAAC,GAC5E,IACE,CAAC;AAEnB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Property","ToolbarElement","name","element","after","undefined","before","remove","placeBefore","placeAfter","createElement","id","array","value"],"sources":["ToolbarElement.tsx"],"sourcesContent":["import React from \"react\";\nimport { Property } from \"@webiny/react-properties\";\n\nexport interface ToolbarElementConfig {\n name: string;\n element: React.ReactElement;\n}\n\nexport interface ToolbarElementProps {\n name: string;\n element?: React.ReactElement<unknown>;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport const ToolbarElement = ({\n name,\n element,\n after = undefined,\n before = undefined,\n remove = false\n}: ToolbarElementProps) => {\n const placeBefore = before !== undefined ? `element:${before}` : undefined;\n const placeAfter = after !== undefined ? `element:${after}` : undefined;\n\n return (\n <Property\n id={`element:${name}`}\n name={\"toolbarElements\"}\n array={true}\n before={placeBefore}\n after={placeAfter}\n remove={remove}\n >\n <Property id={`element:${name}:name`} name={\"name\"} value={name} />\n {element ? (\n <Property id={`element:${name}:element`} name={\"element\"} value={element} />\n ) : null}\n </Property>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,0BAA0B;AAenD,OAAO,MAAMC,cAAc,GAAGA,CAAC;EAC3BC,IAAI;EACJC,OAAO;EACPC,KAAK,GAAGC,SAAS;EACjBC,MAAM,GAAGD,SAAS;EAClBE,MAAM,GAAG;AACQ,CAAC,KAAK;EACvB,MAAMC,WAAW,GAAGF,MAAM,KAAKD,SAAS,GAAG,WAAWC,MAAM,EAAE,GAAGD,SAAS;EAC1E,MAAMI,UAAU,GAAGL,KAAK,KAAKC,SAAS,GAAG,WAAWD,KAAK,EAAE,GAAGC,SAAS;EAEvE,oBACIN,KAAA,CAAAW,aAAA,CAACV,QAAQ;IACLW,EAAE,EAAE,WAAWT,IAAI,EAAG;IACtBA,IAAI,EAAE,iBAAkB;IACxBU,KAAK,EAAE,IAAK;IACZN,MAAM,EAAEE,WAAY;IACpBJ,KAAK,EAAEK,UAAW;IAClBF,MAAM,EAAEA;EAAO,gBAEfR,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,WAAWT,IAAI,OAAQ;IAACA,IAAI,EAAE,MAAO;IAACW,KAAK,EAAEX;EAAK,CAAE,CAAC,EAClEC,OAAO,gBACJJ,KAAA,CAAAW,aAAA,CAACV,QAAQ;IAACW,EAAE,EAAE,WAAWT,IAAI,UAAW;IAACA,IAAI,EAAE,SAAU;IAACW,KAAK,EAAEV;EAAQ,CAAE,CAAC,GAC5E,IACE,CAAC;AAEnB,CAAC","ignoreList":[]}
@@ -1,14 +1,11 @@
1
1
  import React from "react";
2
- import { Klass, LexicalNode } from "lexical";
3
- import { CSSObject } from "@emotion/react";
4
- import { WebinyTheme, ThemeEmotionMap } from "@webiny/lexical-theme";
5
- import { LexicalValue } from "../types";
2
+ import type { Klass, LexicalNode } from "lexical";
3
+ import type { EditorTheme } from "@webiny/lexical-theme";
4
+ import type { LexicalValue } from "../types.js";
6
5
  interface LexicalHtmlRendererProps {
7
6
  nodes?: Klass<LexicalNode>[];
8
7
  value: LexicalValue | null;
9
- theme: WebinyTheme;
10
- themeEmotionMap?: ThemeEmotionMap;
11
- themeStylesTransformer?: (cssObject: Record<string, any>) => CSSObject;
8
+ theme: EditorTheme;
12
9
  }
13
- export declare const LexicalHtmlRenderer: ({ nodes, value, theme, ...props }: LexicalHtmlRendererProps) => React.JSX.Element;
10
+ export declare const LexicalHtmlRenderer: ({ nodes, value, ...props }: LexicalHtmlRendererProps) => React.JSX.Element;
14
11
  export {};