@mdxeditor/editor 2.6.0 → 2.7.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.
@@ -231,7 +231,7 @@ function exportMarkdownFromLexical({
231
231
  return toMarkdown(exportLexicalTreeToMdast({ root, visitors, jsxComponentDescriptors, jsxIsAvailable }), {
232
232
  extensions: toMarkdownExtensions,
233
233
  ...toMarkdownOptions
234
- });
234
+ }) + "\n";
235
235
  }
236
236
  export {
237
237
  exportLexicalTreeToMdast,
package/dist/index.d.ts CHANGED
@@ -836,6 +836,7 @@ export declare const diffSourcePlugin: (params?: {
836
836
  */
837
837
  export declare const DiffSourceToggleWrapper: React_2.FC<{
838
838
  children: React_2.ReactNode;
839
+ options?: ViewMode[];
839
840
  }>;
840
841
 
841
842
  /**
@@ -3,19 +3,28 @@ import { useCellValues, usePublisher } from "@mdxeditor/gurx";
3
3
  import React__default from "react";
4
4
  import styles from "../../../styles/ui.module.css.js";
5
5
  import { SingleChoiceToggleGroup } from "../primitives/toolbar.js";
6
- const DiffSourceToggleWrapper = ({ children }) => {
6
+ const DiffSourceToggleWrapper = ({
7
+ children,
8
+ options = ["rich-text", "diff", "source"]
9
+ }) => {
7
10
  const [viewMode, iconComponentFor] = useCellValues(viewMode$, iconComponentFor$);
8
11
  const changeViewMode = usePublisher(viewMode$);
12
+ const toggleGroupItems = [];
13
+ if (options.includes("rich-text")) {
14
+ toggleGroupItems.push({ title: "Rich text", contents: iconComponentFor("rich_text"), value: "rich-text" });
15
+ }
16
+ if (options.includes("diff")) {
17
+ toggleGroupItems.push({ title: "Diff mode", contents: iconComponentFor("difference"), value: "diff" });
18
+ }
19
+ if (options.includes("source")) {
20
+ toggleGroupItems.push({ title: "Source", contents: iconComponentFor("markdown"), value: "source" });
21
+ }
9
22
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, viewMode === "rich-text" ? children : viewMode === "diff" ? /* @__PURE__ */ React__default.createElement("span", { className: styles.toolbarTitleMode }, "Diff mode") : /* @__PURE__ */ React__default.createElement("span", { className: styles.toolbarTitleMode }, "Source mode"), /* @__PURE__ */ React__default.createElement("div", { style: { marginLeft: "auto", pointerEvents: "auto", opacity: 1 } }, /* @__PURE__ */ React__default.createElement(
10
23
  SingleChoiceToggleGroup,
11
24
  {
12
25
  className: styles.diffSourceToggle,
13
26
  value: viewMode,
14
- items: [
15
- { title: "Rich text", contents: iconComponentFor("rich_text"), value: "rich-text" },
16
- { title: "Diff mode", contents: iconComponentFor("difference"), value: "diff" },
17
- { title: "Source", contents: iconComponentFor("markdown"), value: "source" }
18
- ],
27
+ items: toggleGroupItems,
19
28
  onChange: (value) => changeViewMode(value || "rich-text")
20
29
  }
21
30
  )));
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "2.6.0",
14
+ "version": "2.7.1",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",