@mdxeditor/editor 2.0.1 → 2.1.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
@@ -40,6 +40,7 @@ import { EditorConfig } from 'lexical';
40
40
  import { ElementNode } from 'lexical';
41
41
  import { Extension } from 'micromark-util-types';
42
42
  import { Extension as Extension_2 } from '@codemirror/state';
43
+ import { FC } from 'react';
43
44
  import { HeadingTagType } from '@lexical/rich-text';
44
45
  import { HistoryState } from '@lexical/history';
45
46
  import { InitialEditorStateType } from '@lexical/react/LexicalComposer.js';
@@ -1191,6 +1192,7 @@ export declare const imagePlugin: (params?: {
1191
1192
  imageAutocompleteSuggestions?: string[] | undefined;
1192
1193
  disableImageResize?: boolean | undefined;
1193
1194
  imagePreviewHandler?: ImagePreviewHandler | undefined;
1195
+ ImageDialog?: FC<{}> | (() => JSX.Element) | undefined;
1194
1196
  } | undefined) => RealmPlugin;
1195
1197
 
1196
1198
  /**
@@ -1563,7 +1565,7 @@ export declare interface LexicalConvertOptions {
1563
1565
  * This is part of the process that converts the editor contents to markdown.
1564
1566
  * @group Markdown Processing
1565
1567
  */
1566
- export declare interface LexicalExportVisitor<LN extends LexicalNode, UN extends Mdast.Content> {
1568
+ export declare interface LexicalExportVisitor<LN extends LexicalNode, UN extends Mdast.Nodes> {
1567
1569
  /**
1568
1570
  * Return true if the given node is of the type that this visitor can process.
1569
1571
  * You can safely use the node type guard functions (as in $isParagraphNode, $isLinkNode, etc.) here.
@@ -1614,12 +1616,12 @@ export declare interface LexicalExportVisitor<LN extends LexicalNode, UN extends
1614
1616
  * Return true if the current node should be joined with the previous node.
1615
1617
  * This is necessary due to some inconsistencies between the lexical tree and the mdast tree when it comes to formatting.
1616
1618
  */
1617
- shouldJoin?(prevNode: Mdast.Content, currentNode: UN): boolean;
1619
+ shouldJoin?(prevNode: Mdast.RootContent, currentNode: UN): boolean;
1618
1620
  /**
1619
1621
  * Join the current node with the previous node, returning the resulting new node
1620
1622
  * For this to be called by the tree walk, shouldJoin must return true.
1621
1623
  */
1622
- join?<T extends Mdast.Content>(prevNode: T, currentNode: T): T;
1624
+ join?<T extends Mdast.RootContent>(prevNode: T, currentNode: T): T;
1623
1625
  /**
1624
1626
  * Default 0, optional, sets the priority of the visitor. The higher the number, the earlier it will be called.
1625
1627
  */
@@ -1630,7 +1632,7 @@ export declare interface LexicalExportVisitor<LN extends LexicalNode, UN extends
1630
1632
  * A generic visitor that can be used to process any lexical node.
1631
1633
  * @group Markdown Processing
1632
1634
  */
1633
- export declare type LexicalVisitor = LexicalExportVisitor<LexicalNode, Mdast.Content>;
1635
+ export declare type LexicalVisitor = LexicalExportVisitor<LexicalNode, Mdast.RootContent>;
1634
1636
 
1635
1637
  /* Excluded from this release type: linkAutocompleteSuggestions$ */
1636
1638
 
@@ -414,7 +414,7 @@ const viewMode$ = Cell("rich-text", (r) => {
414
414
  filter((mode) => mode.current === "rich-text"),
415
415
  withLatestFrom(activeEditor$)
416
416
  ),
417
- ([mode, editor]) => {
417
+ ([, editor]) => {
418
418
  editor == null ? void 0 : editor.dispatchCommand(NESTED_EDITOR_UPDATED_COMMAND, void 0);
419
419
  }
420
420
  );
@@ -129,12 +129,12 @@ const closeImageDialog$ = Action((r) => {
129
129
  });
130
130
  const saveImage$ = Signal();
131
131
  const imagePlugin = realmPlugin({
132
- init(realm) {
132
+ init(realm, params) {
133
133
  realm.pubIn({
134
134
  [addImportVisitor$]: [MdastImageVisitor, MdastHtmlImageVisitor, MdastJsxImageVisitor],
135
135
  [addLexicalNode$]: ImageNode,
136
136
  [addExportVisitor$]: LexicalImageVisitor,
137
- [addComposerChild$]: ImageDialog
137
+ [addComposerChild$]: (params == null ? void 0 : params.ImageDialog) || ImageDialog
138
138
  });
139
139
  },
140
140
  update(realm, params) {
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "2.0.1",
14
+ "version": "2.1.0",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",