@mdxeditor/editor 4.0.2 → 4.0.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +51 -24
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { Config } from 'mdast-util-from-markdown/lib';
2
1
  import { ContentEditable } from '@lexical/react/LexicalContentEditable';
3
2
  import { DecoratorNode } from 'lexical';
4
3
  import { default as default_2 } from 'react';
@@ -10,9 +9,11 @@ import { EditorConfig } from 'lexical';
10
9
  import { EditorState } from 'lexical';
11
10
  import { EditorThemeClasses } from 'lexical';
12
11
  import { ElementNode } from 'lexical';
13
- import { Extension } from 'micromark-util-types';
14
- import { Extension as Extension_2 } from '@codemirror/state';
12
+ import { Extension } from 'mdast-util-from-markdown';
13
+ import { Extension as Extension_2 } from 'micromark-util-types';
14
+ import { Extension as Extension_3 } from '@codemirror/state';
15
15
  import { FC } from 'react';
16
+ import { Options as FromMarkdownOptions } from 'mdast-util-from-markdown';
16
17
  import { HeadingTagType } from '@lexical/rich-text';
17
18
  import { HistoryState } from '@lexical/history';
18
19
  import { JSX } from 'react';
@@ -34,9 +35,8 @@ import { MdxJsxTextElement } from 'mdast-util-mdx-jsx';
34
35
  import { Node as Node_2 } from 'unist';
35
36
  import { NodeKey } from 'lexical';
36
37
  import { NodeRef } from '@mdxeditor/gurx';
37
- import { Options } from 'mdast-util-from-markdown';
38
- import { Options as Options_2 } from 'mdast-util-to-markdown/lib/types';
39
- import { Options as Options_3 } from 'mdast-util-gfm-table';
38
+ import { Options } from 'mdast-util-to-markdown';
39
+ import { Options as Options_2 } from 'mdast-util-gfm-table';
40
40
  import { ParseOptions } from 'micromark-util-types';
41
41
  import { PropsWithChildren } from 'react';
42
42
  import * as RadixToolbar from '@radix-ui/react-toolbar';
@@ -49,7 +49,6 @@ import { SerializedLexicalNode } from 'lexical';
49
49
  import { Spread } from 'lexical';
50
50
  import { TextFormatType } from 'lexical';
51
51
  import { TextNode } from 'lexical';
52
- import { Options as ToMarkdownOptions } from 'mdast-util-to-markdown';
53
52
 
54
53
  /**
55
54
  * Converts a <pre> HTML element into a CodeBlockNode.
@@ -214,7 +213,7 @@ export declare const addLexicalNode$: NodeRef<KlassConstructor<typeof LexicalNod
214
213
  * Adds a mdast extension to the markdown parser.
215
214
  * @group Markdown Processing
216
215
  */
217
- export declare const addMdastExtension$: NodeRef<Partial< Config> | Partial< Config>[] | (Partial< Config> | Partial< Config>[])[]>;
216
+ export declare const addMdastExtension$: NodeRef<MdastExtension | MdastExtension[]>;
218
217
 
219
218
  /**
220
219
  * Lets you add React components as children of any registered nested editor (useful for Lexical plugins).
@@ -226,7 +225,7 @@ export declare const addNestedEditorChild$: NodeRef<default_2.ComponentType<{}>
226
225
  * Adds a syntax extension to the markdown parser.
227
226
  * @group Markdown Processing
228
227
  */
229
- export declare const addSyntaxExtension$: NodeRef< Extension | Extension[]>;
228
+ export declare const addSyntaxExtension$: NodeRef< Extension_2 | Extension_2[]>;
230
229
 
231
230
  /**
232
231
  * Lets you add React components as children of table cell editors.
@@ -238,7 +237,7 @@ export declare const addTableCellEditorChild$: NodeRef<default_2.ComponentType<{
238
237
  * Adds a markdown to string extension to be used when exporting markdown from the Lexical tree.
239
238
  * @group Markdown Processing
240
239
  */
241
- export declare const addToMarkdownExtension$: NodeRef< Options_2 | Options_2[]>;
240
+ export declare const addToMarkdownExtension$: NodeRef<ToMarkdownExtension | ToMarkdownExtension[]>;
242
241
 
243
242
  /**
244
243
  * Lets you add React components on top of the editor (like the toolbar).
@@ -554,7 +553,7 @@ export declare const codeBlockLanguages$: NodeRef<NormalizedCodeBlockLanguages>;
554
553
  * @group CodeMirror
555
554
  */
556
555
  export declare interface CodeBlockLanguageSupport {
557
- extension: Extension_2;
556
+ extension: Extension_3;
558
557
  }
559
558
 
560
559
  /**
@@ -618,7 +617,7 @@ export declare const CodeMirrorEditor: ({ language, nodeKey, code, focusEmitter
618
617
  * The code mirror extensions for the coemirror code block editor.
619
618
  * @group CodeMirror
620
619
  */
621
- export declare const codeMirrorExtensions$: NodeRef<Extension_2[]>;
620
+ export declare const codeMirrorExtensions$: NodeRef<Extension_3[]>;
622
621
 
623
622
  /**
624
623
  * A plugin that adds lets users edit code blocks with CodeMirror.
@@ -635,7 +634,7 @@ export declare const codeMirrorPlugin: (params?: {
635
634
  /**
636
635
  * Optional, additional CodeMirror extensions to load in the diff/source mode.
637
636
  */
638
- codeMirrorExtensions?: Extension_2[];
637
+ codeMirrorExtensions?: Extension_3[];
639
638
  /**
640
639
  * Whether or not to try to dynamically load the code block language support.
641
640
  * Disable if you want to manually pass the supported languages.
@@ -651,7 +650,7 @@ export declare const codeMirrorPlugin: (params?: {
651
650
  */
652
651
  export declare const CodeToggle: default_2.FC;
653
652
 
654
- export declare const COMMON_STATE_CONFIG_EXTENSIONS: Extension_2[];
653
+ export declare const COMMON_STATE_CONFIG_EXTENSIONS: Extension_3[];
655
654
 
656
655
  /**
657
656
  * Performs left to right composition of two functions.
@@ -967,7 +966,7 @@ export declare const diffSourcePlugin: (params?: {
967
966
  /**
968
967
  * Optional, additional CodeMirror extensions to load in the diff/source mode.
969
968
  */
970
- codeMirrorExtensions?: Extension_2[];
969
+ codeMirrorExtensions?: Extension_3[];
971
970
  /**
972
971
  * Set the diff editor to read-only.
973
972
  * @default false
@@ -1221,13 +1220,29 @@ export declare const editorWrapperElementRef$: NodeRef<default_2.RefObject<HTMLD
1221
1220
 
1222
1221
  export declare const EmptyTextNodeIndex: TextNodeIndex;
1223
1222
 
1224
- /* Excluded from this release type: ExportLexicalTreeOptions */
1223
+ export declare interface ExportLexicalTreeOptions {
1224
+ root: RootNode;
1225
+ visitors: LexicalVisitor[];
1226
+ jsxComponentDescriptors: JsxComponentDescriptor[];
1227
+ jsxIsAvailable: boolean;
1228
+ addImportStatements?: boolean;
1229
+ }
1225
1230
 
1226
1231
  export declare function exportLexicalTreeToMdast({ root, visitors, jsxComponentDescriptors, jsxIsAvailable, addImportStatements }: ExportLexicalTreeOptions): Mdast.Root;
1227
1232
 
1228
1233
  /* Excluded from this release type: exportMarkdownFromLexical */
1229
1234
 
1230
- /* Excluded from this release type: ExportMarkdownFromLexicalOptions */
1235
+ export declare interface ExportMarkdownFromLexicalOptions extends ExportLexicalTreeOptions {
1236
+ visitors: LexicalVisitor[];
1237
+ /**
1238
+ * the markdown extensions to use
1239
+ */
1240
+ toMarkdownExtensions: ToMarkdownExtension[];
1241
+ /**
1242
+ * The options to pass to `toMarkdown`
1243
+ */
1244
+ toMarkdownOptions: ToMarkdownOptions;
1245
+ }
1231
1246
 
1232
1247
  /**
1233
1248
  * Contains the currently registered export visitors.
@@ -1263,6 +1278,8 @@ export declare interface FileImageParameters extends BaseImageParameters {
1263
1278
 
1264
1279
  export declare type FORMAT = typeof DEFAULT_FORMAT | typeof IS_BOLD | typeof IS_ITALIC | typeof IS_STRIKETHROUGH | typeof IS_UNDERLINE | typeof IS_CODE | typeof IS_SUBSCRIPT | typeof IS_SUPERSCRIPT | typeof IS_HIGHLIGHT;
1265
1280
 
1281
+ export { FromMarkdownOptions }
1282
+
1266
1283
  /**
1267
1284
  * Fetches a value from the Lexical editor read cycle.
1268
1285
  * @group Utils
@@ -2131,11 +2148,11 @@ export declare interface MdastBlockHTMLNode extends MdxJsxFlowElement {
2131
2148
  name: (typeof htmlTags)[number];
2132
2149
  }
2133
2150
 
2134
- /* Excluded from this release type: MdastExtension */
2151
+ export declare type MdastExtension = Extension | Extension[];
2135
2152
 
2136
2153
  /* Excluded from this release type: mdastExtensions$ */
2137
2154
 
2138
- /* Excluded from this release type: MdastExtensions */
2155
+ export declare type MdastExtensions = MdastExtension[];
2139
2156
 
2140
2157
  /**
2141
2158
  * A HTML MDAST node.
@@ -2240,7 +2257,14 @@ export declare interface MdastInlineHTMLNode extends MdxJsxTextElement {
2240
2257
  */
2241
2258
  export declare type MdastJsx = MdxJsxTextElement | MdxJsxFlowElement;
2242
2259
 
2243
- /* Excluded from this release type: MdastTreeImportOptions */
2260
+ /**
2261
+ * The options of the tree import utility. Not meant to be used directly.
2262
+ */
2263
+ export declare interface MdastTreeImportOptions extends Descriptors {
2264
+ root: ImportPoint;
2265
+ visitors: MdastImportVisitor<Mdast.RootContent>[];
2266
+ mdastRoot: Mdast.Root;
2267
+ }
2244
2268
 
2245
2269
  export declare const MDX_FOCUS_SEARCH_NAME = "MdxFocusSearch";
2246
2270
 
@@ -2897,7 +2921,7 @@ export declare const switchFromPreviewToLinkEdit$: NodeRef<void>;
2897
2921
 
2898
2922
  /* Excluded from this release type: SyntaxExtension */
2899
2923
 
2900
- export declare const syntaxExtensions$: NodeRef< Extension[]>;
2924
+ export declare const syntaxExtensions$: NodeRef< Extension_2[]>;
2901
2925
 
2902
2926
  /**
2903
2927
  * React Components registered to be rendered inside table cell editors. Use this instead of {@link addNestedEditorChild$} for components that should only appear in table cells.
@@ -2959,7 +2983,7 @@ export declare class TableNode extends DecoratorNode<JSX.Element> {
2959
2983
  * A plugin that adds support for tables to the editor.
2960
2984
  * @group Table
2961
2985
  */
2962
- export declare const tablePlugin: (params?: Options_3 | undefined) => RealmPlugin;
2986
+ export declare const tablePlugin: (params?: Options_2 | undefined) => RealmPlugin;
2963
2987
 
2964
2988
  /**
2965
2989
  * Calls callback with the first argument, and returns it.
@@ -2987,12 +3011,15 @@ export declare function thrush<I, K>(arg: I, proc: (arg: I) => K): K;
2987
3011
 
2988
3012
  /* Excluded from this release type: ToggleSingleGroupWithItem */
2989
3013
 
2990
- export declare type ToMarkdownExtension = NonNullable<ToMarkdownOptions['extensions']>[number];
3014
+ export declare interface ToMarkdownExtension extends ToMarkdownOptions {
3015
+ }
2991
3016
 
2992
3017
  /* Excluded from this release type: toMarkdownExtensions$ */
2993
3018
 
2994
3019
  /* Excluded from this release type: toMarkdownOptions$ */
2995
- export { ToMarkdownOptions }
3020
+
3021
+ export declare interface ToMarkdownOptions extends Options {
3022
+ }
2996
3023
 
2997
3024
  export declare const toolbarClassName$: NodeRef<string>;
2998
3025
 
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "4.0.2",
14
+ "version": "4.0.3",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",