@webiny/lexical-editor 6.3.0 → 6.4.0-beta.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 (252) hide show
  1. package/commands/image.js +2 -1
  2. package/commands/image.js.map +1 -1
  3. package/commands/index.js +0 -2
  4. package/commands/list.js +4 -3
  5. package/commands/list.js.map +1 -1
  6. package/commands/quote.js +2 -1
  7. package/commands/quote.js.map +1 -1
  8. package/commands/toolbar.js +2 -1
  9. package/commands/toolbar.js.map +1 -1
  10. package/commands/typography.js +2 -1
  11. package/commands/typography.js.map +1 -1
  12. package/components/Editor/EnsureHeadingTagPlugin.js +8 -15
  13. package/components/Editor/EnsureHeadingTagPlugin.js.map +1 -1
  14. package/components/Editor/RichTextEditor.js +82 -121
  15. package/components/Editor/RichTextEditor.js.map +1 -1
  16. package/components/Editor/normalizeInputValue.js +11 -13
  17. package/components/Editor/normalizeInputValue.js.map +1 -1
  18. package/components/LexicalEditorConfig/LexicalEditorConfig.js +24 -15
  19. package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -1
  20. package/components/LexicalEditorConfig/components/Node.js +21 -26
  21. package/components/LexicalEditorConfig/components/Node.js.map +1 -1
  22. package/components/LexicalEditorConfig/components/Plugin.js +21 -26
  23. package/components/LexicalEditorConfig/components/Plugin.js.map +1 -1
  24. package/components/LexicalEditorConfig/components/ToolbarElement.js +21 -26
  25. package/components/LexicalEditorConfig/components/ToolbarElement.js.map +1 -1
  26. package/components/LexicalHtmlRenderer.js +35 -40
  27. package/components/LexicalHtmlRenderer.js.map +1 -1
  28. package/components/Toolbar/StaticToolbar.js +11 -16
  29. package/components/Toolbar/StaticToolbar.js.map +1 -1
  30. package/components/ToolbarActions/BoldAction.js +16 -19
  31. package/components/ToolbarActions/BoldAction.js.map +1 -1
  32. package/components/ToolbarActions/BulletListAction.js +24 -32
  33. package/components/ToolbarActions/BulletListAction.js.map +1 -1
  34. package/components/ToolbarActions/CodeHighlightAction.js +16 -19
  35. package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
  36. package/components/ToolbarActions/FontColorAction.js +32 -38
  37. package/components/ToolbarActions/FontColorAction.js.map +1 -1
  38. package/components/ToolbarActions/ImageAction.js +28 -30
  39. package/components/ToolbarActions/ImageAction.js.map +1 -1
  40. package/components/ToolbarActions/ItalicAction.js +16 -19
  41. package/components/ToolbarActions/ItalicAction.js.map +1 -1
  42. package/components/ToolbarActions/LinkAction.js +25 -30
  43. package/components/ToolbarActions/LinkAction.js.map +1 -1
  44. package/components/ToolbarActions/NumberedListAction.js +28 -37
  45. package/components/ToolbarActions/NumberedListAction.js.map +1 -1
  46. package/components/ToolbarActions/QuoteAction.js +22 -27
  47. package/components/ToolbarActions/QuoteAction.js.map +1 -1
  48. package/components/ToolbarActions/TextAlignmentAction.js +38 -50
  49. package/components/ToolbarActions/TextAlignmentAction.js.map +1 -1
  50. package/components/ToolbarActions/TypographyAction.js +69 -99
  51. package/components/ToolbarActions/TypographyAction.js.map +1 -1
  52. package/components/ToolbarActions/UnderlineAction.js +16 -19
  53. package/components/ToolbarActions/UnderlineAction.js.map +1 -1
  54. package/context/FontColorActionContext.js +3 -2
  55. package/context/FontColorActionContext.js.map +1 -1
  56. package/context/RichTextEditorContext.js +26 -29
  57. package/context/RichTextEditorContext.js.map +1 -1
  58. package/context/SharedHistoryContext.js +11 -15
  59. package/context/SharedHistoryContext.js.map +1 -1
  60. package/context/TextAlignmentActionContextProps.js +3 -2
  61. package/context/TextAlignmentActionContextProps.js.map +1 -1
  62. package/context/TypographyActionContext.js +3 -2
  63. package/context/TypographyActionContext.js.map +1 -1
  64. package/exports/admin/lexical.js +2 -20
  65. package/hooks/index.js +0 -2
  66. package/hooks/useCurrentElement.js +18 -21
  67. package/hooks/useCurrentElement.js.map +1 -1
  68. package/hooks/useCurrentSelection.js +39 -48
  69. package/hooks/useCurrentSelection.js.map +1 -1
  70. package/hooks/useFontColorPicker.js +5 -6
  71. package/hooks/useFontColorPicker.js.map +1 -1
  72. package/hooks/useIsMounted.js +7 -8
  73. package/hooks/useIsMounted.js.map +1 -1
  74. package/hooks/useRichTextEditor.js +5 -6
  75. package/hooks/useRichTextEditor.js.map +1 -1
  76. package/hooks/useTextAlignmentAction.js +5 -6
  77. package/hooks/useTextAlignmentAction.js.map +1 -1
  78. package/hooks/useTypographyAction.js +5 -6
  79. package/hooks/useTypographyAction.js.map +1 -1
  80. package/images/icons/chat-square-quote.js +19 -0
  81. package/images/icons/chat-square-quote.js.map +1 -0
  82. package/images/icons/chevron-down.js +18 -0
  83. package/images/icons/chevron-down.js.map +1 -0
  84. package/images/icons/code.js +17 -0
  85. package/images/icons/code.js.map +1 -0
  86. package/images/icons/font-color.js +17 -0
  87. package/images/icons/font-color.js.map +1 -0
  88. package/images/icons/indent.js +18 -0
  89. package/images/icons/indent.js.map +1 -0
  90. package/images/icons/insert-image.js +20 -0
  91. package/images/icons/insert-image.js.map +1 -0
  92. package/images/icons/justify.js +19 -0
  93. package/images/icons/justify.js.map +1 -0
  94. package/images/icons/link.js +19 -0
  95. package/images/icons/link.js.map +1 -0
  96. package/images/icons/list-ol.js +20 -0
  97. package/images/icons/list-ol.js.map +1 -0
  98. package/images/icons/list-ul.js +18 -0
  99. package/images/icons/list-ul.js.map +1 -0
  100. package/images/icons/outdent.js +18 -0
  101. package/images/icons/outdent.js.map +1 -0
  102. package/images/icons/pencil-fill.js +17 -0
  103. package/images/icons/pencil-fill.js.map +1 -0
  104. package/images/icons/text-center.js +18 -0
  105. package/images/icons/text-center.js.map +1 -0
  106. package/images/icons/text-left.js +18 -0
  107. package/images/icons/text-left.js.map +1 -0
  108. package/images/icons/text-paragraph.js +18 -0
  109. package/images/icons/text-paragraph.js.map +1 -0
  110. package/images/icons/text-right.js +18 -0
  111. package/images/icons/text-right.js.map +1 -0
  112. package/images/icons/type-bold.js +17 -0
  113. package/images/icons/type-bold.js.map +1 -0
  114. package/images/icons/type-h1.js +17 -0
  115. package/images/icons/type-h1.js.map +1 -0
  116. package/images/icons/type-h2.js +17 -0
  117. package/images/icons/type-h2.js.map +1 -0
  118. package/images/icons/type-h3.js +17 -0
  119. package/images/icons/type-h3.js.map +1 -0
  120. package/images/icons/type-h4.js +17 -0
  121. package/images/icons/type-h4.js.map +1 -0
  122. package/images/icons/type-h5.js +17 -0
  123. package/images/icons/type-h5.js.map +1 -0
  124. package/images/icons/type-h6.js +17 -0
  125. package/images/icons/type-h6.js.map +1 -0
  126. package/images/icons/type-italic.js +17 -0
  127. package/images/icons/type-italic.js.map +1 -0
  128. package/images/icons/type-strikethrough.js +17 -0
  129. package/images/icons/type-strikethrough.js.map +1 -0
  130. package/images/icons/type-underline.js +17 -0
  131. package/images/icons/type-underline.js.map +1 -0
  132. package/images/icons/unlink_icon.js +27 -0
  133. package/images/icons/unlink_icon.js.map +1 -0
  134. package/index.js +5 -18
  135. package/package.json +7 -7
  136. package/plugins/BlurEventPlugin/BlurEventPlugin.js +11 -14
  137. package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
  138. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js +7 -8
  139. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
  140. package/plugins/CodeHighlightPlugin/index.js +0 -2
  141. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +16 -24
  142. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js.map +1 -1
  143. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js +37 -51
  144. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorController.js.map +1 -1
  145. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js +6 -5
  146. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
  147. package/plugins/FloatingLinkEditorPlugin/index.js +0 -2
  148. package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js +6 -9
  149. package/plugins/FloatingLinkEditorPlugin/isChildOfLinkEditor.js.map +1 -1
  150. package/plugins/FloatingLinkEditorPlugin/types.js +0 -3
  151. package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js +101 -108
  152. package/plugins/FloatingLinkEditorPlugin/useFloatingLinkEditor.js.map +1 -1
  153. package/plugins/FontColorPlugin/FontColorPlugin.js +14 -19
  154. package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -1
  155. package/plugins/FontColorPlugin/applyColorToNode.js +5 -4
  156. package/plugins/FontColorPlugin/applyColorToNode.js.map +1 -1
  157. package/plugins/FontColorPlugin/applyColorToSelection.js +42 -60
  158. package/plugins/FontColorPlugin/applyColorToSelection.js.map +1 -1
  159. package/plugins/ImagesPlugin/ImagesPlugin.js +79 -121
  160. package/plugins/ImagesPlugin/ImagesPlugin.js.map +1 -1
  161. package/plugins/LinkPlugin/LinkPlugin.js +46 -52
  162. package/plugins/LinkPlugin/LinkPlugin.js.map +1 -1
  163. package/plugins/ListPLugin/ListPlugin.js +44 -52
  164. package/plugins/ListPLugin/ListPlugin.js.map +1 -1
  165. package/plugins/QuoteNodePlugin/QuoteNodePlugin.js +18 -19
  166. package/plugins/QuoteNodePlugin/QuoteNodePlugin.js.map +1 -1
  167. package/plugins/StateHandlingPlugin.js +55 -64
  168. package/plugins/StateHandlingPlugin.js.map +1 -1
  169. package/plugins/TypographyPlugin/TypographyPlugin.js +13 -20
  170. package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -1
  171. package/static/svg/chat-square-quote.123cfa24.svg +1 -0
  172. package/static/svg/chevron-down.d9636921.svg +1 -0
  173. package/static/svg/code.912b1f4d.svg +1 -0
  174. package/static/svg/font-color.4f0c0de5.svg +1 -0
  175. package/static/svg/indent.4d78e483.svg +3 -0
  176. package/static/svg/insert-image.354465f1.svg +4 -0
  177. package/static/svg/justify.dab42aec.svg +3 -0
  178. package/static/svg/link.b774de25.svg +1 -0
  179. package/static/svg/list-ol.d64946f3.svg +1 -0
  180. package/static/svg/list-ul.1d54da3f.svg +1 -0
  181. package/static/svg/outdent.5c13ff16.svg +3 -0
  182. package/static/svg/pencil-fill.94cb216b.svg +1 -0
  183. package/static/svg/text-center.a411e780.svg +1 -0
  184. package/static/svg/text-left.54f41f4e.svg +1 -0
  185. package/static/svg/text-paragraph.61674422.svg +1 -0
  186. package/static/svg/text-right.9288b7a2.svg +1 -0
  187. package/static/svg/type-bold.7e3e270b.svg +1 -0
  188. package/static/svg/type-h1.f292ffe1.svg +1 -0
  189. package/static/svg/type-h2.a9d1aa48.svg +1 -0
  190. package/static/svg/type-h3.4a29ff88.svg +1 -0
  191. package/static/svg/type-h4.7f48750c.svg +1 -0
  192. package/static/svg/type-h5.14b4ac56.svg +1 -0
  193. package/static/svg/type-h6.4e9dfe2d.svg +1 -0
  194. package/static/svg/type-italic.d8e45748.svg +1 -0
  195. package/static/svg/type-strikethrough.2694a816.svg +1 -0
  196. package/static/svg/type-underline.104a0ed5.svg +1 -0
  197. package/static/svg/unlink_icon.074ceed3.svg +1 -0
  198. package/types.js +0 -8
  199. package/ui/ContentEditable.js +6 -14
  200. package/ui/ContentEditable.js.map +1 -1
  201. package/ui/Divider.js +6 -5
  202. package/ui/Divider.js.map +1 -1
  203. package/ui/DropDown.js +146 -176
  204. package/ui/DropDown.js.map +1 -1
  205. package/ui/ImageResizer.js +173 -204
  206. package/ui/ImageResizer.js.map +1 -1
  207. package/ui/LinkPreview.js +61 -84
  208. package/ui/LinkPreview.js.map +1 -1
  209. package/ui/Placeholder.js +9 -20
  210. package/ui/Placeholder.js.map +1 -1
  211. package/ui/TextInput.js +17 -30
  212. package/ui/TextInput.js.map +1 -1
  213. package/ui/ToolbarActionDialog.js +64 -73
  214. package/ui/ToolbarActionDialog.js.map +1 -1
  215. package/utils/canUseDOM.js +2 -1
  216. package/utils/canUseDOM.js.map +1 -1
  217. package/utils/files.js +9 -8
  218. package/utils/files.js.map +1 -1
  219. package/utils/getDOMRangeRect.js +10 -20
  220. package/utils/getDOMRangeRect.js.map +1 -1
  221. package/utils/getSelectedNode.js +9 -20
  222. package/utils/getSelectedNode.js.map +1 -1
  223. package/utils/getTransparentImage.js +2 -3
  224. package/utils/getTransparentImage.js.map +1 -1
  225. package/utils/insertImage.js +9 -11
  226. package/utils/insertImage.js.map +1 -1
  227. package/utils/isAnchorLink.js +2 -3
  228. package/utils/isAnchorLink.js.map +1 -1
  229. package/utils/isChildOfFloatingToolbar.js +6 -9
  230. package/utils/isChildOfFloatingToolbar.js.map +1 -1
  231. package/utils/isHTMLElement.js +3 -9
  232. package/utils/isHTMLElement.js.map +1 -1
  233. package/utils/isValidJSON.js +9 -10
  234. package/utils/isValidJSON.js.map +1 -1
  235. package/utils/isValidLexicalData.js +17 -20
  236. package/utils/isValidLexicalData.js.map +1 -1
  237. package/utils/point.js +32 -45
  238. package/utils/point.js.map +1 -1
  239. package/utils/rect.js +92 -125
  240. package/utils/rect.js.map +1 -1
  241. package/utils/sanitizeUrl.js +8 -21
  242. package/utils/sanitizeUrl.js.map +1 -1
  243. package/utils/setFloatingElemPosition.js +23 -27
  244. package/utils/setFloatingElemPosition.js.map +1 -1
  245. package/commands/index.js.map +0 -1
  246. package/exports/admin/lexical.js.map +0 -1
  247. package/hooks/index.js.map +0 -1
  248. package/index.js.map +0 -1
  249. package/plugins/CodeHighlightPlugin/index.js.map +0 -1
  250. package/plugins/FloatingLinkEditorPlugin/index.js.map +0 -1
  251. package/plugins/FloatingLinkEditorPlugin/types.js.map +0 -1
  252. package/types.js.map +0 -1
@@ -1,25 +1,12 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
1
  import { isAnchorLink } from "./isAnchorLink.js";
9
- export const sanitizeUrl = url => {
10
- /** A pattern that matches safe URLs. */
11
- const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi;
12
-
13
- /** A pattern that matches safe data URLs. */
14
- const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
15
- url = String(url).trim();
16
- if (isAnchorLink(url)) {
17
- return url;
18
- }
19
- if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN)) {
20
- return url;
21
- }
22
- return `https://`;
2
+ const sanitizeUrl = (url)=>{
3
+ const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi;
4
+ const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
5
+ url = String(url).trim();
6
+ if (isAnchorLink(url)) return url;
7
+ if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN)) return url;
8
+ return "https://";
23
9
  };
10
+ export { sanitizeUrl };
24
11
 
25
12
  //# sourceMappingURL=sanitizeUrl.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isAnchorLink","sanitizeUrl","url","SAFE_URL_PATTERN","DATA_URL_PATTERN","String","trim","match"],"sources":["sanitizeUrl.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport { isAnchorLink } from \"~/utils/isAnchorLink.js\";\n\nexport const sanitizeUrl = (url: string): string => {\n /** A pattern that matches safe URLs. */\n const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi;\n\n /** A pattern that matches safe data URLs. */\n const DATA_URL_PATTERN =\n /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;\n\n url = String(url).trim();\n\n if (isAnchorLink(url)) {\n return url;\n }\n\n if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN)) {\n return url;\n }\n\n return `https://`;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY;AAErB,OAAO,MAAMC,WAAW,GAAIC,GAAW,IAAa;EAChD;EACA,MAAMC,gBAAgB,GAAG,iEAAiE;;EAE1F;EACA,MAAMC,gBAAgB,GAClB,qIAAqI;EAEzIF,GAAG,GAAGG,MAAM,CAACH,GAAG,CAAC,CAACI,IAAI,CAAC,CAAC;EAExB,IAAIN,YAAY,CAACE,GAAG,CAAC,EAAE;IACnB,OAAOA,GAAG;EACd;EAEA,IAAIA,GAAG,CAACK,KAAK,CAACJ,gBAAgB,CAAC,IAAID,GAAG,CAACK,KAAK,CAACH,gBAAgB,CAAC,EAAE;IAC5D,OAAOF,GAAG;EACd;EAEA,OAAO,UAAU;AACrB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils/sanitizeUrl.js","sources":["../../src/utils/sanitizeUrl.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport { isAnchorLink } from \"~/utils/isAnchorLink.js\";\n\nexport const sanitizeUrl = (url: string): string => {\n /** A pattern that matches safe URLs. */\n const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi;\n\n /** A pattern that matches safe data URLs. */\n const DATA_URL_PATTERN =\n /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;\n\n url = String(url).trim();\n\n if (isAnchorLink(url)) {\n return url;\n }\n\n if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN)) {\n return url;\n }\n\n return `https://`;\n};\n"],"names":["sanitizeUrl","url","SAFE_URL_PATTERN","DATA_URL_PATTERN","String","isAnchorLink"],"mappings":";AASO,MAAMA,cAAc,CAACC;IAExB,MAAMC,mBAAmB;IAGzB,MAAMC,mBACF;IAEJF,MAAMG,OAAOH,KAAK,IAAI;IAEtB,IAAII,aAAaJ,MACb,OAAOA;IAGX,IAAIA,IAAI,KAAK,CAACC,qBAAqBD,IAAI,KAAK,CAACE,mBACzC,OAAOF;IAGX,OAAO;AACX"}
@@ -1,32 +1,28 @@
1
1
  import { computePosition, flip, offset, shift } from "@floating-ui/dom";
2
2
  const GAP = 10;
3
- export function setFloatingElemPosition(basePosition, elementToPosition) {
4
- // A small timeout gives enough time for DOM to update and provides us with correct bounding rect values.
5
- setTimeout(() => {
6
- if (basePosition === null) {
7
- elementToPosition.style.transform = "translate(-10000px, -10000px)";
8
- return;
9
- }
10
- const virtualElement = {
11
- getBoundingClientRect: () => basePosition.getBoundingClientRect()
12
- };
13
- computePosition(virtualElement, elementToPosition, {
14
- placement: "bottom",
15
- middleware: [offset(GAP),
16
- // adds gap between anchor and popup
17
- flip(),
18
- // switches to the opposite side if no room (bottom → top)
19
- shift({
20
- padding: GAP
21
- }) // slides along the axis to stay within viewport
22
- ]
23
- }).then(({
24
- x,
25
- y
26
- }) => {
27
- elementToPosition.style.transform = `translate(${x}px, ${y}px)`;
28
- });
29
- }, 10);
3
+ function setFloatingElemPosition(basePosition, elementToPosition) {
4
+ setTimeout(()=>{
5
+ if (null === basePosition) {
6
+ elementToPosition.style.transform = "translate(-10000px, -10000px)";
7
+ return;
8
+ }
9
+ const virtualElement = {
10
+ getBoundingClientRect: ()=>basePosition.getBoundingClientRect()
11
+ };
12
+ computePosition(virtualElement, elementToPosition, {
13
+ placement: "bottom",
14
+ middleware: [
15
+ offset(GAP),
16
+ flip(),
17
+ shift({
18
+ padding: GAP
19
+ })
20
+ ]
21
+ }).then(({ x, y })=>{
22
+ elementToPosition.style.transform = `translate(${x}px, ${y}px)`;
23
+ });
24
+ }, 10);
30
25
  }
26
+ export { setFloatingElemPosition };
31
27
 
32
28
  //# sourceMappingURL=setFloatingElemPosition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["computePosition","flip","offset","shift","GAP","setFloatingElemPosition","basePosition","elementToPosition","setTimeout","style","transform","virtualElement","getBoundingClientRect","placement","middleware","padding","then","x","y"],"sources":["setFloatingElemPosition.ts"],"sourcesContent":["import { computePosition, flip, offset, shift } from \"@floating-ui/dom\";\n\nconst GAP = 10;\n\nexport function setFloatingElemPosition(\n basePosition: Range | null,\n elementToPosition: HTMLElement\n): void {\n // A small timeout gives enough time for DOM to update and provides us with correct bounding rect values.\n setTimeout(() => {\n if (basePosition === null) {\n elementToPosition.style.transform = \"translate(-10000px, -10000px)\";\n return;\n }\n\n const virtualElement = {\n getBoundingClientRect: () => basePosition.getBoundingClientRect()\n };\n\n computePosition(virtualElement, elementToPosition, {\n placement: \"bottom\",\n middleware: [\n offset(GAP), // adds gap between anchor and popup\n flip(), // switches to the opposite side if no room (bottom → top)\n shift({ padding: GAP }) // slides along the axis to stay within viewport\n ]\n }).then(({ x, y }) => {\n elementToPosition.style.transform = `translate(${x}px, ${y}px)`;\n });\n }, 10);\n}\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,IAAI,EAAEC,MAAM,EAAEC,KAAK,QAAQ,kBAAkB;AAEvE,MAAMC,GAAG,GAAG,EAAE;AAEd,OAAO,SAASC,uBAAuBA,CACnCC,YAA0B,EAC1BC,iBAA8B,EAC1B;EACJ;EACAC,UAAU,CAAC,MAAM;IACb,IAAIF,YAAY,KAAK,IAAI,EAAE;MACvBC,iBAAiB,CAACE,KAAK,CAACC,SAAS,GAAG,+BAA+B;MACnE;IACJ;IAEA,MAAMC,cAAc,GAAG;MACnBC,qBAAqB,EAAEA,CAAA,KAAMN,YAAY,CAACM,qBAAqB,CAAC;IACpE,CAAC;IAEDZ,eAAe,CAACW,cAAc,EAAEJ,iBAAiB,EAAE;MAC/CM,SAAS,EAAE,QAAQ;MACnBC,UAAU,EAAE,CACRZ,MAAM,CAACE,GAAG,CAAC;MAAE;MACbH,IAAI,CAAC,CAAC;MAAE;MACRE,KAAK,CAAC;QAAEY,OAAO,EAAEX;MAAI,CAAC,CAAC,CAAC;MAAA;IAEhC,CAAC,CAAC,CAACY,IAAI,CAAC,CAAC;MAAEC,CAAC;MAAEC;IAAE,CAAC,KAAK;MAClBX,iBAAiB,CAACE,KAAK,CAACC,SAAS,GAAG,aAAaO,CAAC,OAAOC,CAAC,KAAK;IACnE,CAAC,CAAC;EACN,CAAC,EAAE,EAAE,CAAC;AACV","ignoreList":[]}
1
+ {"version":3,"file":"utils/setFloatingElemPosition.js","sources":["../../src/utils/setFloatingElemPosition.ts"],"sourcesContent":["import { computePosition, flip, offset, shift } from \"@floating-ui/dom\";\n\nconst GAP = 10;\n\nexport function setFloatingElemPosition(\n basePosition: Range | null,\n elementToPosition: HTMLElement\n): void {\n // A small timeout gives enough time for DOM to update and provides us with correct bounding rect values.\n setTimeout(() => {\n if (basePosition === null) {\n elementToPosition.style.transform = \"translate(-10000px, -10000px)\";\n return;\n }\n\n const virtualElement = {\n getBoundingClientRect: () => basePosition.getBoundingClientRect()\n };\n\n computePosition(virtualElement, elementToPosition, {\n placement: \"bottom\",\n middleware: [\n offset(GAP), // adds gap between anchor and popup\n flip(), // switches to the opposite side if no room (bottom → top)\n shift({ padding: GAP }) // slides along the axis to stay within viewport\n ]\n }).then(({ x, y }) => {\n elementToPosition.style.transform = `translate(${x}px, ${y}px)`;\n });\n }, 10);\n}\n"],"names":["GAP","setFloatingElemPosition","basePosition","elementToPosition","setTimeout","virtualElement","computePosition","offset","flip","shift","x","y"],"mappings":";AAEA,MAAMA,MAAM;AAEL,SAASC,wBACZC,YAA0B,EAC1BC,iBAA8B;IAG9BC,WAAW;QACP,IAAIF,AAAiB,SAAjBA,cAAuB;YACvBC,kBAAkB,KAAK,CAAC,SAAS,GAAG;YACpC;QACJ;QAEA,MAAME,iBAAiB;YACnB,uBAAuB,IAAMH,aAAa,qBAAqB;QACnE;QAEAI,gBAAgBD,gBAAgBF,mBAAmB;YAC/C,WAAW;YACX,YAAY;gBACRI,OAAOP;gBACPQ;gBACAC,MAAM;oBAAE,SAAST;gBAAI;aACxB;QACL,GAAG,IAAI,CAAC,CAAC,EAAEU,CAAC,EAAEC,CAAC,EAAE;YACbR,kBAAkB,KAAK,CAAC,SAAS,GAAG,CAAC,UAAU,EAAEO,EAAE,IAAI,EAAEC,EAAE,GAAG,CAAC;QACnE;IACJ,GAAG;AACP"}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"~/commands/typography.js\";\nexport * from \"~/commands/image.js\";\nexport * from \"~/commands/list.js\";\nexport * from \"~/commands/quote.js\";\nexport * from \"~/commands/toolbar.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["LexicalHtmlRenderer","getNodeFromSelection","useCurrentElement","useCurrentSelection","useDeriveValueFromSelection","useRichTextEditor","useFontColorPicker","useTextAlignmentAction","useTypographyAction","useIsMounted","Divider","DropDownItem","DropDown","LexicalEditorConfig","useLexicalEditorConfig"],"sources":["lexical.ts"],"sourcesContent":["// render\nexport { LexicalHtmlRenderer } from \"~/components/LexicalHtmlRenderer.js\";\n// hooks\nexport { getNodeFromSelection } from \"~/hooks/index.js\";\nexport { useCurrentElement } from \"~/hooks/index.js\";\nexport { useCurrentSelection } from \"~/hooks/index.js\";\nexport { useDeriveValueFromSelection } from \"~/hooks/index.js\";\nexport { useRichTextEditor } from \"~/hooks/index.js\";\nexport { useFontColorPicker } from \"~/hooks/index.js\";\nexport { useTextAlignmentAction } from \"~/hooks/index.js\";\nexport { useTypographyAction } from \"~/hooks/index.js\";\nexport { useIsMounted } from \"~/hooks/index.js\";\n// UI elements\nexport { Divider } from \"~/ui/Divider.js\";\nexport { DropDownItem } from \"~/ui/DropDown.js\";\nexport { DropDown } from \"~/ui/DropDown.js\";\n\n// types\nexport type { Klass, LexicalNode } from \"~/types.js\";\n// config\nexport {\n LexicalEditorConfig,\n useLexicalEditorConfig\n} from \"~/components/LexicalEditorConfig/LexicalEditorConfig.js\";\n"],"mappings":"AAAA;AACA,SAASA,mBAAmB;AAC5B;AACA,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,2BAA2B;AACpC,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;AAC3B,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,YAAY;AACrB;AACA,SAASC,OAAO;AAChB,SAASC,YAAY;AACrB,SAASC,QAAQ;;AAEjB;;AAEA;AACA,SACIC,mBAAmB,EACnBC,sBAAsB","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useRichTextEditor.js\";\nexport * from \"./useFontColorPicker.js\";\nexport * from \"./useTypographyAction.js\";\nexport * from \"./useTextAlignmentAction.js\";\nexport * from \"./useCurrentSelection.js\";\nexport * from \"./useCurrentElement.js\";\nexport * from \"./useIsMounted.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":["LexicalHtmlRenderer","Divider","DropDownItem","DropDown","BoldAction","BulletListAction","CodeHighlightAction","FontColorAction","ItalicAction","LinkAction","NumberedListAction","QuoteAction","UnderlineAction","TypographyAction","TextAlignmentAction","ImageAction","StaticToolbar","RichTextEditor","LinkPlugin","FloatingLinkEditorPlugin","CodeHighlightPlugin","BlurEventPlugin","FontColorPlugin","TypographyPlugin","QuotePlugin","ListPlugin","ImagesPlugin","StateHandlingPlugin","isValidLexicalData","types","LexicalEditorConfig","useLexicalEditorConfig"],"sources":["index.ts"],"sourcesContent":["// render\nexport { LexicalHtmlRenderer } from \"~/components/LexicalHtmlRenderer.js\";\n// hooks\nexport * from \"./hooks/index.js\";\n// UI elements\nexport { Divider } from \"~/ui/Divider.js\";\nexport { DropDownItem } from \"~/ui/DropDown.js\";\nexport { DropDown } from \"~/ui/DropDown.js\";\n// actions\nexport { BoldAction } from \"~/components/ToolbarActions/BoldAction.js\";\nexport { BulletListAction } from \"~/components/ToolbarActions/BulletListAction.js\";\nexport { CodeHighlightAction } from \"~/components/ToolbarActions/CodeHighlightAction.js\";\nexport { FontColorAction } from \"~/components/ToolbarActions/FontColorAction.js\";\nexport { ItalicAction } from \"~/components/ToolbarActions/ItalicAction.js\";\nexport { LinkAction } from \"~/components/ToolbarActions/LinkAction.js\";\nexport { NumberedListAction } from \"~/components/ToolbarActions/NumberedListAction.js\";\nexport { QuoteAction } from \"~/components/ToolbarActions/QuoteAction.js\";\nexport { UnderlineAction } from \"~/components/ToolbarActions/UnderlineAction.js\";\nexport { TypographyAction } from \"~/components/ToolbarActions/TypographyAction.js\";\nexport { TextAlignmentAction } from \"~/components/ToolbarActions/TextAlignmentAction.js\";\nexport { ImageAction } from \"~/components/ToolbarActions/ImageAction.js\";\n// toolbars\nexport { StaticToolbar } from \"~/components/Toolbar/StaticToolbar.js\";\n// editor\nexport { RichTextEditor } from \"~/components/Editor/RichTextEditor.js\";\n// plugins\nexport { LinkPlugin } from \"~/plugins/LinkPlugin/LinkPlugin.js\";\nexport { FloatingLinkEditorPlugin } from \"~/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js\";\nexport { CodeHighlightPlugin } from \"~/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js\";\nexport { BlurEventPlugin } from \"~/plugins/BlurEventPlugin/BlurEventPlugin.js\";\nexport { FontColorPlugin } from \"~/plugins/FontColorPlugin/FontColorPlugin.js\";\nexport { TypographyPlugin } from \"~/plugins/TypographyPlugin/TypographyPlugin.js\";\nexport { QuotePlugin } from \"~/plugins/QuoteNodePlugin/QuoteNodePlugin.js\";\nexport { ListPlugin } from \"~/plugins/ListPLugin/ListPlugin.js\";\nexport { ImagesPlugin } from \"~/plugins/ImagesPlugin/ImagesPlugin.js\";\nexport { StateHandlingPlugin } from \"~/plugins/StateHandlingPlugin.js\";\n// utils\nexport { isValidLexicalData } from \"~/utils/isValidLexicalData.js\";\n// Commands\nexport * from \"~/commands/index.js\";\n// types\nexport * as types from \"./types.js\";\n// config\nexport {\n LexicalEditorConfig,\n useLexicalEditorConfig\n} from \"~/components/LexicalEditorConfig/LexicalEditorConfig.js\";\n"],"mappings":"AAAA;AACA,SAASA,mBAAmB;AAC5B;AACA;AACA;AACA,SAASC,OAAO;AAChB,SAASC,YAAY;AACrB,SAASC,QAAQ;AACjB;AACA,SAASC,UAAU;AACnB,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAC5B,SAASC,eAAe;AACxB,SAASC,YAAY;AACrB,SAASC,UAAU;AACnB,SAASC,kBAAkB;AAC3B,SAASC,WAAW;AACpB,SAASC,eAAe;AACxB,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAC5B,SAASC,WAAW;AACpB;AACA,SAASC,aAAa;AACtB;AACA,SAASC,cAAc;AACvB;AACA,SAASC,UAAU;AACnB,SAASC,wBAAwB;AACjC,SAASC,mBAAmB;AAC5B,SAASC,eAAe;AACxB,SAASC,eAAe;AACxB,SAASC,gBAAgB;AACzB,SAASC,WAAW;AACpB,SAASC,UAAU;AACnB,SAASC,YAAY;AACrB,SAASC,mBAAmB;AAC5B;AACA,SAASC,kBAAkB;AAC3B;AACA;AACA;AACA,OAAO,KAAKC,KAAK;AACjB;AACA,SACIC,mBAAmB,EACnBC,sBAAsB","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CodeHighlightPlugin.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./FloatingLinkEditorPlugin.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export interface LinkFormProps {\n linkData: LinkData;\n onSave: (linkData: LinkData) => void;\n removeLink: () => void;\n}\n\nexport interface LinkData {\n url: string;\n target: string | null;\n alt: string | null;\n}\n"],"mappings":"","ignoreList":[]}
package/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":["FontColorPicker"],"sources":["types.ts"],"sourcesContent":["export type LexicalValue = string;\n\nexport type NormalizedInputValue = LexicalValue | null;\n\nexport { FontColorPicker } from \"~/components/ToolbarActions/FontColorAction.js\";\n\nexport type ImageActionType = \"image-action\";\nexport type ToolbarActionType = ImageActionType | string;\nexport interface ToolbarActionPlugin {\n targetAction: ToolbarActionType;\n plugin: Record<string, any> | ((cb: (value: any) => void) => any) | undefined;\n}\n\n/* Commands payload types */\nexport { type ImagePayload } from \"~/commands/index.js\";\n\n/* Lexical editor interfaces */\nexport { type RichTextEditorProps } from \"~/components/Editor/RichTextEditor.js\";\n\n// lexical types\nexport type { Klass, LexicalNode } from \"lexical\";\n"],"mappings":"AAIA,SAASA,eAAe;;AASxB;;AAGA;;AAGA","ignoreList":[]}