@mdxeditor/editor 2.7.0 → 2.8.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.
@@ -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
@@ -1721,12 +1721,15 @@ export declare const linkPlugin: (params?: {
1721
1721
  export declare const listsPlugin: (params?: unknown) => RealmPlugin;
1722
1722
 
1723
1723
  /**
1724
- * A toolbar toggle that allows the user to toggle between bulleted and numbered lists.
1724
+ * A toolbar toggle that allows the user to toggle between bulleted, numbered, and check lists.
1725
1725
  * Pressing the selected button will convert the current list to the other type. Pressing it again will remove the list.
1726
1726
  * For this button to work, you need to have the `listsPlugin` plugin enabled.
1727
1727
  * @group Toolbar Components
1728
+ * @param options - The list types that the user can toggle between. Defaults to `['bullet', 'number', 'check']`.
1728
1729
  */
1729
- export declare const ListsToggle: React_2.FC;
1730
+ export declare const ListsToggle: React_2.FC<{
1731
+ options?: Array<'bullet' | 'number' | 'check'>;
1732
+ }>;
1730
1733
 
1731
1734
  /* Excluded from this release type: makeHslTransparent */
1732
1735
 
@@ -3,21 +3,25 @@ import { currentListType$, applyListType$ } from "../../lists/index.js";
3
3
  import { SingleChoiceToggleGroup } from "../primitives/toolbar.js";
4
4
  import { useCellValues, usePublisher } from "@mdxeditor/gurx";
5
5
  import { iconComponentFor$ } from "../../core/index.js";
6
- const ListsToggle = () => {
6
+ const LIST_TITLE_MAP = {
7
+ bullet: "Bulleted list",
8
+ number: "Numbered list",
9
+ check: "Check list"
10
+ };
11
+ const ICON_NAME_MAP = {
12
+ bullet: "format_list_bulleted",
13
+ number: "format_list_numbered",
14
+ check: "format_list_checked"
15
+ };
16
+ const ListsToggle = ({ options = ["bullet", "number", "check"] }) => {
7
17
  const [currentListType, iconComponentFor] = useCellValues(currentListType$, iconComponentFor$);
8
18
  const applyListType = usePublisher(applyListType$);
9
- return /* @__PURE__ */ React__default.createElement(
10
- SingleChoiceToggleGroup,
11
- {
12
- value: currentListType || "",
13
- items: [
14
- { title: "Bulleted list", contents: iconComponentFor("format_list_bulleted"), value: "bullet" },
15
- { title: "Numbered list", contents: iconComponentFor("format_list_numbered"), value: "number" },
16
- { title: "Check list", contents: iconComponentFor("format_list_checked"), value: "check" }
17
- ],
18
- onChange: applyListType
19
- }
20
- );
19
+ const items = options.map((type) => ({
20
+ value: type,
21
+ title: LIST_TITLE_MAP[type],
22
+ contents: iconComponentFor(ICON_NAME_MAP[type])
23
+ }));
24
+ return /* @__PURE__ */ React__default.createElement(SingleChoiceToggleGroup, { value: currentListType || "", items, onChange: applyListType });
21
25
  };
22
26
  export {
23
27
  ListsToggle
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "2.7.0",
14
+ "version": "2.8.0",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",