@lexical/react 0.14.2 → 0.14.4

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 (196) hide show
  1. package/LexicalAutoEmbedPlugin.dev.js +2 -2
  2. package/{LexicalAutoEmbedPlugin.dev.esm.js → LexicalAutoEmbedPlugin.dev.mjs} +2 -2
  3. package/{LexicalAutoEmbedPlugin.esm.js → LexicalAutoEmbedPlugin.mjs} +2 -2
  4. package/LexicalAutoEmbedPlugin.node.mjs +11 -0
  5. package/LexicalAutoEmbedPlugin.prod.js +2 -2
  6. package/{LexicalAutoEmbedPlugin.prod.esm.js → LexicalAutoEmbedPlugin.prod.mjs} +1 -1
  7. package/{LexicalHashtagPlugin.esm.js → LexicalAutoFocusPlugin.mjs} +3 -3
  8. package/LexicalAutoFocusPlugin.node.mjs +8 -0
  9. package/{LexicalAutoLinkPlugin.esm.js → LexicalAutoLinkPlugin.mjs} +2 -2
  10. package/LexicalAutoLinkPlugin.node.mjs +9 -0
  11. package/{LexicalBlockWithAlignableContents.esm.js → LexicalBlockWithAlignableContents.mjs} +2 -2
  12. package/LexicalBlockWithAlignableContents.node.mjs +8 -0
  13. package/{LexicalClearEditorPlugin.esm.js → LexicalCharacterLimitPlugin.mjs} +3 -3
  14. package/LexicalCharacterLimitPlugin.node.mjs +8 -0
  15. package/LexicalCheckListPlugin.dev.js +1 -1
  16. package/{LexicalCheckListPlugin.dev.esm.js → LexicalCheckListPlugin.dev.mjs} +2 -2
  17. package/LexicalCheckListPlugin.mjs +10 -0
  18. package/LexicalCheckListPlugin.node.mjs +8 -0
  19. package/LexicalCheckListPlugin.prod.js +1 -1
  20. package/LexicalCheckListPlugin.prod.mjs +7 -0
  21. package/LexicalClearEditorPlugin.dev.js +3 -0
  22. package/{LexicalClearEditorPlugin.dev.esm.js → LexicalClearEditorPlugin.dev.mjs} +4 -1
  23. package/{LexicalCheckListPlugin.esm.js → LexicalClearEditorPlugin.mjs} +3 -3
  24. package/LexicalClearEditorPlugin.node.mjs +8 -0
  25. package/LexicalClearEditorPlugin.prod.js +2 -2
  26. package/LexicalClearEditorPlugin.prod.mjs +7 -0
  27. package/LexicalClickableLinkPlugin.d.ts +2 -1
  28. package/LexicalClickableLinkPlugin.dev.js +8 -3
  29. package/{LexicalClickableLinkPlugin.dev.esm.js → LexicalClickableLinkPlugin.dev.mjs} +8 -3
  30. package/LexicalClickableLinkPlugin.mjs +10 -0
  31. package/LexicalClickableLinkPlugin.node.mjs +8 -0
  32. package/LexicalClickableLinkPlugin.prod.js +4 -3
  33. package/LexicalClickableLinkPlugin.prod.mjs +7 -0
  34. package/{LexicalCollaborationContext.esm.js → LexicalCollaborationContext.mjs} +2 -2
  35. package/LexicalCollaborationContext.node.mjs +9 -0
  36. package/LexicalCollaborationPlugin.mjs +10 -0
  37. package/LexicalCollaborationPlugin.node.mjs +8 -0
  38. package/{LexicalListPlugin.esm.js → LexicalComposer.mjs} +3 -3
  39. package/LexicalComposer.node.mjs +8 -0
  40. package/{LexicalComposerContext.esm.js → LexicalComposerContext.mjs} +2 -2
  41. package/LexicalComposerContext.node.mjs +10 -0
  42. package/LexicalContentEditable.mjs +10 -0
  43. package/LexicalContentEditable.node.mjs +8 -0
  44. package/LexicalContextMenuPlugin.d.ts +2 -1
  45. package/LexicalContextMenuPlugin.dev.js +8 -3
  46. package/{LexicalContextMenuPlugin.dev.esm.js → LexicalContextMenuPlugin.dev.mjs} +8 -3
  47. package/{LexicalContextMenuPlugin.esm.js → LexicalContextMenuPlugin.mjs} +2 -2
  48. package/LexicalContextMenuPlugin.node.mjs +9 -0
  49. package/LexicalContextMenuPlugin.prod.js +16 -16
  50. package/LexicalContextMenuPlugin.prod.mjs +7 -0
  51. package/{LexicalDecoratorBlockNode.esm.js → LexicalDecoratorBlockNode.mjs} +2 -2
  52. package/LexicalDecoratorBlockNode.node.mjs +9 -0
  53. package/LexicalEditorRefPlugin.mjs +10 -0
  54. package/LexicalEditorRefPlugin.node.mjs +8 -0
  55. package/{useLexicalEditable.esm.js → LexicalErrorBoundary.mjs} +2 -2
  56. package/LexicalErrorBoundary.node.mjs +8 -0
  57. package/{LexicalClickableLinkPlugin.esm.js → LexicalHashtagPlugin.mjs} +3 -3
  58. package/LexicalHashtagPlugin.node.mjs +8 -0
  59. package/{LexicalHistoryPlugin.esm.js → LexicalHistoryPlugin.mjs} +2 -2
  60. package/LexicalHistoryPlugin.node.mjs +9 -0
  61. package/{LexicalHorizontalRuleNode.esm.js → LexicalHorizontalRuleNode.mjs} +2 -2
  62. package/LexicalHorizontalRuleNode.node.mjs +11 -0
  63. package/{LexicalCollaborationPlugin.esm.js → LexicalHorizontalRulePlugin.mjs} +3 -3
  64. package/LexicalHorizontalRulePlugin.node.mjs +8 -0
  65. package/{LexicalTableOfContents.esm.js → LexicalLinkPlugin.mjs} +3 -3
  66. package/LexicalLinkPlugin.node.mjs +8 -0
  67. package/LexicalListPlugin.mjs +10 -0
  68. package/LexicalListPlugin.node.mjs +8 -0
  69. package/{LexicalMarkdownShortcutPlugin.esm.js → LexicalMarkdownShortcutPlugin.mjs} +2 -2
  70. package/LexicalMarkdownShortcutPlugin.node.mjs +9 -0
  71. package/LexicalNestedComposer.dev.js +6 -2
  72. package/{LexicalNestedComposer.dev.esm.js → LexicalNestedComposer.dev.mjs} +6 -2
  73. package/LexicalNestedComposer.mjs +10 -0
  74. package/LexicalNestedComposer.node.mjs +8 -0
  75. package/LexicalNestedComposer.prod.js +5 -4
  76. package/LexicalNestedComposer.prod.mjs +7 -0
  77. package/LexicalNodeEventPlugin.mjs +10 -0
  78. package/LexicalNodeEventPlugin.node.mjs +8 -0
  79. package/{LexicalNodeMenuPlugin.esm.js → LexicalNodeMenuPlugin.mjs} +2 -2
  80. package/LexicalNodeMenuPlugin.node.mjs +9 -0
  81. package/{LexicalComposer.esm.js → LexicalOnChangePlugin.mjs} +3 -3
  82. package/LexicalOnChangePlugin.node.mjs +8 -0
  83. package/LexicalPlainTextPlugin.mjs +10 -0
  84. package/LexicalPlainTextPlugin.node.mjs +8 -0
  85. package/{LexicalLinkPlugin.esm.js → LexicalRichTextPlugin.mjs} +3 -3
  86. package/LexicalRichTextPlugin.node.mjs +8 -0
  87. package/{LexicalTabIndentationPlugin.esm.js → LexicalTabIndentationPlugin.mjs} +2 -2
  88. package/LexicalTabIndentationPlugin.node.mjs +9 -0
  89. package/{LexicalErrorBoundary.esm.js → LexicalTableOfContents.mjs} +2 -2
  90. package/LexicalTableOfContents.node.mjs +8 -0
  91. package/LexicalTablePlugin.mjs +10 -0
  92. package/LexicalTablePlugin.node.mjs +8 -0
  93. package/LexicalTreeView.dev.js +26 -434
  94. package/LexicalTreeView.dev.mjs +75 -0
  95. package/{LexicalTreeView.esm.js → LexicalTreeView.mjs} +2 -2
  96. package/LexicalTreeView.node.mjs +8 -0
  97. package/LexicalTreeView.prod.js +3 -17
  98. package/LexicalTreeView.prod.mjs +7 -0
  99. package/{LexicalTypeaheadMenuPlugin.esm.js → LexicalTypeaheadMenuPlugin.mjs} +2 -2
  100. package/LexicalTypeaheadMenuPlugin.node.mjs +14 -0
  101. package/package.json +819 -179
  102. package/useLexicalEditable.mjs +10 -0
  103. package/useLexicalEditable.node.mjs +8 -0
  104. package/{useLexicalIsTextContentEmpty.esm.js → useLexicalIsTextContentEmpty.mjs} +2 -2
  105. package/useLexicalIsTextContentEmpty.node.mjs +8 -0
  106. package/{useLexicalNodeSelection.esm.js → useLexicalNodeSelection.mjs} +2 -2
  107. package/useLexicalNodeSelection.node.mjs +8 -0
  108. package/useLexicalSubscription.mjs +10 -0
  109. package/useLexicalSubscription.node.mjs +8 -0
  110. package/{LexicalAutoFocusPlugin.esm.js → useLexicalTextEntity.mjs} +3 -3
  111. package/useLexicalTextEntity.node.mjs +8 -0
  112. package/LexicalCharacterLimitPlugin.esm.js +0 -10
  113. package/LexicalCheckListPlugin.prod.esm.js +0 -7
  114. package/LexicalClearEditorPlugin.prod.esm.js +0 -7
  115. package/LexicalClickableLinkPlugin.prod.esm.js +0 -7
  116. package/LexicalContentEditable.esm.js +0 -10
  117. package/LexicalContextMenuPlugin.prod.esm.js +0 -7
  118. package/LexicalEditorRefPlugin.esm.js +0 -10
  119. package/LexicalHorizontalRulePlugin.esm.js +0 -10
  120. package/LexicalNestedComposer.esm.js +0 -10
  121. package/LexicalNestedComposer.prod.esm.js +0 -7
  122. package/LexicalNodeEventPlugin.esm.js +0 -10
  123. package/LexicalOnChangePlugin.esm.js +0 -10
  124. package/LexicalPlainTextPlugin.esm.js +0 -10
  125. package/LexicalRichTextPlugin.esm.js +0 -10
  126. package/LexicalTablePlugin.esm.js +0 -10
  127. package/LexicalTreeView.dev.esm.js +0 -483
  128. package/LexicalTreeView.prod.esm.js +0 -7
  129. package/useLexicalSubscription.esm.js +0 -10
  130. package/useLexicalTextEntity.esm.js +0 -10
  131. /package/{LexicalAutoFocusPlugin.dev.esm.js → LexicalAutoFocusPlugin.dev.mjs} +0 -0
  132. /package/{LexicalAutoFocusPlugin.prod.esm.js → LexicalAutoFocusPlugin.prod.mjs} +0 -0
  133. /package/{LexicalAutoLinkPlugin.dev.esm.js → LexicalAutoLinkPlugin.dev.mjs} +0 -0
  134. /package/{LexicalAutoLinkPlugin.prod.esm.js → LexicalAutoLinkPlugin.prod.mjs} +0 -0
  135. /package/{LexicalBlockWithAlignableContents.dev.esm.js → LexicalBlockWithAlignableContents.dev.mjs} +0 -0
  136. /package/{LexicalBlockWithAlignableContents.prod.esm.js → LexicalBlockWithAlignableContents.prod.mjs} +0 -0
  137. /package/{LexicalCharacterLimitPlugin.dev.esm.js → LexicalCharacterLimitPlugin.dev.mjs} +0 -0
  138. /package/{LexicalCharacterLimitPlugin.prod.esm.js → LexicalCharacterLimitPlugin.prod.mjs} +0 -0
  139. /package/{LexicalCollaborationContext.dev.esm.js → LexicalCollaborationContext.dev.mjs} +0 -0
  140. /package/{LexicalCollaborationContext.prod.esm.js → LexicalCollaborationContext.prod.mjs} +0 -0
  141. /package/{LexicalCollaborationPlugin.dev.esm.js → LexicalCollaborationPlugin.dev.mjs} +0 -0
  142. /package/{LexicalCollaborationPlugin.prod.esm.js → LexicalCollaborationPlugin.prod.mjs} +0 -0
  143. /package/{LexicalComposer.dev.esm.js → LexicalComposer.dev.mjs} +0 -0
  144. /package/{LexicalComposer.prod.esm.js → LexicalComposer.prod.mjs} +0 -0
  145. /package/{LexicalComposerContext.dev.esm.js → LexicalComposerContext.dev.mjs} +0 -0
  146. /package/{LexicalComposerContext.prod.esm.js → LexicalComposerContext.prod.mjs} +0 -0
  147. /package/{LexicalContentEditable.dev.esm.js → LexicalContentEditable.dev.mjs} +0 -0
  148. /package/{LexicalContentEditable.prod.esm.js → LexicalContentEditable.prod.mjs} +0 -0
  149. /package/{LexicalDecoratorBlockNode.dev.esm.js → LexicalDecoratorBlockNode.dev.mjs} +0 -0
  150. /package/{LexicalDecoratorBlockNode.prod.esm.js → LexicalDecoratorBlockNode.prod.mjs} +0 -0
  151. /package/{LexicalEditorRefPlugin.dev.esm.js → LexicalEditorRefPlugin.dev.mjs} +0 -0
  152. /package/{LexicalEditorRefPlugin.prod.esm.js → LexicalEditorRefPlugin.prod.mjs} +0 -0
  153. /package/{LexicalErrorBoundary.dev.esm.js → LexicalErrorBoundary.dev.mjs} +0 -0
  154. /package/{LexicalErrorBoundary.prod.esm.js → LexicalErrorBoundary.prod.mjs} +0 -0
  155. /package/{LexicalHashtagPlugin.dev.esm.js → LexicalHashtagPlugin.dev.mjs} +0 -0
  156. /package/{LexicalHashtagPlugin.prod.esm.js → LexicalHashtagPlugin.prod.mjs} +0 -0
  157. /package/{LexicalHistoryPlugin.dev.esm.js → LexicalHistoryPlugin.dev.mjs} +0 -0
  158. /package/{LexicalHistoryPlugin.prod.esm.js → LexicalHistoryPlugin.prod.mjs} +0 -0
  159. /package/{LexicalHorizontalRuleNode.dev.esm.js → LexicalHorizontalRuleNode.dev.mjs} +0 -0
  160. /package/{LexicalHorizontalRuleNode.prod.esm.js → LexicalHorizontalRuleNode.prod.mjs} +0 -0
  161. /package/{LexicalHorizontalRulePlugin.dev.esm.js → LexicalHorizontalRulePlugin.dev.mjs} +0 -0
  162. /package/{LexicalHorizontalRulePlugin.prod.esm.js → LexicalHorizontalRulePlugin.prod.mjs} +0 -0
  163. /package/{LexicalLinkPlugin.dev.esm.js → LexicalLinkPlugin.dev.mjs} +0 -0
  164. /package/{LexicalLinkPlugin.prod.esm.js → LexicalLinkPlugin.prod.mjs} +0 -0
  165. /package/{LexicalListPlugin.dev.esm.js → LexicalListPlugin.dev.mjs} +0 -0
  166. /package/{LexicalListPlugin.prod.esm.js → LexicalListPlugin.prod.mjs} +0 -0
  167. /package/{LexicalMarkdownShortcutPlugin.dev.esm.js → LexicalMarkdownShortcutPlugin.dev.mjs} +0 -0
  168. /package/{LexicalMarkdownShortcutPlugin.prod.esm.js → LexicalMarkdownShortcutPlugin.prod.mjs} +0 -0
  169. /package/{LexicalNodeEventPlugin.dev.esm.js → LexicalNodeEventPlugin.dev.mjs} +0 -0
  170. /package/{LexicalNodeEventPlugin.prod.esm.js → LexicalNodeEventPlugin.prod.mjs} +0 -0
  171. /package/{LexicalNodeMenuPlugin.dev.esm.js → LexicalNodeMenuPlugin.dev.mjs} +0 -0
  172. /package/{LexicalNodeMenuPlugin.prod.esm.js → LexicalNodeMenuPlugin.prod.mjs} +0 -0
  173. /package/{LexicalOnChangePlugin.dev.esm.js → LexicalOnChangePlugin.dev.mjs} +0 -0
  174. /package/{LexicalOnChangePlugin.prod.esm.js → LexicalOnChangePlugin.prod.mjs} +0 -0
  175. /package/{LexicalPlainTextPlugin.dev.esm.js → LexicalPlainTextPlugin.dev.mjs} +0 -0
  176. /package/{LexicalPlainTextPlugin.prod.esm.js → LexicalPlainTextPlugin.prod.mjs} +0 -0
  177. /package/{LexicalRichTextPlugin.dev.esm.js → LexicalRichTextPlugin.dev.mjs} +0 -0
  178. /package/{LexicalRichTextPlugin.prod.esm.js → LexicalRichTextPlugin.prod.mjs} +0 -0
  179. /package/{LexicalTabIndentationPlugin.dev.esm.js → LexicalTabIndentationPlugin.dev.mjs} +0 -0
  180. /package/{LexicalTabIndentationPlugin.prod.esm.js → LexicalTabIndentationPlugin.prod.mjs} +0 -0
  181. /package/{LexicalTableOfContents.dev.esm.js → LexicalTableOfContents.dev.mjs} +0 -0
  182. /package/{LexicalTableOfContents.prod.esm.js → LexicalTableOfContents.prod.mjs} +0 -0
  183. /package/{LexicalTablePlugin.dev.esm.js → LexicalTablePlugin.dev.mjs} +0 -0
  184. /package/{LexicalTablePlugin.prod.esm.js → LexicalTablePlugin.prod.mjs} +0 -0
  185. /package/{LexicalTypeaheadMenuPlugin.dev.esm.js → LexicalTypeaheadMenuPlugin.dev.mjs} +0 -0
  186. /package/{LexicalTypeaheadMenuPlugin.prod.esm.js → LexicalTypeaheadMenuPlugin.prod.mjs} +0 -0
  187. /package/{useLexicalEditable.dev.esm.js → useLexicalEditable.dev.mjs} +0 -0
  188. /package/{useLexicalEditable.prod.esm.js → useLexicalEditable.prod.mjs} +0 -0
  189. /package/{useLexicalIsTextContentEmpty.dev.esm.js → useLexicalIsTextContentEmpty.dev.mjs} +0 -0
  190. /package/{useLexicalIsTextContentEmpty.prod.esm.js → useLexicalIsTextContentEmpty.prod.mjs} +0 -0
  191. /package/{useLexicalNodeSelection.dev.esm.js → useLexicalNodeSelection.dev.mjs} +0 -0
  192. /package/{useLexicalNodeSelection.prod.esm.js → useLexicalNodeSelection.prod.mjs} +0 -0
  193. /package/{useLexicalSubscription.dev.esm.js → useLexicalSubscription.dev.mjs} +0 -0
  194. /package/{useLexicalSubscription.prod.esm.js → useLexicalSubscription.prod.mjs} +0 -0
  195. /package/{useLexicalTextEntity.dev.esm.js → useLexicalTextEntity.dev.mjs} +0 -0
  196. /package/{useLexicalTextEntity.prod.esm.js → useLexicalTextEntity.prod.mjs} +0 -0
@@ -44,7 +44,7 @@ function LexicalAutoEmbedPlugin({
44
44
  setActiveEmbedConfig(null);
45
45
  }, []);
46
46
  const checkIfLinkNodeIsEmbeddable = React.useCallback(key => {
47
- editor.getEditorState().read(async () => {
47
+ editor.getEditorState().read(async function () {
48
48
  const linkNode = lexical.$getNodeByKey(key);
49
49
  if (link.$isLinkNode(linkNode)) {
50
50
  for (let i = 0; i < embedConfigs.length; i++) {
@@ -85,7 +85,7 @@ function LexicalAutoEmbedPlugin({
85
85
  return false;
86
86
  }, lexical.COMMAND_PRIORITY_EDITOR);
87
87
  }, [editor, embedConfigs, onOpenEmbedModalForConfig]);
88
- const embedLinkViaActiveEmbedConfig = React.useCallback(async () => {
88
+ const embedLinkViaActiveEmbedConfig = React.useCallback(async function () {
89
89
  if (activeEmbedConfig != null && nodeKey != null) {
90
90
  const linkNode = editor.getEditorState().read(() => {
91
91
  const node = lexical.$getNodeByKey(nodeKey);
@@ -43,7 +43,7 @@ function LexicalAutoEmbedPlugin({
43
43
  setActiveEmbedConfig(null);
44
44
  }, []);
45
45
  const checkIfLinkNodeIsEmbeddable = useCallback(key => {
46
- editor.getEditorState().read(async () => {
46
+ editor.getEditorState().read(async function () {
47
47
  const linkNode = $getNodeByKey(key);
48
48
  if ($isLinkNode(linkNode)) {
49
49
  for (let i = 0; i < embedConfigs.length; i++) {
@@ -84,7 +84,7 @@ function LexicalAutoEmbedPlugin({
84
84
  return false;
85
85
  }, COMMAND_PRIORITY_EDITOR);
86
86
  }, [editor, embedConfigs, onOpenEmbedModalForConfig]);
87
- const embedLinkViaActiveEmbedConfig = useCallback(async () => {
87
+ const embedLinkViaActiveEmbedConfig = useCallback(async function () {
88
88
  if (activeEmbedConfig != null && nodeKey != null) {
89
89
  const linkNode = editor.getEditorState().read(() => {
90
90
  const node = $getNodeByKey(nodeKey);
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalAutoEmbedPlugin.dev.esm.js';
8
- import * as modProd from './LexicalAutoEmbedPlugin.prod.esm.js';
7
+ import * as modDev from './LexicalAutoEmbedPlugin.dev.mjs';
8
+ import * as modProd from './LexicalAutoEmbedPlugin.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
10
  export const AutoEmbedOption = mod.AutoEmbedOption;
11
11
  export const INSERT_EMBED_COMMAND = mod.INSERT_EMBED_COMMAND;
@@ -0,0 +1,11 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalAutoEmbedPlugin.dev.mjs') : import('./LexicalAutoEmbedPlugin.prod.mjs'));
8
+ export const AutoEmbedOption = mod.AutoEmbedOption;
9
+ export const INSERT_EMBED_COMMAND = mod.INSERT_EMBED_COMMAND;
10
+ export const LexicalAutoEmbedPlugin = mod.LexicalAutoEmbedPlugin;
11
+ export const URL_MATCHER = mod.URL_MATCHER;
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict';var e=require("@lexical/link"),k=require("@lexical/react/LexicalComposerContext"),l=require("@lexical/react/LexicalNodeMenuPlugin"),q=require("@lexical/utils"),r=require("lexical"),z=require("react");let A=r.createCommand("INSERT_EMBED_COMMAND");class B extends l.MenuOption{constructor(f,n){super(f);this.title=f;this.onSelect=n.onSelect.bind(this)}}exports.AutoEmbedOption=B;exports.INSERT_EMBED_COMMAND=A;
8
- exports.LexicalAutoEmbedPlugin=function({embedConfigs:f,onOpenEmbedModalForConfig:n,getMenuOptions:t,menuRenderFn:C,menuCommandPriority:D=r.COMMAND_PRIORITY_LOW}){let [c]=k.useLexicalComposerContext(),[g,u]=z.useState(null),[h,v]=z.useState(null),m=z.useCallback(()=>{u(null);v(null)},[]),w=z.useCallback(b=>{c.getEditorState().read(async()=>{const a=r.$getNodeByKey(b);if(e.$isLinkNode(a))for(let d=0;d<f.length;d++){const p=f[d];null!=await Promise.resolve(p.parseUrl(a.__url))&&(v(p),u(a.getKey()))}})},
9
- [c,f]);z.useEffect(()=>{let b=(a,{updateTags:d,dirtyLeaves:p})=>{for(const [x,E]of a)"created"===E&&d.has("paste")&&3>=p.size?w(x):x===g&&m()};return q.mergeRegister(...[e.LinkNode,e.AutoLinkNode].map(a=>c.registerMutationListener(a,(...d)=>b(...d))))},[w,c,f,g,m]);z.useEffect(()=>c.registerCommand(A,b=>{let a=f.find(({type:d})=>d===b);return a?(n(a),!0):!1},r.COMMAND_PRIORITY_EDITOR),[c,f,n]);let y=z.useCallback(async()=>{if(null!=h&&null!=g){const b=c.getEditorState().read(()=>{const a=r.$getNodeByKey(g);
8
+ exports.LexicalAutoEmbedPlugin=function({embedConfigs:f,onOpenEmbedModalForConfig:n,getMenuOptions:t,menuRenderFn:C,menuCommandPriority:D=r.COMMAND_PRIORITY_LOW}){let [c]=k.useLexicalComposerContext(),[g,u]=z.useState(null),[h,v]=z.useState(null),m=z.useCallback(()=>{u(null);v(null)},[]),w=z.useCallback(b=>{c.getEditorState().read(async function(){const a=r.$getNodeByKey(b);if(e.$isLinkNode(a))for(let d=0;d<f.length;d++){const p=f[d];null!=await Promise.resolve(p.parseUrl(a.__url))&&(v(p),u(a.getKey()))}})},
9
+ [c,f]);z.useEffect(()=>{let b=(a,{updateTags:d,dirtyLeaves:p})=>{for(const [x,E]of a)"created"===E&&d.has("paste")&&3>=p.size?w(x):x===g&&m()};return q.mergeRegister(...[e.LinkNode,e.AutoLinkNode].map(a=>c.registerMutationListener(a,(...d)=>b(...d))))},[w,c,f,g,m]);z.useEffect(()=>c.registerCommand(A,b=>{let a=f.find(({type:d})=>d===b);return a?(n(a),!0):!1},r.COMMAND_PRIORITY_EDITOR),[c,f,n]);let y=z.useCallback(async function(){if(null!=h&&null!=g){const b=c.getEditorState().read(()=>{const a=r.$getNodeByKey(g);
10
10
  return e.$isLinkNode(a)?a:null});if(e.$isLinkNode(b)){const a=await Promise.resolve(h.parseUrl(b.__url));null!=a&&c.update(()=>{r.$getSelection()||b.selectEnd();h.insertNode(c,a);b.isAttached()&&b.remove()})}}},[h,c,g]),F=z.useMemo(()=>null!=h&&null!=g?t(h,y,m):[],[h,y,t,g,m]),G=z.useCallback((b,a,d)=>{c.update(()=>{b.onSelect(a);d()})},[c]);return null!=g?z.createElement(l.LexicalNodeMenuPlugin,{nodeKey:g,onClose:m,onSelectOption:G,options:F,menuRenderFn:C,commandPriority:D}):null};
11
11
  exports.URL_MATCHER=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/
@@ -4,4 +4,4 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import{$isLinkNode as e,LinkNode as t,AutoLinkNode as n}from"@lexical/link";import{useLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{MenuOption as r,LexicalNodeMenuPlugin as l}from"@lexical/react/LexicalNodeMenuPlugin";import{mergeRegister as i}from"@lexical/utils";import{createCommand as s,$getNodeByKey as a,COMMAND_PRIORITY_EDITOR as c,$getSelection as u,COMMAND_PRIORITY_LOW as m}from"lexical";import*as d from"react";import{useState as p,useCallback as f,useEffect as g,useMemo as x}from"react";const w=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,y=s("INSERT_EMBED_COMMAND");class C extends r{constructor(e,t){super(e),this.title=e,this.onSelect=t.onSelect.bind(this)}}function E({embedConfigs:r,onOpenEmbedModalForConfig:s,getMenuOptions:w,menuRenderFn:C,menuCommandPriority:E=m}){const[_]=o(),[h,M]=p(null),[S,A]=p(null),P=f((()=>{M(null),A(null)}),[]),b=f((t=>{_.getEditorState().read((async()=>{const n=a(t);if(e(n))for(let e=0;e<r.length;e++){const t=r[e];null!=await Promise.resolve(t.parseUrl(n.__url))&&(A(t),M(n.getKey()))}}))}),[_,r]);g((()=>i(...[t,n].map((e=>_.registerMutationListener(e,((...e)=>((e,{updateTags:t,dirtyLeaves:n})=>{for(const[o,r]of e)"created"===r&&t.has("paste")&&n.size<=3?b(o):o===h&&P()})(...e))))))),[b,_,r,h,P]),g((()=>_.registerCommand(y,(e=>{const t=r.find((({type:t})=>t===e));return!!t&&(s(t),!0)}),c)),[_,r,s]);const v=f((async()=>{if(null!=S&&null!=h){const t=_.getEditorState().read((()=>{const t=a(h);return e(t)?t:null}));if(e(t)){const e=await Promise.resolve(S.parseUrl(t.__url));null!=e&&_.update((()=>{u()||t.selectEnd(),S.insertNode(_,e),t.isAttached()&&t.remove()}))}}}),[S,_,h]),z=x((()=>null!=S&&null!=h?w(S,v,P):[]),[S,v,w,h,P]),L=f(((e,t,n)=>{_.update((()=>{e.onSelect(t),n()}))}),[_]);return null!=h?d.createElement(l,{nodeKey:h,onClose:P,onSelectOption:L,options:z,menuRenderFn:C,commandPriority:E}):null}export{C as AutoEmbedOption,y as INSERT_EMBED_COMMAND,E as LexicalAutoEmbedPlugin,w as URL_MATCHER};
7
+ import{$isLinkNode as e,LinkNode as t,AutoLinkNode as n}from"@lexical/link";import{useLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{MenuOption as r,LexicalNodeMenuPlugin as l}from"@lexical/react/LexicalNodeMenuPlugin";import{mergeRegister as i}from"@lexical/utils";import{createCommand as s,$getNodeByKey as a,COMMAND_PRIORITY_EDITOR as c,$getSelection as u,COMMAND_PRIORITY_LOW as m}from"lexical";import*as d from"react";import{useState as p,useCallback as f,useEffect as g,useMemo as x}from"react";const w=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,y=s("INSERT_EMBED_COMMAND");class C extends r{constructor(e,t){super(e),this.title=e,this.onSelect=t.onSelect.bind(this)}}function E({embedConfigs:r,onOpenEmbedModalForConfig:s,getMenuOptions:w,menuRenderFn:C,menuCommandPriority:E=m}){const[_]=o(),[h,M]=p(null),[S,A]=p(null),P=f((()=>{M(null),A(null)}),[]),b=f((t=>{_.getEditorState().read((async function(){const n=a(t);if(e(n))for(let e=0;e<r.length;e++){const t=r[e];null!=await Promise.resolve(t.parseUrl(n.__url))&&(A(t),M(n.getKey()))}}))}),[_,r]);g((()=>i(...[t,n].map((e=>_.registerMutationListener(e,((...e)=>((e,{updateTags:t,dirtyLeaves:n})=>{for(const[o,r]of e)"created"===r&&t.has("paste")&&n.size<=3?b(o):o===h&&P()})(...e))))))),[b,_,r,h,P]),g((()=>_.registerCommand(y,(e=>{const t=r.find((({type:t})=>t===e));return!!t&&(s(t),!0)}),c)),[_,r,s]);const v=f((async function(){if(null!=S&&null!=h){const t=_.getEditorState().read((()=>{const t=a(h);return e(t)?t:null}));if(e(t)){const e=await Promise.resolve(S.parseUrl(t.__url));null!=e&&_.update((()=>{u()||t.selectEnd(),S.insertNode(_,e),t.isAttached()&&t.remove()}))}}}),[S,_,h]),z=x((()=>null!=S&&null!=h?w(S,v,P):[]),[S,v,w,h,P]),L=f(((e,t,n)=>{_.update((()=>{e.onSelect(t),n()}))}),[_]);return null!=h?d.createElement(l,{nodeKey:h,onClose:P,onSelectOption:L,options:z,menuRenderFn:C,commandPriority:E}):null}export{C as AutoEmbedOption,y as INSERT_EMBED_COMMAND,E as LexicalAutoEmbedPlugin,w as URL_MATCHER};
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalHashtagPlugin.dev.esm.js';
8
- import * as modProd from './LexicalHashtagPlugin.prod.esm.js';
7
+ import * as modDev from './LexicalAutoFocusPlugin.dev.mjs';
8
+ import * as modProd from './LexicalAutoFocusPlugin.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
- export const HashtagPlugin = mod.HashtagPlugin;
10
+ export const AutoFocusPlugin = mod.AutoFocusPlugin;
@@ -0,0 +1,8 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalAutoFocusPlugin.dev.mjs') : import('./LexicalAutoFocusPlugin.prod.mjs'));
8
+ export const AutoFocusPlugin = mod.AutoFocusPlugin;
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalAutoLinkPlugin.dev.esm.js';
8
- import * as modProd from './LexicalAutoLinkPlugin.prod.esm.js';
7
+ import * as modDev from './LexicalAutoLinkPlugin.dev.mjs';
8
+ import * as modProd from './LexicalAutoLinkPlugin.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
10
  export const AutoLinkPlugin = mod.AutoLinkPlugin;
11
11
  export const createLinkMatcherWithRegExp = mod.createLinkMatcherWithRegExp;
@@ -0,0 +1,9 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalAutoLinkPlugin.dev.mjs') : import('./LexicalAutoLinkPlugin.prod.mjs'));
8
+ export const AutoLinkPlugin = mod.AutoLinkPlugin;
9
+ export const createLinkMatcherWithRegExp = mod.createLinkMatcherWithRegExp;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalBlockWithAlignableContents.dev.esm.js';
8
- import * as modProd from './LexicalBlockWithAlignableContents.prod.esm.js';
7
+ import * as modDev from './LexicalBlockWithAlignableContents.dev.mjs';
8
+ import * as modProd from './LexicalBlockWithAlignableContents.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
10
  export const BlockWithAlignableContents = mod.BlockWithAlignableContents;
@@ -0,0 +1,8 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalBlockWithAlignableContents.dev.mjs') : import('./LexicalBlockWithAlignableContents.prod.mjs'));
8
+ export const BlockWithAlignableContents = mod.BlockWithAlignableContents;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalClearEditorPlugin.dev.esm.js';
8
- import * as modProd from './LexicalClearEditorPlugin.prod.esm.js';
7
+ import * as modDev from './LexicalCharacterLimitPlugin.dev.mjs';
8
+ import * as modProd from './LexicalCharacterLimitPlugin.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
- export const ClearEditorPlugin = mod.ClearEditorPlugin;
10
+ export const CharacterLimitPlugin = mod.CharacterLimitPlugin;
@@ -0,0 +1,8 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalCharacterLimitPlugin.dev.mjs') : import('./LexicalCharacterLimitPlugin.prod.mjs'));
8
+ export const CharacterLimitPlugin = mod.CharacterLimitPlugin;
@@ -108,8 +108,8 @@ function handleCheckItemEvent(event, callback) {
108
108
  if (!parentNode || parentNode.__lexicalListType !== 'check') {
109
109
  return;
110
110
  }
111
- const pageX = event.pageX;
112
111
  const rect = target.getBoundingClientRect();
112
+ const pageX = event.pageX / utils.calculateZoomLevel(target);
113
113
  if (target.dir === 'rtl' ? pageX < rect.right && pageX > rect.right - 20 : pageX > rect.left && pageX < rect.left + 20) {
114
114
  callback();
115
115
  }
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { INSERT_CHECK_LIST_COMMAND, insertList, $isListItemNode, $isListNode } from '@lexical/list';
8
8
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
- import { mergeRegister, $findMatchingParent, isHTMLElement } from '@lexical/utils';
9
+ import { mergeRegister, $findMatchingParent, isHTMLElement, calculateZoomLevel } from '@lexical/utils';
10
10
  import { COMMAND_PRIORITY_LOW, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ESCAPE_COMMAND, KEY_SPACE_COMMAND, $getNearestNodeFromDOMNode, KEY_ARROW_LEFT_COMMAND, $getSelection, $isRangeSelection, $isElementNode } from 'lexical';
11
11
  import { useEffect } from 'react';
12
12
 
@@ -106,8 +106,8 @@ function handleCheckItemEvent(event, callback) {
106
106
  if (!parentNode || parentNode.__lexicalListType !== 'check') {
107
107
  return;
108
108
  }
109
- const pageX = event.pageX;
110
109
  const rect = target.getBoundingClientRect();
110
+ const pageX = event.pageX / calculateZoomLevel(target);
111
111
  if (target.dir === 'rtl' ? pageX < rect.right && pageX > rect.right - 20 : pageX > rect.left && pageX < rect.left + 20) {
112
112
  callback();
113
113
  }
@@ -0,0 +1,10 @@
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
+ import * as modDev from './LexicalCheckListPlugin.dev.mjs';
8
+ import * as modProd from './LexicalCheckListPlugin.prod.mjs';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export const CheckListPlugin = mod.CheckListPlugin;
@@ -0,0 +1,8 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalCheckListPlugin.dev.mjs') : import('./LexicalCheckListPlugin.prod.mjs'));
8
+ export const CheckListPlugin = mod.CheckListPlugin;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- 'use strict';var e=require("@lexical/list"),g=require("@lexical/react/LexicalComposerContext"),k=require("@lexical/utils"),l=require("lexical"),m=require("react");function n(a,c){let b=a.target;if(null!==b&&k.isHTMLElement(b)){var d=b.firstChild;(null==d||!k.isHTMLElement(d)||"UL"!==d.tagName&&"OL"!==d.tagName)&&(d=b.parentNode)&&"check"===d.__lexicalListType&&(a=a.pageX,d=b.getBoundingClientRect(),("rtl"===b.dir?a<d.right&&a>d.right-20:a>d.left&&a<d.left+20)&&c())}}
7
+ 'use strict';var e=require("@lexical/list"),g=require("@lexical/react/LexicalComposerContext"),k=require("@lexical/utils"),l=require("lexical"),m=require("react");function n(a,c){let b=a.target;if(null!==b&&k.isHTMLElement(b)){var d=b.firstChild;(null==d||!k.isHTMLElement(d)||"UL"!==d.tagName&&"OL"!==d.tagName)&&(d=b.parentNode)&&"check"===d.__lexicalListType&&(d=b.getBoundingClientRect(),a=a.pageX/k.calculateZoomLevel(b),("rtl"===b.dir?a<d.right&&a>d.right-20:a>d.left&&a<d.left+20)&&c())}}
8
8
  function p(a){n(a,()=>{let c=a.target,b=q(c);null!=b&&b.isEditable()&&b.update(()=>{if(a.target){let d=l.$getNearestNodeFromDOMNode(c);e.$isListItemNode(d)&&(c.focus(),d.toggleChecked())}})})}function r(a){n(a,()=>{a.preventDefault()})}function q(a){for(;a;){if(a.__lexicalEditor)return a.__lexicalEditor;a=a.parentNode}return null}function t(){let a=document.activeElement;return null!=a&&"LI"===a.tagName&&null!=a.parentNode&&"check"===a.parentNode.__lexicalListType?a:null}
9
9
  function u(a,c){let b=c?a.getPreviousSibling():a.getNextSibling();for(;null==b&&e.$isListItemNode(a);)a=a.getParentOrThrow().getParent(),null!=a&&(b=c?a.getPreviousSibling():a.getNextSibling());for(;e.$isListItemNode(b);){a=c?b.getLastChild():b.getFirstChild();if(!e.$isListNode(a))return b;b=c?a.getLastChild():a.getFirstChild()}return null}
10
10
  function v(a,c,b){let d=t();null!=d&&c.update(()=>{var f=l.$getNearestNodeFromDOMNode(d);if(e.$isListItemNode(f)&&(f=u(f,b),null!=f)){f.selectStart();let h=c.getElementByKey(f.__key);null!=h&&(a.preventDefault(),setTimeout(()=>{h.focus()},0))}});return!1}
@@ -0,0 +1,7 @@
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
+ import{INSERT_CHECK_LIST_COMMAND as e,insertList as t,$isListItemNode as n,$isListNode as r}from"@lexical/list";import{useLexicalComposerContext as i}from"@lexical/react/LexicalComposerContext";import{mergeRegister as l,$findMatchingParent as o,isHTMLElement as c,calculateZoomLevel as u}from"@lexical/utils";import{COMMAND_PRIORITY_LOW as s,KEY_ARROW_DOWN_COMMAND as a,KEY_ARROW_UP_COMMAND as g,KEY_ESCAPE_COMMAND as f,KEY_SPACE_COMMAND as d,$getNearestNodeFromDOMNode as m,KEY_ARROW_LEFT_COMMAND as p,$getSelection as C,$isRangeSelection as h,$isElementNode as v}from"lexical";import{useEffect as E}from"react";function L(){const[c]=i();return E((()=>l(c.registerCommand(e,(()=>(t(c,"check"),!0)),s),c.registerCommand(a,(e=>N(e,c,!1)),s),c.registerCommand(g,(e=>N(e,c,!0)),s),c.registerCommand(f,(e=>{if(null!=y()){const e=c.getRootElement();return null!=e&&e.focus(),!0}return!1}),s),c.registerCommand(d,(e=>{const t=y();return!(null==t||!c.isEditable())&&(c.update((()=>{const r=m(t);n(r)&&(e.preventDefault(),r.toggleChecked())})),!0)}),s),c.registerCommand(p,(e=>c.getEditorState().read((()=>{const t=C();if(h(t)&&t.isCollapsed()){const{anchor:i}=t,l="element"===i.type;if(l||0===i.offset){const t=i.getNode(),u=o(t,(e=>v(e)&&!e.isInline()));if(n(u)){const n=u.getParent();if(r(n)&&"check"===n.getListType()&&(l||u.getFirstDescendant()===t)){const t=c.getElementByKey(u.__key);if(null!=t&&document.activeElement!==t)return t.focus(),e.preventDefault(),!0}}}}return!1}))),s),c.registerRootListener(((e,t)=>{null!==e&&(e.addEventListener("click",_),e.addEventListener("pointerdown",k)),null!==t&&(t.removeEventListener("click",_),t.removeEventListener("pointerdown",k))}))))),null}function x(e,t){const n=e.target;if(null===n||!c(n))return;const r=n.firstChild;if(null!=r&&c(r)&&("UL"===r.tagName||"OL"===r.tagName))return;const i=n.parentNode;if(!i||"check"!==i.__lexicalListType)return;const l=n.getBoundingClientRect(),o=e.pageX/u(n);("rtl"===n.dir?o<l.right&&o>l.right-20:o>l.left&&o<l.left+20)&&t()}function _(e){x(e,(()=>{const t=e.target,r=function(e){let t=e;for(;t;){if(t.__lexicalEditor)return t.__lexicalEditor;t=t.parentNode}return null}(t);null!=r&&r.isEditable()&&r.update((()=>{if(e.target){const e=m(t);n(e)&&(t.focus(),e.toggleChecked())}}))}))}function k(e){x(e,(()=>{e.preventDefault()}))}function y(){const e=document.activeElement;return null!=e&&"LI"===e.tagName&&null!=e.parentNode&&"check"===e.parentNode.__lexicalListType?e:null}function N(e,t,i){const l=y();return null!=l&&t.update((()=>{const o=m(l);if(!n(o))return;const c=function(e,t){let i=t?e.getPreviousSibling():e.getNextSibling(),l=e;for(;null==i&&n(l);)l=l.getParentOrThrow().getParent(),null!=l&&(i=t?l.getPreviousSibling():l.getNextSibling());for(;n(i);){const e=t?i.getLastChild():i.getFirstChild();if(!r(e))return i;i=t?e.getLastChild():e.getFirstChild()}return null}(o,i);if(null!=c){c.selectStart();const n=t.getElementByKey(c.__key);null!=n&&(e.preventDefault(),setTimeout((()=>{n.focus()}),0))}})),!1}export{L as CheckListPlugin};
@@ -53,6 +53,9 @@ function ClearEditorPlugin({
53
53
  if (selection !== null) {
54
54
  paragraph.select();
55
55
  }
56
+ if (lexical.$isRangeSelection(selection)) {
57
+ selection.format = 0;
58
+ }
56
59
  } else {
57
60
  onClear();
58
61
  }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
- import { CLEAR_EDITOR_COMMAND, $getRoot, $getSelection, $createParagraphNode, COMMAND_PRIORITY_EDITOR } from 'lexical';
8
+ import { CLEAR_EDITOR_COMMAND, $getRoot, $getSelection, $createParagraphNode, $isRangeSelection, COMMAND_PRIORITY_EDITOR } from 'lexical';
9
9
  import { useLayoutEffect as useLayoutEffect$1, useEffect } from 'react';
10
10
 
11
11
  /**
@@ -51,6 +51,9 @@ function ClearEditorPlugin({
51
51
  if (selection !== null) {
52
52
  paragraph.select();
53
53
  }
54
+ if ($isRangeSelection(selection)) {
55
+ selection.format = 0;
56
+ }
54
57
  } else {
55
58
  onClear();
56
59
  }
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalCheckListPlugin.dev.esm.js';
8
- import * as modProd from './LexicalCheckListPlugin.prod.esm.js';
7
+ import * as modDev from './LexicalClearEditorPlugin.dev.mjs';
8
+ import * as modProd from './LexicalClearEditorPlugin.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
- export const CheckListPlugin = mod.CheckListPlugin;
10
+ export const ClearEditorPlugin = mod.ClearEditorPlugin;
@@ -0,0 +1,8 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalClearEditorPlugin.dev.mjs') : import('./LexicalClearEditorPlugin.prod.mjs'));
8
+ export const ClearEditorPlugin = mod.ClearEditorPlugin;
@@ -4,5 +4,5 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- 'use strict';var a=require("@lexical/react/LexicalComposerContext"),d=require("lexical"),g=require("react"),h="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?g.useLayoutEffect:g.useEffect;
8
- exports.ClearEditorPlugin=function({onClear:b}){let [c]=a.useLexicalComposerContext();h(()=>c.registerCommand(d.CLEAR_EDITOR_COMMAND,()=>{c.update(()=>{if(null==b){let e=d.$getRoot(),k=d.$getSelection(),f=d.$createParagraphNode();e.clear();e.append(f);null!==k&&f.select()}else b()});return!0},d.COMMAND_PRIORITY_EDITOR),[c,b]);return null}
7
+ 'use strict';var a=require("@lexical/react/LexicalComposerContext"),e=require("lexical"),h=require("react"),k="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?h.useLayoutEffect:h.useEffect;
8
+ exports.ClearEditorPlugin=function({onClear:b}){let [c]=a.useLexicalComposerContext();k(()=>c.registerCommand(e.CLEAR_EDITOR_COMMAND,()=>{c.update(()=>{if(null==b){let f=e.$getRoot(),d=e.$getSelection(),g=e.$createParagraphNode();f.clear();f.append(g);null!==d&&g.select();e.$isRangeSelection(d)&&(d.format=0)}else b()});return!0},e.COMMAND_PRIORITY_EDITOR),[c,b]);return null}
@@ -0,0 +1,7 @@
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
+ import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{CLEAR_EDITOR_COMMAND as o,$getRoot as t,$getSelection as n,$createParagraphNode as r,$isRangeSelection as l,COMMAND_PRIORITY_EDITOR as a}from"lexical";import{useLayoutEffect as i,useEffect as c}from"react";var m="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?i:c;function d({onClear:i}){const[c]=e();return m((()=>c.registerCommand(o,(e=>(c.update((()=>{if(null==i){const e=t(),o=n(),a=r();e.clear(),e.append(a),null!==o&&a.select(),l(o)&&(o.format=0)}else i()})),!0)),a)),[c,i]),null}export{d as ClearEditorPlugin};
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- export default function LexicalClickableLinkPlugin({ newTab, }: {
8
+ export default function LexicalClickableLinkPlugin({ newTab, disabled, }: {
9
9
  newTab?: boolean;
10
+ disabled?: boolean;
10
11
  }): null;
@@ -30,11 +30,16 @@ function findMatchingDOM(startNode, predicate) {
30
30
  return null;
31
31
  }
32
32
  function LexicalClickableLinkPlugin({
33
- newTab = true
33
+ newTab = true,
34
+ disabled = false
34
35
  }) {
35
36
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
36
37
  react.useEffect(() => {
37
38
  const onClick = event => {
39
+ if (disabled) {
40
+ event.preventDefault();
41
+ return;
42
+ }
38
43
  const target = event.target;
39
44
  if (!(target instanceof Node)) {
40
45
  return;
@@ -76,7 +81,7 @@ function LexicalClickableLinkPlugin({
76
81
  event.preventDefault();
77
82
  };
78
83
  const onMouseUp = event => {
79
- if (event.button === 1 && editor.isEditable()) {
84
+ if (!disabled && event.button === 1) {
80
85
  onClick(event);
81
86
  }
82
87
  };
@@ -90,7 +95,7 @@ function LexicalClickableLinkPlugin({
90
95
  rootElement.addEventListener('mouseup', onMouseUp);
91
96
  }
92
97
  });
93
- }, [editor, newTab]);
98
+ }, [editor, newTab, disabled]);
94
99
  return null;
95
100
  }
96
101
 
@@ -28,11 +28,16 @@ function findMatchingDOM(startNode, predicate) {
28
28
  return null;
29
29
  }
30
30
  function LexicalClickableLinkPlugin({
31
- newTab = true
31
+ newTab = true,
32
+ disabled = false
32
33
  }) {
33
34
  const [editor] = useLexicalComposerContext();
34
35
  useEffect(() => {
35
36
  const onClick = event => {
37
+ if (disabled) {
38
+ event.preventDefault();
39
+ return;
40
+ }
36
41
  const target = event.target;
37
42
  if (!(target instanceof Node)) {
38
43
  return;
@@ -74,7 +79,7 @@ function LexicalClickableLinkPlugin({
74
79
  event.preventDefault();
75
80
  };
76
81
  const onMouseUp = event => {
77
- if (event.button === 1 && editor.isEditable()) {
82
+ if (!disabled && event.button === 1) {
78
83
  onClick(event);
79
84
  }
80
85
  };
@@ -88,7 +93,7 @@ function LexicalClickableLinkPlugin({
88
93
  rootElement.addEventListener('mouseup', onMouseUp);
89
94
  }
90
95
  });
91
- }, [editor, newTab]);
96
+ }, [editor, newTab, disabled]);
92
97
  return null;
93
98
  }
94
99
 
@@ -0,0 +1,10 @@
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
+ import * as modDev from './LexicalClickableLinkPlugin.dev.mjs';
8
+ import * as modProd from './LexicalClickableLinkPlugin.prod.mjs';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export default mod.default;
@@ -0,0 +1,8 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalClickableLinkPlugin.dev.mjs') : import('./LexicalClickableLinkPlugin.prod.mjs'));
8
+ export default mod.default;
@@ -4,6 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- 'use strict';var e=require("@lexical/link"),m=require("@lexical/react/LexicalComposerContext"),q=require("@lexical/utils"),r=require("lexical"),t=require("react");
8
- module.exports=function({newTab:n=!0}){let [h]=m.useLexicalComposerContext();t.useEffect(()=>{let l=b=>{const c=b.target;if(c instanceof Node){var d=r.getNearestEditorFromDOMNode(c);if(null!==d){var f=null,k=null;d.update(()=>{var a=r.$getNearestNodeFromDOMNode(c);if(null!==a)if(a=q.$findMatchingParent(a,r.$isElementNode),e.$isLinkNode(a))f=a.sanitizeUrl(a.getURL()),k=a.getTarget();else{a:{a=q.isHTMLAnchorElement;let g=c;for(;null!=g;){if(a(g)){a=g;break a}g=g.parentNode}a=null}null!==a&&(f=a.href,
9
- k=a.target)}});if(null!==f&&""!==f){d=h.getEditorState().read(r.$getSelection);if(!r.$isRangeSelection(d)||d.isCollapsed())d="auxclick"===b.type&&1===b.button,window.open(f,n||d||b.metaKey||b.ctrlKey||"_blank"===k?"_blank":"_self");b.preventDefault()}}}},p=b=>{1===b.button&&h.isEditable()&&l(b)};return h.registerRootListener((b,c)=>{null!==c&&(c.removeEventListener("click",l),c.removeEventListener("mouseup",p));null!==b&&(b.addEventListener("click",l),b.addEventListener("mouseup",p))})},[h,n]);return null}
7
+ 'use strict';var e=require("@lexical/link"),n=require("@lexical/react/LexicalComposerContext"),r=require("@lexical/utils"),t=require("lexical"),u=require("react");
8
+ module.exports=function({newTab:p=!0,disabled:h=!1}){let [k]=n.useLexicalComposerContext();u.useEffect(()=>{let m=a=>{if(h)a.preventDefault();else{var c=a.target;if(c instanceof Node){var d=t.getNearestEditorFromDOMNode(c);if(null!==d){var f=null,l=null;d.update(()=>{var b=t.$getNearestNodeFromDOMNode(c);if(null!==b)if(b=r.$findMatchingParent(b,t.$isElementNode),e.$isLinkNode(b))f=b.sanitizeUrl(b.getURL()),l=b.getTarget();else{a:{b=r.isHTMLAnchorElement;let g=c;for(;null!=g;){if(b(g)){b=g;break a}g=
9
+ g.parentNode}b=null}null!==b&&(f=b.href,l=b.target)}});if(null!==f&&""!==f){d=k.getEditorState().read(t.$getSelection);if(!t.$isRangeSelection(d)||d.isCollapsed())d="auxclick"===a.type&&1===a.button,window.open(f,p||d||a.metaKey||a.ctrlKey||"_blank"===l?"_blank":"_self");a.preventDefault()}}}}},q=a=>{h||1!==a.button||m(a)};return k.registerRootListener((a,c)=>{null!==c&&(c.removeEventListener("click",m),c.removeEventListener("mouseup",q));null!==a&&(a.addEventListener("click",m),a.addEventListener("mouseup",
10
+ q))})},[k,p,h]);return null}
@@ -0,0 +1,7 @@
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
+ import{$isLinkNode as e}from"@lexical/link";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as n,isHTMLAnchorElement as r}from"@lexical/utils";import{getNearestEditorFromDOMNode as l,$getNearestNodeFromDOMNode as o,$isElementNode as i,$getSelection as u,$isRangeSelection as a}from"lexical";import{useEffect as s}from"react";function c({newTab:c=!0,disabled:f=!1}){const[p]=t();return s((()=>{const t=t=>{if(f)return void t.preventDefault();const s=t.target;if(!(s instanceof Node))return;const d=l(s);if(null===d)return;let m=null,v=null;if(d.update((()=>{const t=o(s);if(null!==t){const l=n(t,i);if(e(l))m=l.sanitizeUrl(l.getURL()),v=l.getTarget();else{const e=function(e,t){let n=e;for(;null!=n;){if(t(n))return n;n=n.parentNode}return null}(s,r);null!==e&&(m=e.href,v=e.target)}}})),null===m||""===m)return;const x=p.getEditorState().read(u);if(a(x)&&!x.isCollapsed())return void t.preventDefault();const g="auxclick"===t.type&&1===t.button;window.open(m,c||g||t.metaKey||t.ctrlKey||"_blank"===v?"_blank":"_self"),t.preventDefault()},s=e=>{f||1!==e.button||t(e)};return p.registerRootListener(((e,n)=>{null!==n&&(n.removeEventListener("click",t),n.removeEventListener("mouseup",s)),null!==e&&(e.addEventListener("click",t),e.addEventListener("mouseup",s))}))}),[p,c,f]),null}export{c as default};
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalCollaborationContext.dev.esm.js';
8
- import * as modProd from './LexicalCollaborationContext.prod.esm.js';
7
+ import * as modDev from './LexicalCollaborationContext.dev.mjs';
8
+ import * as modProd from './LexicalCollaborationContext.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
10
  export const CollaborationContext = mod.CollaborationContext;
11
11
  export const useCollaborationContext = mod.useCollaborationContext;
@@ -0,0 +1,9 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalCollaborationContext.dev.mjs') : import('./LexicalCollaborationContext.prod.mjs'));
8
+ export const CollaborationContext = mod.CollaborationContext;
9
+ export const useCollaborationContext = mod.useCollaborationContext;
@@ -0,0 +1,10 @@
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
+ import * as modDev from './LexicalCollaborationPlugin.dev.mjs';
8
+ import * as modProd from './LexicalCollaborationPlugin.prod.mjs';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export const CollaborationPlugin = mod.CollaborationPlugin;
@@ -0,0 +1,8 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalCollaborationPlugin.dev.mjs') : import('./LexicalCollaborationPlugin.prod.mjs'));
8
+ export const CollaborationPlugin = mod.CollaborationPlugin;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalListPlugin.dev.esm.js';
8
- import * as modProd from './LexicalListPlugin.prod.esm.js';
7
+ import * as modDev from './LexicalComposer.dev.mjs';
8
+ import * as modProd from './LexicalComposer.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
- export const ListPlugin = mod.ListPlugin;
10
+ export const LexicalComposer = mod.LexicalComposer;
@@ -0,0 +1,8 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalComposer.dev.mjs') : import('./LexicalComposer.prod.mjs'));
8
+ export const LexicalComposer = mod.LexicalComposer;
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import * as modDev from './LexicalComposerContext.dev.esm.js';
8
- import * as modProd from './LexicalComposerContext.prod.esm.js';
7
+ import * as modDev from './LexicalComposerContext.dev.mjs';
8
+ import * as modProd from './LexicalComposerContext.prod.mjs';
9
9
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
10
  export const LexicalComposerContext = mod.LexicalComposerContext;
11
11
  export const createLexicalComposerContext = mod.createLexicalComposerContext;
@@ -0,0 +1,10 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalComposerContext.dev.mjs') : import('./LexicalComposerContext.prod.mjs'));
8
+ export const LexicalComposerContext = mod.LexicalComposerContext;
9
+ export const createLexicalComposerContext = mod.createLexicalComposerContext;
10
+ export const useLexicalComposerContext = mod.useLexicalComposerContext;
@@ -0,0 +1,10 @@
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
+ import * as modDev from './LexicalContentEditable.dev.mjs';
8
+ import * as modProd from './LexicalContentEditable.prod.mjs';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export const ContentEditable = mod.ContentEditable;
@@ -0,0 +1,8 @@
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
+ const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalContentEditable.dev.mjs') : import('./LexicalContentEditable.prod.mjs'));
8
+ export const ContentEditable = mod.ContentEditable;
@@ -21,11 +21,12 @@ export type LexicalContextMenuPluginProps<TOption extends MenuOption> = {
21
21
  onSelectOption: (option: TOption, textNodeContainingQuery: LexicalNode | null, closeMenu: () => void, matchingString: string) => void;
22
22
  options: Array<TOption>;
23
23
  onClose?: () => void;
24
+ onWillOpen?: (event: MouseEvent) => void;
24
25
  onOpen?: (resolution: MenuResolution) => void;
25
26
  menuRenderFn: ContextMenuRenderFn<TOption>;
26
27
  anchorClassName?: string;
27
28
  commandPriority?: CommandListenerPriority;
28
29
  parent?: HTMLElement;
29
30
  };
30
- export declare function LexicalContextMenuPlugin<TOption extends MenuOption>({ options, onClose, onOpen, onSelectOption, menuRenderFn: contextMenuRenderFn, anchorClassName, commandPriority, parent, }: LexicalContextMenuPluginProps<TOption>): JSX.Element | null;
31
+ export declare function LexicalContextMenuPlugin<TOption extends MenuOption>({ options, onWillOpen, onClose, onOpen, onSelectOption, menuRenderFn: contextMenuRenderFn, anchorClassName, commandPriority, parent, }: LexicalContextMenuPluginProps<TOption>): JSX.Element | null;
31
32
  export { MenuOption, MenuRenderFn, MenuResolution };