@mdxeditor/editor 3.23.0 → 3.23.2

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.
@@ -1,11 +1,11 @@
1
1
  import { $createLinkNode, TOGGLE_LINK_COMMAND, $isLinkNode } from "@lexical/link";
2
+ import { Signal, Cell, withLatestFrom, map, Action, filter } from "@mdxeditor/gurx";
2
3
  import { KEY_ESCAPE_COMMAND, COMMAND_PRIORITY_LOW, KEY_MODIFIER_COMMAND, $getSelection, $isRangeSelection, COMMAND_PRIORITY_HIGH, $createTextNode, $insertNodes } from "lexical";
4
+ import { realmPlugin } from "../../RealmWithPlugins.js";
3
5
  import { IS_APPLE } from "../../utils/detectMac.js";
4
6
  import { getSelectionRectangle, getSelectedNode } from "../../utils/lexicalHelpers.js";
5
- import { createActiveEditorSubscription$, readOnly$, activeEditor$, currentSelection$, addComposerChild$ } from "../core/index.js";
7
+ import { createActiveEditorSubscription$, viewMode$, readOnly$, activeEditor$, currentSelection$, addComposerChild$ } from "../core/index.js";
6
8
  import { LinkDialog } from "./LinkDialog.js";
7
- import { Signal, Cell, withLatestFrom, map, Action, filter } from "@mdxeditor/gurx";
8
- import { realmPlugin } from "../../RealmWithPlugins.js";
9
9
  function getLinkNodeInSelection(selection) {
10
10
  if (!selection) {
11
11
  return null;
@@ -38,6 +38,11 @@ const linkDialogState$ = Cell({ type: "inactive" }, (r) => {
38
38
  COMMAND_PRIORITY_LOW
39
39
  );
40
40
  });
41
+ r.sub(r.pipe(viewMode$), (viewMode) => {
42
+ if (viewMode !== "rich-text") {
43
+ r.pub(linkDialogState$, { type: "inactive" });
44
+ }
45
+ });
41
46
  r.pub(createActiveEditorSubscription$, (editor) => {
42
47
  return editor.registerCommand(
43
48
  KEY_MODIFIER_COMMAND,
@@ -1,5 +1,5 @@
1
1
  import { $isListItemNode, $isListNode } from "@lexical/list";
2
- import { $isTextNode, $isElementNode, $isDecoratorNode } from "lexical";
2
+ import { $isTextNode, $isLineBreakNode, $isElementNode, $isDecoratorNode } from "lexical";
3
3
  const LexicalListItemVisitor = {
4
4
  testLexicalNode: $isListItemNode,
5
5
  visitLexicalNode: ({ lexicalNode, mdastParent, actions }) => {
@@ -22,7 +22,7 @@ const LexicalListItemVisitor = {
22
22
  });
23
23
  let surroundingParagraph = null;
24
24
  for (const child of lexicalNode.getChildren()) {
25
- if ($isTextNode(child) || $isElementNode(child) && child.isInline() || $isDecoratorNode(child) && child.isInline()) {
25
+ if ($isTextNode(child) || $isLineBreakNode(child) || child.isInline() && ($isElementNode(child) || $isDecoratorNode(child))) {
26
26
  if (!surroundingParagraph) {
27
27
  surroundingParagraph = actions.appendToParent(listItem, {
28
28
  type: "paragraph",
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "3.23.0",
14
+ "version": "3.23.2",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",