@mdxeditor/editor 3.11.5 → 3.13.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
@@ -127,7 +127,8 @@ const MDXEditor = React__default.forwardRef((props, ref) => {
127
127
  iconComponentFor: props.iconComponentFor ?? defaultIconComponentFor,
128
128
  suppressHtmlProcessing: props.suppressHtmlProcessing ?? false,
129
129
  onError: props.onError ?? noop,
130
- translation: props.translation ?? defaultTranslation
130
+ translation: props.translation ?? defaultTranslation,
131
+ trim: props.trim ?? true
131
132
  }),
132
133
  ...props.plugins ?? []
133
134
  ]
package/dist/index.d.ts CHANGED
@@ -2080,6 +2080,10 @@ export declare interface MDXEditorProps {
2080
2080
  * Pass your own translation function if you want to localize the editor.
2081
2081
  */
2082
2082
  translation?: Translation;
2083
+ /**
2084
+ * Whether to apply trim() to the initial markdown input (default: true)
2085
+ */
2086
+ trim?: boolean;
2083
2087
  }
2084
2088
 
2085
2089
  /**
@@ -472,11 +472,12 @@ const translation$ = Cell(() => {
472
472
  });
473
473
  const corePlugin = realmPlugin({
474
474
  init(r, params) {
475
+ const initialMarkdown = (params == null ? void 0 : params.initialMarkdown) ?? "";
475
476
  r.register(createRootEditorSubscription$);
476
477
  r.register(createActiveEditorSubscription$);
477
478
  r.register(markdownSignal$);
478
479
  r.pubIn({
479
- [initialMarkdown$]: params == null ? void 0 : params.initialMarkdown.trim(),
480
+ [initialMarkdown$]: (params == null ? void 0 : params.trim) ? initialMarkdown.trim() : initialMarkdown,
480
481
  [iconComponentFor$]: params == null ? void 0 : params.iconComponentFor,
481
482
  [addImportVisitor$]: [MdastRootVisitor, MdastParagraphVisitor, MdastTextVisitor, MdastBreakVisitor, ...formattingVisitors],
482
483
  [addLexicalNode$]: [ParagraphNode, TextNode, GenericHTMLNode],
@@ -40,6 +40,7 @@ const ImageDialog = () => {
40
40
  e.preventDefault();
41
41
  }
42
42
  },
43
+ /* @__PURE__ */ React__default.createElement(Dialog.Title, null, t("uploadImage.dialogTitle", "Upload an image")),
43
44
  /* @__PURE__ */ React__default.createElement(
44
45
  "form",
45
46
  {
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "3.11.5",
14
+ "version": "3.13.0",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",