@lexical/react 0.7.7 → 0.7.9

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 (41) hide show
  1. package/DEPRECATED_useLexical.dev.js +3 -4
  2. package/DEPRECATED_useLexicalCanShowPlaceholder.dev.js +1 -3
  3. package/DEPRECATED_useLexicalCharacterLimit.dev.js +7 -39
  4. package/DEPRECATED_useLexicalEditor.dev.js +1 -3
  5. package/DEPRECATED_useLexicalPlainText.dev.js +4 -1
  6. package/DEPRECATED_useLexicalRichText.dev.js +4 -1
  7. package/LexicalAutoEmbedPlugin.dev.js +0 -11
  8. package/LexicalAutoFocusPlugin.dev.js +0 -1
  9. package/LexicalAutoLinkPlugin.dev.js +7 -50
  10. package/LexicalBlockWithAlignableContents.dev.js +0 -11
  11. package/LexicalCharacterLimitPlugin.dev.js +7 -46
  12. package/LexicalCheckListPlugin.dev.js +10 -48
  13. package/LexicalClearEditorPlugin.dev.js +1 -1
  14. package/LexicalCollaborationContext.dev.js +0 -3
  15. package/LexicalCollaborationPlugin.dev.js +6 -34
  16. package/LexicalComposer.dev.js +6 -10
  17. package/LexicalComposerContext.dev.js +0 -6
  18. package/LexicalContentEditable.dev.js +3 -1
  19. package/LexicalDecoratorBlockNode.dev.js +0 -5
  20. package/LexicalHashtagPlugin.dev.js +73 -43
  21. package/LexicalHorizontalRuleNode.dev.js +0 -22
  22. package/LexicalHorizontalRulePlugin.dev.js +0 -4
  23. package/LexicalLinkPlugin.dev.js +4 -10
  24. package/LexicalListPlugin.dev.js +0 -2
  25. package/LexicalMarkdownShortcutPlugin.dev.js +2 -2
  26. package/LexicalNestedComposer.dev.js +6 -11
  27. package/LexicalNodeEventPlugin.dev.js +5 -3
  28. package/LexicalOnChangePlugin.dev.js +1 -1
  29. package/LexicalPlainTextPlugin.dev.js +8 -12
  30. package/LexicalRichTextPlugin.dev.js +8 -12
  31. package/LexicalTabIndentationPlugin.dev.js +1 -3
  32. package/LexicalTableOfContents__EXPERIMENTAL.dev.js +5 -33
  33. package/LexicalTablePlugin.dev.js +5 -19
  34. package/LexicalTreeView.dev.js +12 -61
  35. package/LexicalTypeaheadMenuPlugin.dev.js +23 -108
  36. package/LexicalTypeaheadMenuPlugin.prod.js +18 -18
  37. package/package.json +19 -19
  38. package/useLexicalEditable.dev.js +1 -5
  39. package/useLexicalIsTextContentEmpty.dev.js +1 -0
  40. package/useLexicalNodeSelection.dev.js +0 -7
  41. package/useLexicalSubscription.dev.js +1 -3
@@ -16,6 +16,7 @@ var react = require('react');
16
16
  * LICENSE file in the root directory of this source tree.
17
17
  *
18
18
  */
19
+
19
20
  const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
20
21
 
21
22
  /**
@@ -17,19 +17,15 @@ var react = require('react');
17
17
  * LICENSE file in the root directory of this source tree.
18
18
  *
19
19
  */
20
-
21
20
  function isNodeSelected(editor, key) {
22
21
  return editor.getEditorState().read(() => {
23
22
  const node = lexical.$getNodeByKey(key);
24
-
25
23
  if (node === null) {
26
24
  return false;
27
25
  }
28
-
29
26
  return node.isSelected();
30
27
  });
31
28
  }
32
-
33
29
  function useLexicalNodeSelection(key) {
34
30
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
35
31
  const [isSelected, setIsSelected] = react.useState(() => isNodeSelected(editor, key));
@@ -48,12 +44,10 @@ function useLexicalNodeSelection(key) {
48
44
  const setSelected = react.useCallback(selected => {
49
45
  editor.update(() => {
50
46
  let selection = lexical.$getSelection();
51
-
52
47
  if (!lexical.$isNodeSelection(selection)) {
53
48
  selection = lexical.$createNodeSelection();
54
49
  lexical.$setSelection(selection);
55
50
  }
56
-
57
51
  if (selected) {
58
52
  selection.add(key);
59
53
  } else {
@@ -64,7 +58,6 @@ function useLexicalNodeSelection(key) {
64
58
  const clearSelected = react.useCallback(() => {
65
59
  editor.update(() => {
66
60
  const selection = lexical.$getSelection();
67
-
68
61
  if (lexical.$isNodeSelection(selection)) {
69
62
  selection.clear();
70
63
  }
@@ -16,6 +16,7 @@ var react = require('react');
16
16
  * LICENSE file in the root directory of this source tree.
17
17
  *
18
18
  */
19
+
19
20
  const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
20
21
 
21
22
  /**
@@ -35,7 +36,6 @@ var useLayoutEffect = useLayoutEffectImpl;
35
36
  * LICENSE file in the root directory of this source tree.
36
37
  *
37
38
  */
38
-
39
39
  /**
40
40
  * Shortcut to Lexical subscriptions when values are used for render.
41
41
  */
@@ -50,12 +50,10 @@ function useLexicalSubscription(subscription) {
50
50
  subscribe
51
51
  } = initializedSubscription;
52
52
  const currentValue = initialValueFn();
53
-
54
53
  if (valueRef.current !== currentValue) {
55
54
  valueRef.current = currentValue;
56
55
  setValue(currentValue);
57
56
  }
58
-
59
57
  return subscribe(newValue => {
60
58
  valueRef.current = newValue;
61
59
  setValue(newValue);