@mdxeditor/editor 3.3.4 → 3.3.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.
package/dist/index.d.ts CHANGED
@@ -2647,8 +2647,8 @@ export declare class UnrecognizedMarkdownConstructError extends Error {
2647
2647
  * @group Link Dialog
2648
2648
  */
2649
2649
  export declare const updateLink$: NodeRef<{
2650
- url: string;
2651
- title: string;
2650
+ url: string | undefined;
2651
+ title: string | undefined;
2652
2652
  }>;
2653
2653
 
2654
2654
  /**
@@ -80,18 +80,23 @@ const linkDialogState$ = Cell({ type: "inactive" }, (r) => {
80
80
  linkDialogState$
81
81
  );
82
82
  r.sub(r.pipe(updateLink$, withLatestFrom(activeEditor$, linkDialogState$, currentSelection$)), ([payload, editor, state, selection]) => {
83
- const url = payload.url.trim();
84
- const title = payload.title.trim();
83
+ var _a, _b;
84
+ const url = ((_a = payload.url) == null ? void 0 : _a.trim()) ?? "";
85
+ const title = ((_b = payload.title) == null ? void 0 : _b.trim()) ?? "";
85
86
  if (url !== "") {
86
87
  if (selection == null ? void 0 : selection.isCollapsed()) {
87
88
  const linkContent = title || url;
88
89
  editor == null ? void 0 : editor.update(
89
90
  () => {
90
- if (!getLinkNodeInSelection(selection)) {
91
+ const linkNode = getLinkNodeInSelection(selection);
92
+ if (!linkNode) {
91
93
  const node = $createLinkNode(url, { title });
92
94
  node.append($createTextNode(linkContent));
93
95
  $insertNodes([node]);
94
96
  node.select();
97
+ } else {
98
+ linkNode.setURL(url);
99
+ linkNode.setTitle(title);
95
100
  }
96
101
  },
97
102
  { discrete: true }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "3.3.4",
14
+ "version": "3.3.6",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",