@mdxeditor/editor 1.13.4 → 1.14.0

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/MDXEditor.js CHANGED
@@ -53,8 +53,11 @@ const DEFAULT_MARKDOWN_OPTIONS = {
53
53
  listItemIndent: "one"
54
54
  };
55
55
  const DefaultIcon = React__default.lazy(() => import("./plugins/core/Icon.js"));
56
+ const IconFallback = () => {
57
+ return /* @__PURE__ */ React__default.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" });
58
+ };
56
59
  const defaultIconComponentFor = (name) => {
57
- return /* @__PURE__ */ React__default.createElement(DefaultIcon, { name });
60
+ return /* @__PURE__ */ React__default.createElement(React__default.Suspense, { fallback: /* @__PURE__ */ React__default.createElement(IconFallback, null) }, /* @__PURE__ */ React__default.createElement(DefaultIcon, { name }));
58
61
  };
59
62
  const RenderRecurisveWrappers = ({
60
63
  wrappers,
@@ -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
  }
@@ -25,12 +25,11 @@ const TableEditor = ({ mdastNode, parentEditor, lexicalTable }) => {
25
25
  const [activeCell, setActiveCell] = React__default.useState(null);
26
26
  const [iconComponentFor, readOnly] = corePluginHooks.useEmitterValues("iconComponentFor", "readOnly");
27
27
  const getCellKey = React__default.useMemo(() => {
28
- const cellKeyMap = /* @__PURE__ */ new WeakMap();
29
28
  return (cell) => {
30
- if (!cellKeyMap.has(cell)) {
31
- cellKeyMap.set(cell, uuidv4());
29
+ if (!cell.__cacheKey) {
30
+ cell.__cacheKey = uuidv4();
32
31
  }
33
- return cellKeyMap.get(cell);
32
+ return cell.__cacheKey;
34
33
  };
35
34
  }, []);
36
35
  const setActiveCellWithBoundaries = React__default.useCallback(
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "private": false,
10
10
  "sideEffects": false,
11
11
  "type": "module",
12
- "version": "1.13.4",
12
+ "version": "1.14.0",
13
13
  "description": "React component for rich text markdown editing",
14
14
  "scripts": {
15
15
  "build": "vite build",
@@ -94,7 +94,7 @@
94
94
  "@babel/plugin-transform-typescript": "^7.22.3",
95
95
  "@babel/preset-react": "^7.22.3",
96
96
  "@babel/preset-typescript": "^7.21.5",
97
- "@ladle/react": "^2.13.0",
97
+ "@ladle/react": "^4.0.2",
98
98
  "@microsoft/api-documenter": "^7.22.21",
99
99
  "@microsoft/api-extractor": "^7.36.0",
100
100
  "@ngneat/falso": "^6.4.0",