@mdxeditor/editor 3.29.1 → 3.29.3

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
@@ -2522,6 +2522,12 @@ export declare interface SandpackConfig {
2522
2522
  presets: SandpackPreset[];
2523
2523
  }
2524
2524
 
2525
+ export declare const SandpackEditor: ({ nodeKey, code, focusEmitter, preset }: SandpackEditorProps) => default_2.JSX.Element;
2526
+
2527
+ export declare interface SandpackEditorProps extends CodeBlockEditorProps {
2528
+ preset: SandpackPreset;
2529
+ }
2530
+
2525
2531
  /**
2526
2532
  * A plugin that adds support for sandpack code blocks in the editor.
2527
2533
  * @group Sandpack
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ import { maxLengthPlugin } from "./plugins/maxlength/index.js";
17
17
  import { insertJsx$, isMdastJsxNode, jsxPlugin } from "./plugins/jsx/index.js";
18
18
  import { GenericJsxEditor } from "./jsx-editors/GenericJsxEditor.js";
19
19
  import { insertSandpack$, sandpackConfig$, sandpackPlugin } from "./plugins/sandpack/index.js";
20
+ import { SandpackEditor } from "./plugins/sandpack/SandpackEditor.js";
20
21
  import { codeBlockLanguages$, codeMirrorAutoLoadLanguageSupport$, codeMirrorExtensions$, codeMirrorPlugin, insertCodeMirror$ } from "./plugins/codemirror/index.js";
21
22
  import { COMMON_STATE_CONFIG_EXTENSIONS, CodeMirrorEditor } from "./plugins/codemirror/CodeMirrorEditor.js";
22
23
  import { appendCodeBlockEditorDescriptor$, codeBlockPlugin, defaultCodeBlockLanguage$, insertCodeBlock$ } from "./plugins/codeblock/index.js";
@@ -138,6 +139,7 @@ export {
138
139
  PropertyPopover,
139
140
  RealmWithPlugins,
140
141
  Root,
142
+ SandpackEditor,
141
143
  Select,
142
144
  SelectButtonTrigger,
143
145
  SelectContent,
@@ -21,10 +21,12 @@ const ImageDialog = () => {
21
21
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
22
22
  values: state.type === "editing" ? state.initialValues : {}
23
23
  });
24
+ if (state.type === "inactive")
25
+ return null;
24
26
  return /* @__PURE__ */ React__default.createElement(
25
27
  Dialog.Root,
26
28
  {
27
- open: state.type !== "inactive",
29
+ open: true,
28
30
  onOpenChange: (open) => {
29
31
  if (!open) {
30
32
  closeImageDialog();
@@ -1,6 +1,6 @@
1
1
  import { createLinkMatcherWithRegExp, AutoLinkPlugin } from "@lexical/react/LexicalAutoLinkPlugin";
2
2
  import React__default from "react";
3
- const URL_REGEX = /(?:(?:https?|ftp):\/\/)?(?:[\w-]+(?::[\w-]+)?@)?(?:(?:[\w-]+(?:\.[\w-]+)*(?:\.[a-zA-Z]{2,}))|(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3}))(?::[0-9]{1,5})?(?:\/[^\s]*)?/;
3
+ const URL_REGEX = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
4
4
  const EMAIL_REGEX = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;
5
5
  const MATCHERS = [
6
6
  createLinkMatcherWithRegExp(URL_REGEX, (text) => {
@@ -102,18 +102,20 @@ const LinkDialog = () => {
102
102
  }, [activeEditor, publishWindowChange]);
103
103
  const [copyUrlTooltipOpen, setCopyUrlTooltipOpen] = React__default.useState(false);
104
104
  const t = useTranslation();
105
+ if (linkDialogState.type === "inactive")
106
+ return null;
105
107
  const theRect = linkDialogState.rectangle;
106
108
  const urlIsExternal = linkDialogState.type === "preview" && linkDialogState.url.startsWith("http");
107
- return /* @__PURE__ */ React__default.createElement(RadixPopover.Root, { open: linkDialogState.type !== "inactive" }, /* @__PURE__ */ React__default.createElement(
109
+ return /* @__PURE__ */ React__default.createElement(RadixPopover.Root, { open: true }, /* @__PURE__ */ React__default.createElement(
108
110
  RadixPopover.Anchor,
109
111
  {
110
112
  "data-visible": linkDialogState.type === "edit",
111
113
  className: styles.linkDialogAnchor,
112
114
  style: {
113
- top: `${(theRect == null ? void 0 : theRect.top) ?? 0}px`,
114
- left: `${(theRect == null ? void 0 : theRect.left) ?? 0}px`,
115
- width: `${(theRect == null ? void 0 : theRect.width) ?? 0}px`,
116
- height: `${(theRect == null ? void 0 : theRect.height) ?? 0}px`
115
+ top: `${theRect.top}px`,
116
+ left: `${theRect.left}px`,
117
+ width: `${theRect.width}px`,
118
+ height: `${theRect.height}px`
117
119
  }
118
120
  }
119
121
  ), /* @__PURE__ */ React__default.createElement(RadixPopover.Portal, { container: editorRootElementRef == null ? void 0 : editorRootElementRef.current }, /* @__PURE__ */ React__default.createElement(
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "3.29.1",
14
+ "version": "3.29.3",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",