@mdxeditor/editor 2.6.0 → 2.7.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/index.d.ts
CHANGED
|
@@ -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 = ({
|
|
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
|
)));
|