@mdxeditor/editor 3.0.5 → 3.0.6

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,4 +1,4 @@
1
- import { TOGGLE_LINK_COMMAND, $isLinkNode } from "@lexical/link";
1
+ import { $createLinkNode, TOGGLE_LINK_COMMAND, $isLinkNode } from "@lexical/link";
2
2
  import { KEY_ESCAPE_COMMAND, COMMAND_PRIORITY_LOW, KEY_MODIFIER_COMMAND, $getSelection, $isRangeSelection, COMMAND_PRIORITY_HIGH, $createTextNode, $insertNodes } from "lexical";
3
3
  import { IS_APPLE } from "../../utils/detectMac.js";
4
4
  import { getSelectionRectangle, getSelectedNode } from "../../utils/lexicalHelpers.js";
@@ -89,15 +89,17 @@ const linkDialogState$ = Cell({ type: "inactive" }, (r) => {
89
89
  editor == null ? void 0 : editor.update(
90
90
  () => {
91
91
  if (!getLinkNodeInSelection(selection)) {
92
- const node = $createTextNode(linkContent);
92
+ const node = $createLinkNode(url, { title });
93
+ node.append($createTextNode(linkContent));
93
94
  $insertNodes([node]);
94
95
  node.select();
95
96
  }
96
97
  },
97
98
  { discrete: true }
98
99
  );
100
+ } else {
101
+ editor == null ? void 0 : editor.dispatchCommand(TOGGLE_LINK_COMMAND, { url, title });
99
102
  }
100
- editor == null ? void 0 : editor.dispatchCommand(TOGGLE_LINK_COMMAND, { url, title });
101
103
  r.pub(linkDialogState$, {
102
104
  type: "preview",
103
105
  linkNodeKey: state.linkNodeKey,
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "3.0.5",
14
+ "version": "3.0.6",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",
@@ -20,7 +20,7 @@
20
20
  "dev": "LADLE=true ladle dev",
21
21
  "typecheck": "tsc --noEmit",
22
22
  "lint": "eslint src --ext .ts,.tsx",
23
- "test": "vitest",
23
+ "test": "NODE_ENV=development vitest",
24
24
  "semantic-release": "semantic-release",
25
25
  "image-upload-backend": "node ./src/examples/file-backend.js"
26
26
  },
@@ -42,15 +42,15 @@
42
42
  "@codemirror/state": "^6.4.0",
43
43
  "@codemirror/view": "^6.23.0",
44
44
  "@codesandbox/sandpack-react": "^2.10.0",
45
- "@lexical/clipboard": "^0.14.3",
46
- "@lexical/link": "^0.14.3",
47
- "@lexical/list": "^0.14.3",
48
- "@lexical/markdown": "^0.14.3",
49
- "@lexical/plain-text": "^0.14.3",
50
- "@lexical/react": "^0.14.3",
51
- "@lexical/rich-text": "^0.14.3",
52
- "@lexical/selection": "^0.14.3",
53
- "@lexical/utils": "^0.14.3",
45
+ "@lexical/clipboard": "^0.14.5",
46
+ "@lexical/link": "^0.14.5",
47
+ "@lexical/list": "^0.14.5",
48
+ "@lexical/markdown": "^0.14.5",
49
+ "@lexical/plain-text": "^0.14.5",
50
+ "@lexical/react": "^0.14.5",
51
+ "@lexical/rich-text": "^0.14.5",
52
+ "@lexical/selection": "^0.14.5",
53
+ "@lexical/utils": "^0.14.5",
54
54
  "@mdxeditor/gurx": "^1.1.1",
55
55
  "@radix-ui/colors": "^3.0.0",
56
56
  "@radix-ui/react-dialog": "^1.0.5",
@@ -65,7 +65,7 @@
65
65
  "codemirror": "^6.0.1",
66
66
  "downshift": "^7.6.0",
67
67
  "js-yaml": "4.1.0",
68
- "lexical": "^0.14.3",
68
+ "lexical": "^0.14.5",
69
69
  "mdast-util-directive": "^3.0.0",
70
70
  "mdast-util-from-markdown": "^2.0.0",
71
71
  "mdast-util-frontmatter": "^2.0.1",