@mdxeditor/editor 1.13.5 → 1.14.1

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.
@@ -57,6 +57,7 @@ function ImageEditor({ src, title, alt, nodeKey, width, height }) {
57
57
  const [disableImageResize] = imagePluginHooks.useEmitterValues("disableImageResize");
58
58
  const [imagePreviewHandler] = imagePluginHooks.useEmitterValues("imagePreviewHandler");
59
59
  const [imageSource, setImageSource] = React__default.useState(null);
60
+ const [initialImagePath, setInitialImagePath] = React__default.useState(null);
60
61
  const openEditImageDialog = imagePluginHooks.usePublisher("openEditImageDialog");
61
62
  const [iconComponentFor] = corePluginHooks.useEmitterValues("iconComponentFor");
62
63
  const onDelete = React__default.useCallback(
@@ -108,6 +109,8 @@ function ImageEditor({ src, title, alt, nodeKey, width, height }) {
108
109
  React__default.useEffect(() => {
109
110
  if (imagePreviewHandler) {
110
111
  const callPreviewHandler = async () => {
112
+ if (!initialImagePath)
113
+ setInitialImagePath(src);
111
114
  const updatedSrc = await imagePreviewHandler(src);
112
115
  setImageSource(updatedSrc);
113
116
  };
@@ -212,7 +215,7 @@ function ImageEditor({ src, title, alt, nodeKey, width, height }) {
212
215
  openEditImageDialog({
213
216
  nodeKey,
214
217
  initialValues: {
215
- src: imageSource,
218
+ src: !initialImagePath ? imageSource : initialImagePath,
216
219
  title: title || "",
217
220
  altText: alt || ""
218
221
  }
@@ -20,6 +20,7 @@ type InactiveLinkDialog = {
20
20
  };
21
21
  type PreviewLinkDialog = {
22
22
  type: 'preview';
23
+ title: string;
23
24
  url: string;
24
25
  linkNodeKey: string;
25
26
  rectangle: RectData;
@@ -117,6 +117,7 @@ const linkDialogSystem = system(
117
117
  type: "edit",
118
118
  initialUrl: state.url,
119
119
  url: state.url,
120
+ title: state.title,
120
121
  linkNodeKey: state.linkNodeKey,
121
122
  rectangle: state.rectangle
122
123
  };
@@ -151,6 +152,7 @@ const linkDialogSystem = system(
151
152
  type: "preview",
152
153
  linkNodeKey: state.linkNodeKey,
153
154
  rectangle: state.rectangle,
155
+ title,
154
156
  url
155
157
  });
156
158
  } else {
@@ -201,6 +203,7 @@ const linkDialogSystem = system(
201
203
  type: "preview",
202
204
  url: node.getURL(),
203
205
  linkNodeKey: node.getKey(),
206
+ title: node.getTitle(),
204
207
  rectangle: getSelectionRectangle(activeEditor2)
205
208
  };
206
209
  } else {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "private": false,
10
10
  "sideEffects": false,
11
11
  "type": "module",
12
- "version": "1.13.5",
12
+ "version": "1.14.1",
13
13
  "description": "React component for rich text markdown editing",
14
14
  "scripts": {
15
15
  "build": "vite build",