@mdxeditor/editor 1.14.3 → 2.0.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/MDXEditor.js +19 -25
- package/dist/RealmWithPlugins.js +36 -0
- package/dist/directive-editors/GenericDirectiveEditor.js +7 -4
- package/dist/index.d.ts +2590 -62
- package/dist/index.js +138 -66
- package/dist/jsx-editors/GenericJsxEditor.js +12 -9
- package/dist/plugins/codeblock/CodeBlockNode.js +5 -5
- package/dist/plugins/codeblock/index.js +37 -63
- package/dist/plugins/codemirror/CodeMirrorEditor.js +3 -2
- package/dist/plugins/codemirror/index.js +28 -45
- package/dist/plugins/core/GenericHTMLNode.js +9 -1
- package/dist/plugins/core/MdastHTMLNode.js +0 -1
- package/dist/plugins/core/NestedLexicalEditor.js +11 -10
- package/dist/plugins/core/PropertyPopover.js +3 -2
- package/dist/plugins/core/SharedHistoryPlugin.js +3 -3
- package/dist/plugins/core/index.js +426 -385
- package/dist/plugins/core/ui/DownshiftAutoComplete.js +3 -2
- package/dist/plugins/core/ui/PopoverUtils.js +3 -2
- package/dist/plugins/diff-source/DiffSourceWrapper.js +3 -4
- package/dist/plugins/diff-source/DiffViewer.js +7 -7
- package/dist/plugins/diff-source/SourceEditor.js +6 -6
- package/dist/plugins/diff-source/index.js +17 -52
- package/dist/plugins/directives/DirectiveNode.js +28 -5
- package/dist/plugins/directives/index.js +36 -43
- package/dist/plugins/frontmatter/FrontmatterEditor.js +20 -16
- package/dist/plugins/frontmatter/index.js +51 -62
- package/dist/plugins/headings/index.js +43 -49
- package/dist/plugins/image/ImageDialog.js +11 -7
- package/dist/plugins/image/ImageEditor.js +10 -7
- package/dist/plugins/image/ImageNode.js +27 -5
- package/dist/plugins/image/index.js +65 -72
- package/dist/plugins/jsx/LexicalJsxNode.js +3 -2
- package/dist/plugins/jsx/index.js +48 -60
- package/dist/plugins/link/index.js +15 -20
- package/dist/plugins/link-dialog/LinkDialog.js +17 -16
- package/dist/plugins/link-dialog/index.js +194 -216
- package/dist/plugins/lists/index.js +50 -65
- package/dist/plugins/markdown-shortcut/index.js +12 -15
- package/dist/plugins/quote/index.js +11 -19
- package/dist/plugins/sandpack/SandpackEditor.js +3 -2
- package/dist/plugins/sandpack/index.js +34 -50
- package/dist/plugins/sandpack/useCodeMirrorRef.js +7 -6
- package/dist/plugins/table/TableEditor.js +12 -13
- package/dist/plugins/table/TableNode.js +28 -0
- package/dist/plugins/table/index.js +32 -39
- package/dist/plugins/thematic-break/index.js +19 -32
- package/dist/plugins/toolbar/components/BlockTypeSelect.js +9 -8
- package/dist/plugins/toolbar/components/BoldItalicUnderlineToggles.js +4 -4
- package/dist/plugins/toolbar/components/ChangeAdmonitionType.js +3 -2
- package/dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.js +5 -5
- package/dist/plugins/toolbar/components/CodeToggle.js +4 -3
- package/dist/plugins/toolbar/components/CreateLink.js +6 -4
- package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.js +5 -5
- package/dist/plugins/toolbar/components/InsertAdmonition.js +5 -3
- package/dist/plugins/toolbar/components/InsertCodeBlock.js +5 -3
- package/dist/plugins/toolbar/components/InsertFrontmatter.js +6 -5
- package/dist/plugins/toolbar/components/InsertImage.js +6 -5
- package/dist/plugins/toolbar/components/InsertSandpack.js +5 -4
- package/dist/plugins/toolbar/components/InsertTable.js +5 -3
- package/dist/plugins/toolbar/components/InsertThematicBreak.js +6 -4
- package/dist/plugins/toolbar/components/ListsToggle.js +5 -4
- package/dist/plugins/toolbar/components/ShowSandpackInfo.js +9 -4
- package/dist/plugins/toolbar/components/UndoRedo.js +3 -3
- package/dist/plugins/toolbar/index.js +15 -31
- package/dist/plugins/toolbar/primitives/DialogButton.js +23 -24
- package/dist/plugins/toolbar/primitives/TooltipWrap.js +3 -2
- package/dist/plugins/toolbar/primitives/select.js +5 -4
- package/dist/plugins/toolbar/primitives/toolbar.js +10 -4
- package/dist/style.css +935 -571
- package/dist/styles/globals.css.js +1 -4
- package/dist/styles/lexical-theme.module.css.js +25 -19
- package/dist/styles/ui.module.css.js +103 -103
- package/package.json +64 -317
- package/dist/FormatConstants.d.ts +0 -9
- package/dist/MDXEditor.d.ts +0 -103
- package/dist/directive-editors/AdmonitionDirectiveDescriptor.d.ts +0 -17
- package/dist/directive-editors/GenericDirectiveEditor.d.ts +0 -8
- package/dist/exportMarkdownFromLexical.d.ts +0 -138
- package/dist/gurx/index.d.ts +0 -3
- package/dist/gurx/react.d.ts +0 -152
- package/dist/gurx/react.js +0 -206
- package/dist/gurx/realm.d.ts +0 -148
- package/dist/gurx/realm.js +0 -489
- package/dist/gurx/realmFactory.d.ts +0 -79
- package/dist/gurx/realmFactory.js +0 -32
- package/dist/importMarkdownToLexical.d.ts +0 -101
- package/dist/jsx-editors/GenericJsxEditor.d.ts +0 -8
- package/dist/plugins/codeblock/CodeBlockNode.d.ts +0 -100
- package/dist/plugins/codeblock/CodeBlockVisitor.d.ts +0 -4
- package/dist/plugins/codeblock/MdastCodeVisitor.d.ts +0 -3
- package/dist/plugins/codeblock/index.d.ts +0 -787
- package/dist/plugins/codemirror/CodeMirrorEditor.d.ts +0 -3
- package/dist/plugins/codemirror/index.d.ts +0 -1038
- package/dist/plugins/core/GenericHTMLNode.d.ts +0 -38
- package/dist/plugins/core/Icon.d.ts +0 -6
- package/dist/plugins/core/LexicalGenericHTMLNodeVisitor.d.ts +0 -4
- package/dist/plugins/core/LexicalLinebreakVisitor.d.ts +0 -4
- package/dist/plugins/core/LexicalParagraphVisitor.d.ts +0 -4
- package/dist/plugins/core/LexicalRootVisitor.d.ts +0 -4
- package/dist/plugins/core/LexicalTextVisitor.d.ts +0 -5
- package/dist/plugins/core/MdastBreakVisitor.d.ts +0 -3
- package/dist/plugins/core/MdastFormattingVisitor.d.ts +0 -4
- package/dist/plugins/core/MdastHTMLNode.d.ts +0 -13
- package/dist/plugins/core/MdastHTMLVisitor.d.ts +0 -3
- package/dist/plugins/core/MdastInlineCodeVisitor.d.ts +0 -3
- package/dist/plugins/core/MdastParagraphVisitor.d.ts +0 -3
- package/dist/plugins/core/MdastRootVisitor.d.ts +0 -3
- package/dist/plugins/core/MdastTextVisitor.d.ts +0 -3
- package/dist/plugins/core/NestedLexicalEditor.d.ts +0 -92
- package/dist/plugins/core/PropertyPopover.d.ts +0 -23
- package/dist/plugins/core/SharedHistoryPlugin.d.ts +0 -2
- package/dist/plugins/core/index.d.ts +0 -583
- package/dist/plugins/core/ui/DownshiftAutoComplete.d.ts +0 -15
- package/dist/plugins/core/ui/PopoverUtils.d.ts +0 -4
- package/dist/plugins/diff-source/DiffSourceWrapper.d.ts +0 -4
- package/dist/plugins/diff-source/DiffViewer.d.ts +0 -2
- package/dist/plugins/diff-source/SourceEditor.d.ts +0 -4
- package/dist/plugins/diff-source/index.d.ts +0 -725
- package/dist/plugins/directives/DirectiveNode.d.ts +0 -51
- package/dist/plugins/directives/DirectiveVisitor.d.ts +0 -4
- package/dist/plugins/directives/MdastDirectiveVisitor.d.ts +0 -3
- package/dist/plugins/directives/index.d.ts +0 -773
- package/dist/plugins/frontmatter/FrontmatterEditor.d.ts +0 -6
- package/dist/plugins/frontmatter/FrontmatterNode.d.ts +0 -35
- package/dist/plugins/frontmatter/LexicalFrontmatterVisitor.d.ts +0 -4
- package/dist/plugins/frontmatter/MdastFrontmatterVisitor.d.ts +0 -3
- package/dist/plugins/frontmatter/index.d.ts +0 -717
- package/dist/plugins/headings/LexicalHeadingVisitor.d.ts +0 -4
- package/dist/plugins/headings/MdastHeadingVisitor.d.ts +0 -3
- package/dist/plugins/headings/index.d.ts +0 -707
- package/dist/plugins/image/ImageDialog.d.ts +0 -2
- package/dist/plugins/image/ImageEditor.d.ts +0 -10
- package/dist/plugins/image/ImageNode.d.ts +0 -65
- package/dist/plugins/image/ImageResizer.d.ts +0 -18
- package/dist/plugins/image/LexicalImageVisitor.d.ts +0 -4
- package/dist/plugins/image/MdastImageVisitor.d.ts +0 -6
- package/dist/plugins/image/index.d.ts +0 -804
- package/dist/plugins/jsx/LexicalJsxNode.d.ts +0 -54
- package/dist/plugins/jsx/LexicalJsxVisitor.d.ts +0 -4
- package/dist/plugins/jsx/MdastMdxJsEsmVisitor.d.ts +0 -3
- package/dist/plugins/jsx/MdastMdxJsxElementVisitor.d.ts +0 -3
- package/dist/plugins/jsx/index.d.ts +0 -779
- package/dist/plugins/link/AutoLinkPlugin.d.ts +0 -9
- package/dist/plugins/link/LexicalLinkVisitor.d.ts +0 -4
- package/dist/plugins/link/MdastLinkVisitor.d.ts +0 -3
- package/dist/plugins/link/index.d.ts +0 -101
- package/dist/plugins/link-dialog/LinkDialog.d.ts +0 -16
- package/dist/plugins/link-dialog/index.d.ts +0 -670
- package/dist/plugins/lists/LexicalListItemVisitor.d.ts +0 -4
- package/dist/plugins/lists/LexicalListVisitor.d.ts +0 -4
- package/dist/plugins/lists/MdastListItemVisitor.d.ts +0 -3
- package/dist/plugins/lists/MdastListVisitor.d.ts +0 -3
- package/dist/plugins/lists/index.d.ts +0 -703
- package/dist/plugins/markdown-shortcut/index.d.ts +0 -80
- package/dist/plugins/quote/LexicalQuoteVisitor.d.ts +0 -4
- package/dist/plugins/quote/MdastBlockQuoteVisitor.d.ts +0 -3
- package/dist/plugins/quote/index.d.ts +0 -480
- package/dist/plugins/sandpack/SandpackEditor.d.ts +0 -7
- package/dist/plugins/sandpack/index.d.ts +0 -1077
- package/dist/plugins/sandpack/useCodeMirrorRef.d.ts +0 -4
- package/dist/plugins/table/LexicalTableVisitor.d.ts +0 -4
- package/dist/plugins/table/MdastTableVisitor.d.ts +0 -3
- package/dist/plugins/table/TableEditor.d.ts +0 -21
- package/dist/plugins/table/TableNode.d.ts +0 -52
- package/dist/plugins/table/index.d.ts +0 -704
- package/dist/plugins/thematic-break/LexicalThematicBreakVisitor.d.ts +0 -4
- package/dist/plugins/thematic-break/MdastThematicBreakVisitor.d.ts +0 -3
- package/dist/plugins/thematic-break/index.d.ts +0 -693
- package/dist/plugins/toolbar/components/BlockTypeSelect.d.ts +0 -6
- package/dist/plugins/toolbar/components/BoldItalicUnderlineToggles.d.ts +0 -5
- package/dist/plugins/toolbar/components/ChangeAdmonitionType.d.ts +0 -6
- package/dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.d.ts +0 -7
- package/dist/plugins/toolbar/components/CodeToggle.d.ts +0 -6
- package/dist/plugins/toolbar/components/CreateLink.d.ts +0 -6
- package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.d.ts +0 -18
- package/dist/plugins/toolbar/components/InsertAdmonition.d.ts +0 -6
- package/dist/plugins/toolbar/components/InsertCodeBlock.d.ts +0 -7
- package/dist/plugins/toolbar/components/InsertFrontmatter.d.ts +0 -6
- package/dist/plugins/toolbar/components/InsertImage.d.ts +0 -6
- package/dist/plugins/toolbar/components/InsertSandpack.d.ts +0 -6
- package/dist/plugins/toolbar/components/InsertTable.d.ts +0 -6
- package/dist/plugins/toolbar/components/InsertThematicBreak.d.ts +0 -6
- package/dist/plugins/toolbar/components/KitchenSinkToolbar.d.ts +0 -7
- package/dist/plugins/toolbar/components/ListsToggle.d.ts +0 -7
- package/dist/plugins/toolbar/components/ShowSandpackInfo.d.ts +0 -7
- package/dist/plugins/toolbar/components/UndoRedo.d.ts +0 -5
- package/dist/plugins/toolbar/index.d.ts +0 -564
- package/dist/plugins/toolbar/primitives/DialogButton.d.ts +0 -40
- package/dist/plugins/toolbar/primitives/TooltipWrap.d.ts +0 -8
- package/dist/plugins/toolbar/primitives/select.d.ts +0 -50
- package/dist/plugins/toolbar/primitives/toolbar.d.ts +0 -163
- package/dist/styles/lexicalTheme.d.ts +0 -2
- package/dist/utils/detectMac.d.ts +0 -3
- package/dist/utils/fp.d.ts +0 -47
- package/dist/utils/isPartOftheEditorUI.d.ts +0 -1
- package/dist/utils/lexicalHelpers.d.ts +0 -11
- package/dist/utils/makeHslTransparent.d.ts +0 -1
- package/dist/utils/mergeStyleAttributes.d.ts +0 -1
- package/dist/utils/uuid4.d.ts +0 -1
- package/dist/utils/voidEmitter.d.ts +0 -14
- package/dist/utils/whitespaceConversion.d.ts +0 -2
- package/dist/utils/whitespaceConversion.js +0 -9
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { DOMConversionMap, DOMExportOutput, ElementNode, LexicalEditor, LexicalNode, NodeKey, SerializedElementNode, Spread } from 'lexical';
|
|
2
|
-
import { MdxJsxAttribute } from 'mdast-util-mdx-jsx';
|
|
3
|
-
import { MDX_NODE_TYPES, htmlTags } from './MdastHTMLNode';
|
|
4
|
-
export type KnownHTMLTagType = (typeof htmlTags)[number];
|
|
5
|
-
declare const TYPE_NAME: "generic-html";
|
|
6
|
-
export type SerializedGenericHTMLNode = Spread<{
|
|
7
|
-
tag: KnownHTMLTagType;
|
|
8
|
-
type: typeof TYPE_NAME;
|
|
9
|
-
mdxType: MdxNodeType;
|
|
10
|
-
attributes: MdxJsxAttribute[];
|
|
11
|
-
version: 1;
|
|
12
|
-
}, SerializedElementNode>;
|
|
13
|
-
type MdxNodeType = (typeof MDX_NODE_TYPES)[number];
|
|
14
|
-
export declare class GenericHTMLNode extends ElementNode {
|
|
15
|
-
/** @internal */
|
|
16
|
-
__tag: KnownHTMLTagType;
|
|
17
|
-
__nodeType: MdxNodeType;
|
|
18
|
-
__attributes: MdxJsxAttribute[];
|
|
19
|
-
static getType(): string;
|
|
20
|
-
static clone(node: GenericHTMLNode): GenericHTMLNode;
|
|
21
|
-
constructor(tag: KnownHTMLTagType, type: MdxNodeType, attributes: MdxJsxAttribute[], key?: NodeKey);
|
|
22
|
-
getTag(): KnownHTMLTagType;
|
|
23
|
-
getNodeType(): MdxNodeType;
|
|
24
|
-
getAttributes(): MdxJsxAttribute[];
|
|
25
|
-
updateAttributes(attributes: MdxJsxAttribute[]): void;
|
|
26
|
-
getStyle(): string;
|
|
27
|
-
createDOM(): HTMLElement;
|
|
28
|
-
updateDOM(): boolean;
|
|
29
|
-
static importDOM(): DOMConversionMap | null;
|
|
30
|
-
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
|
31
|
-
static importJSON(serializedNode: SerializedGenericHTMLNode): GenericHTMLNode;
|
|
32
|
-
exportJSON(): SerializedGenericHTMLNode;
|
|
33
|
-
extractWithChild(): boolean;
|
|
34
|
-
isInline(): boolean;
|
|
35
|
-
}
|
|
36
|
-
export declare function $createGenericHTMLNode(tag: KnownHTMLTagType, type: MdxNodeType, attributes: MdxJsxAttribute[]): GenericHTMLNode;
|
|
37
|
-
export declare function $isGenericHTMLNode(node: LexicalNode | null | undefined): node is GenericHTMLNode;
|
|
38
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type IconKey = 'add_column' | 'add_photo' | 'add_row' | 'arrow_drop_down' | 'check' | 'check_small' | 'close' | 'code' | 'content_copy' | 'delete_big' | 'delete_small' | 'sandpack' | 'difference' | 'edit' | 'admonition' | 'extension' | 'format_align_center' | 'format_align_left' | 'format_align_right' | 'format_bold' | 'format_italic' | 'format_list_bulleted' | 'format_list_checked' | 'format_list_numbered' | 'format_underlined' | 'frame_source' | 'frontmatter' | 'horizontal_rule' | 'insert_col_left' | 'insert_col_right' | 'insert_row_above' | 'insert_row_below' | 'link' | 'link_off' | 'markdown' | 'more_horiz' | 'more_vert' | 'open_in_new' | 'redo' | 'rich_text' | 'settings' | 'table' | 'undo';
|
|
3
|
-
declare const Icon: React.FC<{
|
|
4
|
-
name: IconKey;
|
|
5
|
-
}>;
|
|
6
|
-
export default Icon;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx-jsx';
|
|
2
|
-
import { GenericHTMLNode } from './GenericHTMLNode';
|
|
3
|
-
import { LexicalExportVisitor } from '../../exportMarkdownFromLexical';
|
|
4
|
-
export declare const LexicalGenericHTMLVisitor: LexicalExportVisitor<GenericHTMLNode, MdxJsxFlowElement | MdxJsxTextElement>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { TextNode } from 'lexical';
|
|
2
|
-
import * as Mdast from 'mdast';
|
|
3
|
-
import { LexicalExportVisitor } from '../../exportMarkdownFromLexical';
|
|
4
|
-
export declare function isMdastText(mdastNode: Mdast.Content): mdastNode is Mdast.Text;
|
|
5
|
-
export declare const LexicalTextVisitor: LexicalExportVisitor<TextNode, Mdast.Text>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as Mdast from 'mdast';
|
|
2
|
-
import { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx-jsx';
|
|
3
|
-
interface MdastBlockHTMLNode extends MdxJsxFlowElement {
|
|
4
|
-
name: (typeof htmlTags)[number];
|
|
5
|
-
}
|
|
6
|
-
interface MdastInlineHTMLNode extends MdxJsxTextElement {
|
|
7
|
-
name: (typeof htmlTags)[number];
|
|
8
|
-
}
|
|
9
|
-
export type MdastHTMLNode = MdastBlockHTMLNode | MdastInlineHTMLNode;
|
|
10
|
-
export declare const MDX_NODE_TYPES: readonly ["mdxJsxTextElement", "mdxJsxFlowElement"];
|
|
11
|
-
export declare function isMdastHTMLNode(node: Mdast.Parent | Mdast.Content | Mdast.Root): node is MdastHTMLNode;
|
|
12
|
-
export declare const htmlTags: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr"];
|
|
13
|
-
export {};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { DecoratorNode, EditorConfig, LexicalEditor } from 'lexical';
|
|
2
|
-
import * as Mdast from 'mdast';
|
|
3
|
-
import type { Data, Node } from 'unist';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { ContentEditable } from '@lexical/react/LexicalContentEditable.js';
|
|
6
|
-
import { VoidEmitter } from '../../utils/voidEmitter';
|
|
7
|
-
/**
|
|
8
|
-
* The value of the {@link NestedEditorsContext} React context.
|
|
9
|
-
*/
|
|
10
|
-
export interface NestedEditorsContextValue<T extends Node> {
|
|
11
|
-
/**
|
|
12
|
-
* The parent lexical editor
|
|
13
|
-
*/
|
|
14
|
-
parentEditor: LexicalEditor;
|
|
15
|
-
/**
|
|
16
|
-
* The parent editor config
|
|
17
|
-
*/
|
|
18
|
-
config: EditorConfig;
|
|
19
|
-
/**
|
|
20
|
-
* The mdast node that is being edited
|
|
21
|
-
*/
|
|
22
|
-
mdastNode: T;
|
|
23
|
-
/**
|
|
24
|
-
* The lexical node that is being edited
|
|
25
|
-
*/
|
|
26
|
-
lexicalNode: DecoratorNode<any> & {
|
|
27
|
-
/**
|
|
28
|
-
* Use this method to update the mdast node. This will also update the mdast tree of the parent editor.
|
|
29
|
-
*/
|
|
30
|
-
setMdastNode: (mdastNode: any) => void;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Subscribe to the emitter and implement the logic to focus the custom editor.
|
|
34
|
-
*/
|
|
35
|
-
focusEmitter: VoidEmitter;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Use this context to provide the necessary values to the {@link NestedLexicalEditor} React component.
|
|
39
|
-
* Place it as a wrapper in your custom lexical node decorators.
|
|
40
|
-
*/
|
|
41
|
-
export declare const NestedEditorsContext: React.Context<NestedEditorsContextValue<Node<Data>> | undefined>;
|
|
42
|
-
/**
|
|
43
|
-
* A hook to get the current {@link NestedEditorsContext} value. Use this in your custom editor components.
|
|
44
|
-
*/
|
|
45
|
-
export declare function useNestedEditorContext<T extends Mdast.Content>(): NestedEditorsContextValue<T>;
|
|
46
|
-
/**
|
|
47
|
-
* A hook that returns a function that can be used to update the mdast node. Use this in your custom editor components.
|
|
48
|
-
*/
|
|
49
|
-
export declare function useMdastNodeUpdater<T extends Mdast.Content>(): (node: Partial<T>) => void;
|
|
50
|
-
/**
|
|
51
|
-
* A hook that returns a function that removes the lexical node from the editor.
|
|
52
|
-
*/
|
|
53
|
-
export declare function useLexicalNodeRemove(): () => void;
|
|
54
|
-
/**
|
|
55
|
-
* The properties of the {@link NestedLexicalEditor} React component.
|
|
56
|
-
* @typeParam T - The type of the mdast node of the editor.
|
|
57
|
-
*/
|
|
58
|
-
export interface NestedEditorProps<T extends Mdast.Content> {
|
|
59
|
-
/**
|
|
60
|
-
* A function that returns the phrasing content of the mdast node. In most cases, this will be the `children` property of the mdast node, but you can also have multiple nested nodes with their own children.
|
|
61
|
-
*/
|
|
62
|
-
getContent: (mdastNode: T) => Mdast.Content[];
|
|
63
|
-
/**
|
|
64
|
-
* A function that should return the updated mdast node based on the original mdast node and the new content (serialized as mdast tree) produced by the editor.
|
|
65
|
-
*/
|
|
66
|
-
getUpdatedMdastNode: (mdastNode: T, children: Mdast.Content[]) => T;
|
|
67
|
-
/**
|
|
68
|
-
* Props passed to the {@link https://github.com/facebook/lexical/blob/main/packages/lexical-react/src/LexicalContentEditable.tsx | ContentEditable} component.
|
|
69
|
-
*/
|
|
70
|
-
contentEditableProps?: React.ComponentProps<typeof ContentEditable>;
|
|
71
|
-
/**
|
|
72
|
-
* Whether or not the editor edits blocks (multiple paragraphs)
|
|
73
|
-
*/
|
|
74
|
-
block?: boolean;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* A nested editor React component that allows editing of the contents of complex markdown nodes that have nested markdown content (for example, custom directives or JSX elements). See the {@link NestedEditorProps} for more details on the compoment props.
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* You can use a type param to specify the type of the mdast node
|
|
81
|
-
*
|
|
82
|
-
* ```tsx
|
|
83
|
-
*
|
|
84
|
-
* interface CalloutDirectiveNode extends LeafDirective {
|
|
85
|
-
* name: 'callout'
|
|
86
|
-
* children: Mdast.PhrasingContent[]
|
|
87
|
-
* }
|
|
88
|
-
*
|
|
89
|
-
* return <NestedLexicalEditor<CalloutDirectiveNode> getContent={node => node.children} getUpdatedMdastNode={(node, children) => ({ ...node, children })} />
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
export declare const NestedLexicalEditor: <T extends Mdast.Content>(props: NestedEditorProps<T>) => React.JSX.Element;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* The properties of the {@link PropertyPopover} React component.
|
|
4
|
-
*/
|
|
5
|
-
export interface PropertyPopoverProps {
|
|
6
|
-
/**
|
|
7
|
-
* The properties to edit. The key is the name of the property, and the value is the initial value.
|
|
8
|
-
*/
|
|
9
|
-
properties: Record<string, string>;
|
|
10
|
-
/**
|
|
11
|
-
* Triggered when the user edits the property values.
|
|
12
|
-
*/
|
|
13
|
-
onChange: (values: Record<string, string>) => void;
|
|
14
|
-
/**
|
|
15
|
-
* The title to display in the popover.
|
|
16
|
-
*/
|
|
17
|
-
title: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* A React component that can be used in custom editors to edit the properties of the node.
|
|
21
|
-
* Displays a simple, static key/value editing UI in a popover.
|
|
22
|
-
*/
|
|
23
|
-
export declare const PropertyPopover: React.FC<PropertyPopoverProps>;
|