@mdxeditor/editor 3.51.0 → 3.52.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.
- package/dist/MDXEditor.js +3 -3
- package/dist/index.d.ts +63 -63
- package/dist/plugins/link-dialog/index.js +2 -0
- package/package.json +5 -5
package/dist/MDXEditor.js
CHANGED
|
@@ -25,7 +25,7 @@ const RichTextEditor = () => {
|
|
|
25
25
|
const setEditorRootWrapperElement = usePublisher(contentEditableWrapperElement$);
|
|
26
26
|
const onRef = (el) => {
|
|
27
27
|
setEditorRootWrapperElement(el);
|
|
28
|
-
setContentEditableRef({ current: el });
|
|
28
|
+
setContentEditableRef(el ? { current: el } : null);
|
|
29
29
|
};
|
|
30
30
|
const [contentEditableClassName, spellCheck, composerChildren, topAreaChildren, editorWrappers, placeholder, bottomAreaChildren] = useCellValues(
|
|
31
31
|
contentEditableClassName$,
|
|
@@ -120,8 +120,8 @@ const Methods = ({ mdxRef }) => {
|
|
|
120
120
|
(_a = realm.getValue(rootEditor$)) == null ? void 0 : _a.focus(callbackFn, opts);
|
|
121
121
|
},
|
|
122
122
|
getContentEditableHTML: () => {
|
|
123
|
-
var _a
|
|
124
|
-
return ((
|
|
123
|
+
var _a;
|
|
124
|
+
return ((_a = realm.getValue(contentEditableRef$)) == null ? void 0 : _a.current.innerHTML) ?? "";
|
|
125
125
|
},
|
|
126
126
|
getSelectionMarkdown: () => {
|
|
127
127
|
const viewMode = realm.getValue(viewMode$);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
|
|
3
1
|
import { Config } from 'mdast-util-from-markdown/lib';
|
|
4
2
|
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
5
3
|
import { DecoratorNode } from 'lexical';
|
|
@@ -17,6 +15,8 @@ import { Extension as Extension_2 } from '@codemirror/state';
|
|
|
17
15
|
import { FC } from 'react';
|
|
18
16
|
import { HeadingTagType } from '@lexical/rich-text';
|
|
19
17
|
import { HistoryState } from '@lexical/history';
|
|
18
|
+
import { JSX } from 'react';
|
|
19
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
20
20
|
import { KlassConstructor } from 'lexical';
|
|
21
21
|
import * as lexical from 'lexical';
|
|
22
22
|
import { LexicalCommand } from 'lexical';
|
|
@@ -336,7 +336,7 @@ export declare type BlockType = 'paragraph' | 'quote' | HeadingTagType | '';
|
|
|
336
336
|
* Supports paragraphs, headings and block quotes.
|
|
337
337
|
* @group Toolbar Components
|
|
338
338
|
*/
|
|
339
|
-
export declare const BlockTypeSelect: () =>
|
|
339
|
+
export declare const BlockTypeSelect: () => JSX_2.Element | null;
|
|
340
340
|
|
|
341
341
|
/**
|
|
342
342
|
* A toolbar component that lets the user toggle bold, italic and underline formatting.
|
|
@@ -354,7 +354,7 @@ export declare interface BoldItalicUnderlineTogglesProps {
|
|
|
354
354
|
* A toolbar button primitive.
|
|
355
355
|
* @group Toolbar Primitives
|
|
356
356
|
*/
|
|
357
|
-
export declare const Button: default_2.ForwardRefExoticComponent<
|
|
357
|
+
export declare const Button: default_2.ForwardRefExoticComponent<RadixToolbar.ToolbarButtonProps & default_2.RefAttributes<HTMLButtonElement>>;
|
|
358
358
|
|
|
359
359
|
/**
|
|
360
360
|
* Use this primitive to create a toolbar button that can be either a button or a dropdown, depending on the number of items passed.
|
|
@@ -387,15 +387,15 @@ export declare const ButtonOrDropdownButton: <T extends string>(props: {
|
|
|
387
387
|
*/
|
|
388
388
|
label: string | JSX.Element;
|
|
389
389
|
}[];
|
|
390
|
-
}) =>
|
|
390
|
+
}) => JSX_2.Element;
|
|
391
391
|
|
|
392
392
|
/**
|
|
393
393
|
* A toolbar button with tooltip primitive.
|
|
394
394
|
* @group Toolbar Primitives
|
|
395
395
|
*/
|
|
396
|
-
export declare const ButtonWithTooltip: ({ title, children, ...props }:
|
|
396
|
+
export declare const ButtonWithTooltip: ({ title, children, ...props }: RadixToolbar.ToolbarButtonProps & default_2.RefAttributes<HTMLButtonElement> & {
|
|
397
397
|
title: string;
|
|
398
|
-
}) =>
|
|
398
|
+
}) => JSX_2.Element;
|
|
399
399
|
|
|
400
400
|
/**
|
|
401
401
|
* Calls the passed function.
|
|
@@ -416,7 +416,7 @@ export declare const cancelLinkEdit$: NodeRef<void>;
|
|
|
416
416
|
* For this component to work, you must pass the {@link AdmonitionDirectiveDescriptor} to the `directivesPlugin` `directiveDescriptors` parameter.
|
|
417
417
|
* @group Toolbar Components
|
|
418
418
|
*/
|
|
419
|
-
export declare const ChangeAdmonitionType: () =>
|
|
419
|
+
export declare const ChangeAdmonitionType: () => JSX_2.Element;
|
|
420
420
|
|
|
421
421
|
/**
|
|
422
422
|
* A component that allows the user to change the code block language of the current selection.
|
|
@@ -424,7 +424,7 @@ export declare const ChangeAdmonitionType: () => default_2.JSX.Element;
|
|
|
424
424
|
* See {@link ConditionalContents} for an example on how to display the dropdown only when a code block is in focus.
|
|
425
425
|
* @group Toolbar Components
|
|
426
426
|
*/
|
|
427
|
-
export declare const ChangeCodeMirrorLanguage: () =>
|
|
427
|
+
export declare const ChangeCodeMirrorLanguage: () => JSX_2.Element;
|
|
428
428
|
|
|
429
429
|
export declare type ClickLinkCallback = (url: string) => void;
|
|
430
430
|
|
|
@@ -587,7 +587,7 @@ export declare const codeBlockPlugin: (params?: {
|
|
|
587
587
|
*/
|
|
588
588
|
export declare const codeMirrorAutoLoadLanguageSupport$: NodeRef<boolean>;
|
|
589
589
|
|
|
590
|
-
export declare const CodeMirrorEditor: ({ language, nodeKey, code, focusEmitter }: CodeBlockEditorProps) =>
|
|
590
|
+
export declare const CodeMirrorEditor: ({ language, nodeKey, code, focusEmitter }: CodeBlockEditorProps) => JSX_2.Element;
|
|
591
591
|
|
|
592
592
|
/**
|
|
593
593
|
* The code mirror extensions for the coemirror code block editor.
|
|
@@ -760,7 +760,7 @@ export declare interface CreateImageNodeParameters {
|
|
|
760
760
|
* For this component to work, you must include the `linkDialogPlugin`.
|
|
761
761
|
* @group Toolbar Components
|
|
762
762
|
*/
|
|
763
|
-
export declare const CreateLink: () =>
|
|
763
|
+
export declare const CreateLink: () => JSX_2.Element;
|
|
764
764
|
|
|
765
765
|
/**
|
|
766
766
|
* An input signal that lets you register a new {@link EditorSubscription} for the root editor.
|
|
@@ -823,51 +823,51 @@ export declare const DEFAULT_FORMAT: 0;
|
|
|
823
823
|
export declare const defaultCodeBlockLanguage$: NodeRef<string>;
|
|
824
824
|
|
|
825
825
|
export declare const defaultSvgIcons: {
|
|
826
|
-
undo:
|
|
827
|
-
redo:
|
|
828
|
-
format_bold:
|
|
829
|
-
format_italic:
|
|
830
|
-
format_underlined:
|
|
831
|
-
format_highlight:
|
|
832
|
-
code:
|
|
833
|
-
strikeThrough:
|
|
834
|
-
superscript:
|
|
835
|
-
subscript:
|
|
836
|
-
format_list_bulleted:
|
|
837
|
-
format_list_numbered:
|
|
838
|
-
format_list_checked:
|
|
839
|
-
link:
|
|
840
|
-
add_photo:
|
|
841
|
-
table:
|
|
842
|
-
horizontal_rule:
|
|
843
|
-
frontmatter:
|
|
844
|
-
frame_source:
|
|
845
|
-
arrow_drop_down:
|
|
846
|
-
admonition:
|
|
847
|
-
sandpack:
|
|
848
|
-
rich_text:
|
|
849
|
-
difference:
|
|
850
|
-
markdown:
|
|
851
|
-
open_in_new:
|
|
852
|
-
link_off:
|
|
853
|
-
edit:
|
|
854
|
-
content_copy:
|
|
855
|
-
more_horiz:
|
|
856
|
-
more_vert:
|
|
857
|
-
close:
|
|
858
|
-
settings:
|
|
859
|
-
delete_big:
|
|
860
|
-
delete_small:
|
|
861
|
-
format_align_center:
|
|
862
|
-
format_align_left:
|
|
863
|
-
format_align_right:
|
|
864
|
-
add_row:
|
|
865
|
-
add_column:
|
|
866
|
-
insert_col_left:
|
|
867
|
-
insert_row_above:
|
|
868
|
-
insert_row_below:
|
|
869
|
-
insert_col_right:
|
|
870
|
-
check:
|
|
826
|
+
undo: JSX_2.Element;
|
|
827
|
+
redo: JSX_2.Element;
|
|
828
|
+
format_bold: JSX_2.Element;
|
|
829
|
+
format_italic: JSX_2.Element;
|
|
830
|
+
format_underlined: JSX_2.Element;
|
|
831
|
+
format_highlight: JSX_2.Element;
|
|
832
|
+
code: JSX_2.Element;
|
|
833
|
+
strikeThrough: JSX_2.Element;
|
|
834
|
+
superscript: JSX_2.Element;
|
|
835
|
+
subscript: JSX_2.Element;
|
|
836
|
+
format_list_bulleted: JSX_2.Element;
|
|
837
|
+
format_list_numbered: JSX_2.Element;
|
|
838
|
+
format_list_checked: JSX_2.Element;
|
|
839
|
+
link: JSX_2.Element;
|
|
840
|
+
add_photo: JSX_2.Element;
|
|
841
|
+
table: JSX_2.Element;
|
|
842
|
+
horizontal_rule: JSX_2.Element;
|
|
843
|
+
frontmatter: JSX_2.Element;
|
|
844
|
+
frame_source: JSX_2.Element;
|
|
845
|
+
arrow_drop_down: JSX_2.Element;
|
|
846
|
+
admonition: JSX_2.Element;
|
|
847
|
+
sandpack: JSX_2.Element;
|
|
848
|
+
rich_text: JSX_2.Element;
|
|
849
|
+
difference: JSX_2.Element;
|
|
850
|
+
markdown: JSX_2.Element;
|
|
851
|
+
open_in_new: JSX_2.Element;
|
|
852
|
+
link_off: JSX_2.Element;
|
|
853
|
+
edit: JSX_2.Element;
|
|
854
|
+
content_copy: JSX_2.Element;
|
|
855
|
+
more_horiz: JSX_2.Element;
|
|
856
|
+
more_vert: JSX_2.Element;
|
|
857
|
+
close: JSX_2.Element;
|
|
858
|
+
settings: JSX_2.Element;
|
|
859
|
+
delete_big: JSX_2.Element;
|
|
860
|
+
delete_small: JSX_2.Element;
|
|
861
|
+
format_align_center: JSX_2.Element;
|
|
862
|
+
format_align_left: JSX_2.Element;
|
|
863
|
+
format_align_right: JSX_2.Element;
|
|
864
|
+
add_row: JSX_2.Element;
|
|
865
|
+
add_column: JSX_2.Element;
|
|
866
|
+
insert_col_left: JSX_2.Element;
|
|
867
|
+
insert_row_above: JSX_2.Element;
|
|
868
|
+
insert_row_below: JSX_2.Element;
|
|
869
|
+
insert_col_right: JSX_2.Element;
|
|
870
|
+
check: JSX_2.Element;
|
|
871
871
|
};
|
|
872
872
|
|
|
873
873
|
/**
|
|
@@ -1540,7 +1540,7 @@ export declare const initialMarkdownNormalize$: NodeRef<boolean>;
|
|
|
1540
1540
|
*
|
|
1541
1541
|
* @group Toolbar Components
|
|
1542
1542
|
*/
|
|
1543
|
-
export declare const InsertAdmonition: () =>
|
|
1543
|
+
export declare const InsertAdmonition: () => JSX_2.Element;
|
|
1544
1544
|
|
|
1545
1545
|
/**
|
|
1546
1546
|
* A signal that inserts a new code block into the editor with the published options.
|
|
@@ -1649,7 +1649,7 @@ export declare const insertSandpack$: NodeRef<string>;
|
|
|
1649
1649
|
* For this to work, you need to have the `sandpackPlugin` installed.
|
|
1650
1650
|
* @group Toolbar Components
|
|
1651
1651
|
*/
|
|
1652
|
-
export declare const InsertSandpack: () =>
|
|
1652
|
+
export declare const InsertSandpack: () => JSX_2.Element;
|
|
1653
1653
|
|
|
1654
1654
|
/**
|
|
1655
1655
|
* A signal that will insert a table with the published amount of rows and columns into the active editor.
|
|
@@ -2471,7 +2471,7 @@ export declare const NestedLexicalEditor: <T extends Mdast.RootContent>(props: {
|
|
|
2471
2471
|
* Whether or not the editor edits blocks (multiple paragraphs)
|
|
2472
2472
|
*/
|
|
2473
2473
|
block?: boolean;
|
|
2474
|
-
}) =>
|
|
2474
|
+
}) => JSX_2.Element;
|
|
2475
2475
|
|
|
2476
2476
|
/**
|
|
2477
2477
|
* The state of the image dialog when it is in new mode.
|
|
@@ -2686,7 +2686,7 @@ export declare interface SandpackConfig {
|
|
|
2686
2686
|
presets: SandpackPreset[];
|
|
2687
2687
|
}
|
|
2688
2688
|
|
|
2689
|
-
export declare const SandpackEditor: ({ nodeKey, code, focusEmitter, preset }: SandpackEditorProps) =>
|
|
2689
|
+
export declare const SandpackEditor: ({ nodeKey, code, focusEmitter, preset }: SandpackEditorProps) => JSX_2.Element;
|
|
2690
2690
|
|
|
2691
2691
|
export declare interface SandpackEditorProps extends CodeBlockEditorProps {
|
|
2692
2692
|
preset: SandpackPreset;
|
|
@@ -2782,7 +2782,7 @@ export declare const Select: <T extends string>(props: {
|
|
|
2782
2782
|
label: string | JSX.Element;
|
|
2783
2783
|
value: T;
|
|
2784
2784
|
} | 'separator')[];
|
|
2785
|
-
}) =>
|
|
2785
|
+
}) => JSX_2.Element;
|
|
2786
2786
|
|
|
2787
2787
|
/* Excluded from this release type: SelectButtonTrigger */
|
|
2788
2788
|
|
|
@@ -2875,7 +2875,7 @@ export declare const showLinkTitleField$: NodeRef<boolean>;
|
|
|
2875
2875
|
* See {@link ConditionalContents} for an example on how to display the dropdown only when a sandpack editor is in focus.
|
|
2876
2876
|
* @group Toolbar Components
|
|
2877
2877
|
*/
|
|
2878
|
-
export declare const ShowSandpackInfo: () =>
|
|
2878
|
+
export declare const ShowSandpackInfo: () => JSX_2.Element;
|
|
2879
2879
|
|
|
2880
2880
|
/**
|
|
2881
2881
|
* A toolbar primitive that allows you to build an UI with multiple exclusive toggle groups, like the list type toggle.
|
|
@@ -2891,7 +2891,7 @@ export declare const SingleChoiceToggleGroup: <T extends string>({ value, onChan
|
|
|
2891
2891
|
value: T | '';
|
|
2892
2892
|
ggClassName?: string;
|
|
2893
2893
|
className?: string;
|
|
2894
|
-
}) =>
|
|
2894
|
+
}) => JSX_2.Element;
|
|
2895
2895
|
|
|
2896
2896
|
/* Excluded from this release type: SingleToggleGroup */
|
|
2897
2897
|
|
|
@@ -166,6 +166,8 @@ const linkDialogState$ = Cell({ type: "inactive" }, (r) => {
|
|
|
166
166
|
map(([[selection], activeEditor, _, readOnly]) => {
|
|
167
167
|
if ($isRangeSelection(selection) && activeEditor && !readOnly) {
|
|
168
168
|
const node = getLinkNodeInSelection(selection);
|
|
169
|
+
if (!selection.isCollapsed())
|
|
170
|
+
return { type: "inactive" };
|
|
169
171
|
if (node) {
|
|
170
172
|
const rect = getSelectionRectangle(activeEditor);
|
|
171
173
|
if (!rect) {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"*.css"
|
|
12
12
|
],
|
|
13
13
|
"type": "module",
|
|
14
|
-
"version": "3.
|
|
14
|
+
"version": "3.52.1",
|
|
15
15
|
"description": "React component for rich text markdown editing",
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "vite build",
|
|
@@ -114,8 +114,8 @@
|
|
|
114
114
|
"@types/mdast": "^4.0.3",
|
|
115
115
|
"@types/multer": "^1.4.7",
|
|
116
116
|
"@types/node": "^20.2.5",
|
|
117
|
-
"@types/react": "^
|
|
118
|
-
"@types/react-dom": "^
|
|
117
|
+
"@types/react": "^19.2.7",
|
|
118
|
+
"@types/react-dom": "^19.2.3",
|
|
119
119
|
"@types/unist": "^3.0.2",
|
|
120
120
|
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
|
121
121
|
"@typescript-eslint/parser": "^7.9.0",
|
|
@@ -144,8 +144,8 @@
|
|
|
144
144
|
"postcss-mixins": "^9.0.4",
|
|
145
145
|
"postcss-nesting": "^11.2.2",
|
|
146
146
|
"prettier": "^3.1.1",
|
|
147
|
-
"react": "^19.1
|
|
148
|
-
"react-dom": "^19.1
|
|
147
|
+
"react": "^19.2.1",
|
|
148
|
+
"react-dom": "^19.2.1",
|
|
149
149
|
"semantic-release": "^25.0.2",
|
|
150
150
|
"svgo": "^3.3.2",
|
|
151
151
|
"terser": "^5.26.0",
|