@mdxeditor/editor 0.10.0-alpha.1 → 0.10.0-alpha.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.
- package/dist/MDXEditor.d.ts +29 -0
- package/dist/MDXEditor.js +1 -1
- package/dist/directive-editors/AdmonitionDirectiveDescriptor.d.ts +13 -0
- package/dist/directive-editors/GenericDirectiveEditor.d.ts +5 -0
- package/dist/importMarkdownToLexical.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -1
- package/dist/jsx-editors/GenericJsxEditor.d.ts +5 -0
- package/dist/plugins/core/NestedLexicalEditor.d.ts +9 -2
- package/dist/plugins/core/PropertyPopover.d.ts +17 -2
- package/dist/plugins/diff-source/SourceEditor.js +2 -0
- package/dist/plugins/diff-source/index.d.ts +1 -0
- package/dist/plugins/image/ImageEditor.d.ts +3 -1
- package/dist/plugins/image/ImageEditor.js +29 -6
- package/dist/plugins/image/ImageNode.d.ts +11 -1
- package/dist/plugins/image/ImageNode.js +37 -9
- package/dist/plugins/image/ImageResizer.d.ts +18 -0
- package/dist/plugins/image/ImageResizer.js +214 -0
- package/dist/plugins/image/LexicalImageVisitor.js +27 -6
- package/dist/plugins/image/MdastImageVisitor.d.ts +3 -0
- package/dist/plugins/image/MdastImageVisitor.js +72 -1
- package/dist/plugins/image/index.d.ts +4 -0
- package/dist/plugins/image/index.js +3 -1
- package/dist/plugins/jsx/MdastMdxJsxElementVisitor.js +1 -1
- package/dist/plugins/jsx/index.d.ts +9 -0
- package/dist/plugins/lists/LexicalListVisitor.js +0 -1
- package/dist/plugins/table/TableEditor.js +25 -15
- package/dist/plugins/toolbar/components/BlockTypeSelect.d.ts +4 -0
- package/dist/plugins/toolbar/components/BoldItalicUnderlineToggles.d.ts +3 -0
- package/dist/plugins/toolbar/components/ChangeAdmonitionType.d.ts +4 -0
- package/dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.d.ts +5 -0
- package/dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.js +2 -2
- package/dist/plugins/toolbar/components/CodeToggle.d.ts +4 -0
- package/dist/plugins/toolbar/components/CreateLink.d.ts +4 -0
- package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.d.ts +5 -0
- package/dist/plugins/toolbar/components/InsertAdmonition.d.ts +4 -0
- package/dist/plugins/toolbar/components/InsertCodeBlock.d.ts +5 -0
- package/dist/plugins/toolbar/components/InsertFrontmatter.d.ts +4 -0
- package/dist/plugins/toolbar/components/InsertImage.d.ts +4 -0
- package/dist/plugins/toolbar/components/InsertSandpack.d.ts +4 -0
- package/dist/plugins/toolbar/components/InsertTable.d.ts +4 -0
- package/dist/plugins/toolbar/components/InsertThematicBreak.d.ts +4 -0
- package/dist/plugins/toolbar/components/KitchenSinkToolbar.d.ts +5 -0
- package/dist/plugins/toolbar/components/ListsToggle.d.ts +5 -0
- package/dist/plugins/toolbar/components/ShowSandpackInfo.d.ts +5 -0
- package/dist/plugins/toolbar/components/UndoRedo.d.ts +3 -0
- package/dist/plugins/toolbar/primitives/TooltipWrap.d.ts +3 -0
- package/dist/plugins/toolbar/primitives/select.d.ts +19 -0
- package/dist/plugins/toolbar/primitives/toolbar.d.ts +80 -5
- package/dist/style.css +232 -158
- package/dist/styles/ui.module.css.js +105 -75
- package/dist/utils/lexicalHelpers.js +2 -2
- package/package.json +12 -1
|
@@ -1,23 +1,38 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
2
5
|
export declare const SelectItem: React.ForwardRefExoticComponent<{
|
|
3
6
|
className?: string | undefined;
|
|
4
7
|
children: React.ReactNode;
|
|
5
8
|
value: string;
|
|
6
9
|
} & React.RefAttributes<HTMLDivElement | null>>;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
7
13
|
export declare const SelectTrigger: React.FC<{
|
|
8
14
|
title: string;
|
|
9
15
|
placeholder: string;
|
|
10
16
|
className?: string;
|
|
11
17
|
}>;
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
12
21
|
export declare const SelectContent: React.FC<{
|
|
13
22
|
children: React.ReactNode;
|
|
14
23
|
className?: string;
|
|
15
24
|
}>;
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
16
28
|
export declare const SelectButtonTrigger: React.FC<{
|
|
17
29
|
children: React.ReactNode;
|
|
18
30
|
title: string;
|
|
19
31
|
className?: string;
|
|
20
32
|
}>;
|
|
33
|
+
/**
|
|
34
|
+
* The properties of the {@link Select} React component.
|
|
35
|
+
*/
|
|
21
36
|
export interface SelectProps<T extends string> {
|
|
22
37
|
value: T;
|
|
23
38
|
onChange: (value: T) => void;
|
|
@@ -28,4 +43,8 @@ export interface SelectProps<T extends string> {
|
|
|
28
43
|
value: T;
|
|
29
44
|
} | 'separator')[];
|
|
30
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* A toolbar primitive you can use to build dropdowns, such as the block type select.
|
|
48
|
+
* See {@link SelectProps} for more details.
|
|
49
|
+
*/
|
|
31
50
|
export declare const Select: <T extends string>(props: SelectProps<T>) => React.JSX.Element;
|
|
@@ -1,18 +1,39 @@
|
|
|
1
1
|
import * as RadixToolbar from '@radix-ui/react-toolbar';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { EditorInFocus } from '../../core';
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
4
7
|
export declare const Root: (props: RadixToolbar.ToolbarProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* A toolbar button primitive.
|
|
10
|
+
*/
|
|
5
11
|
export declare const Button: React.ForwardRefExoticComponent<Omit<RadixToolbar.ToolbarButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<object>>;
|
|
12
|
+
/**
|
|
13
|
+
* A toolbar button with a custom toolbar primitive.
|
|
14
|
+
*/
|
|
6
15
|
export declare const ButtonWithTooltip: ({ title, children, ...props }: Omit<RadixToolbar.ToolbarButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<object> & {
|
|
7
16
|
title: string;
|
|
8
17
|
}) => React.JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
9
21
|
export declare const ToolbarToggleItem: React.ForwardRefExoticComponent<Omit<RadixToolbar.ToolbarToggleItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<object>>;
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
10
25
|
export declare const SingleToggleGroup: React.ForwardRefExoticComponent<(Omit<RadixToolbar.ToolbarToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<RadixToolbar.ToolbarToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>, "ref">) & React.RefAttributes<object>>;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
11
29
|
export declare const ToggleSingleGroupWithItem: React.ForwardRefExoticComponent<Omit<RadixToolbar.ToolbarToggleGroupSingleProps, "type"> & {
|
|
12
30
|
on: boolean;
|
|
13
31
|
title: string;
|
|
14
32
|
disabled?: boolean | undefined;
|
|
15
33
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
/**
|
|
35
|
+
* A toolbar primitive that allows you to build an UI with multiple non-exclusive toggle groups, like the bold/italic/underline toggle.
|
|
36
|
+
*/
|
|
16
37
|
export declare const MultipleChoiceToggleGroup: React.FC<{
|
|
17
38
|
items: {
|
|
18
39
|
title: string;
|
|
@@ -22,7 +43,10 @@ export declare const MultipleChoiceToggleGroup: React.FC<{
|
|
|
22
43
|
disabled?: boolean;
|
|
23
44
|
}[];
|
|
24
45
|
}>;
|
|
25
|
-
|
|
46
|
+
/**
|
|
47
|
+
* The properties of the {@link SingleChoiceToggleGroup} React component.
|
|
48
|
+
*/
|
|
49
|
+
export interface SingleChoiceToggleGroupProps<T extends string> {
|
|
26
50
|
items: {
|
|
27
51
|
title: string;
|
|
28
52
|
value: T;
|
|
@@ -32,6 +56,9 @@ interface SingleChoiceToggleGroupProps<T extends string> {
|
|
|
32
56
|
value: T;
|
|
33
57
|
className?: string;
|
|
34
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* A toolbar primitive that allows you to build an UI with multiple exclusive toggle groups, like the list type toggle.
|
|
61
|
+
*/
|
|
35
62
|
export declare const SingleChoiceToggleGroup: <T extends string>({ value, onChange, className, items }: SingleChoiceToggleGroupProps<T>) => React.JSX.Element;
|
|
36
63
|
/**
|
|
37
64
|
* The properties of the {@link ButtonOrDropdownButton} React component.
|
|
@@ -70,16 +97,64 @@ export interface ButtonOrDropdownButtonProps<T extends string> {
|
|
|
70
97
|
* @see {@link ButtonOrDropdownButtonProps} for the properties of the React component.
|
|
71
98
|
*/
|
|
72
99
|
export declare const ButtonOrDropdownButton: <T extends string>(props: ButtonOrDropdownButtonProps<T>) => React.JSX.Element;
|
|
73
|
-
|
|
100
|
+
/**
|
|
101
|
+
* An object that describes a possible option to be displayed in the {@link ConditionalContents} component.
|
|
102
|
+
*/
|
|
103
|
+
export type ConditionalContentsOption = {
|
|
104
|
+
/**
|
|
105
|
+
* A function that returns `true` if the option should be displayed for the current editor in focus.
|
|
106
|
+
*/
|
|
74
107
|
when: (rootNode: EditorInFocus | null) => boolean;
|
|
108
|
+
/**
|
|
109
|
+
* The contents to display if the `when` function returns `true`.
|
|
110
|
+
*/
|
|
75
111
|
contents: () => React.ReactNode;
|
|
76
112
|
};
|
|
77
|
-
|
|
113
|
+
/**
|
|
114
|
+
* A default option to be displayed in the {@link ConditionalContents} component if none of the other options match.
|
|
115
|
+
*/
|
|
116
|
+
export type FallBackOption = {
|
|
117
|
+
/**
|
|
118
|
+
* The contents to display
|
|
119
|
+
*/
|
|
78
120
|
fallback: () => React.ReactNode;
|
|
79
121
|
};
|
|
80
|
-
|
|
122
|
+
/**
|
|
123
|
+
* The properties of the {@link ConditionalContents} React component.
|
|
124
|
+
*/
|
|
125
|
+
export interface ConditionalContentsProps {
|
|
126
|
+
/**
|
|
127
|
+
* A set of options that define the contents to show based on the editor that is in focus.
|
|
128
|
+
* Can be either a {@link ConditionalContentsOption} or a {@link FallBackOption}.
|
|
129
|
+
* See the {@link ConditionalContents} documentation for an example.
|
|
130
|
+
*/
|
|
81
131
|
options: (ConditionalContentsOption | FallBackOption)[];
|
|
82
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* A toolbar primitive that allows you to show different contents based on the editor that is in focus.
|
|
135
|
+
* Useful for code editors that have different features and don't support rich text formatting.
|
|
136
|
+
* @example
|
|
137
|
+
* ```tsx
|
|
138
|
+
* <ConditionalContents
|
|
139
|
+
* options={[
|
|
140
|
+
* { when: (editor) => editor?.editorType === 'codeblock', contents: () => <ChangeCodeMirrorLanguage /> },
|
|
141
|
+
* { when: (editor) => editor?.editorType === 'sandpack', contents: () => <ShowSandpackInfo /> },
|
|
142
|
+
* {
|
|
143
|
+
* fallback: () => (
|
|
144
|
+
* <>
|
|
145
|
+
* <UndoRedo />
|
|
146
|
+
* <BoldItalicUnderlineToggles />
|
|
147
|
+
* <InsertCodeBlock />
|
|
148
|
+
* </>
|
|
149
|
+
* )
|
|
150
|
+
* }
|
|
151
|
+
* ]}
|
|
152
|
+
* />
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
83
155
|
export declare const ConditionalContents: React.FC<ConditionalContentsProps>;
|
|
156
|
+
/**
|
|
157
|
+
* A toolbar primitive that allows you to show a separator between toolbar items.
|
|
158
|
+
* By default, the separator is styled as vertical line.
|
|
159
|
+
*/
|
|
84
160
|
export declare const Separator: React.ForwardRefExoticComponent<RadixToolbar.ToolbarSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
85
|
-
export {};
|