@mdxeditor/editor 0.10.0 → 0.11.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/README.md +4 -3
- package/dist/FormatConstants.d.ts +9 -0
- package/dist/FormatConstants.js +10 -0
- package/dist/MDXEditor.d.ts +60 -0
- package/dist/MDXEditor.js +105 -0
- package/dist/directive-editors/AdmonitionDirectiveDescriptor.d.ts +17 -0
- package/dist/directive-editors/AdmonitionDirectiveDescriptor.js +29 -0
- package/dist/directive-editors/GenericDirectiveEditor.d.ts +8 -0
- package/dist/directive-editors/GenericDirectiveEditor.js +32 -0
- package/dist/exportMarkdownFromLexical.d.ts +114 -0
- package/dist/exportMarkdownFromLexical.js +199 -0
- package/dist/gurx/index.d.ts +3 -0
- package/dist/gurx/react.d.ts +121 -0
- package/dist/gurx/react.js +112 -0
- package/dist/gurx/realm.d.ts +133 -0
- package/dist/gurx/realm.js +491 -0
- package/dist/gurx/realmFactory.d.ts +58 -0
- package/dist/gurx/realmFactory.js +28 -0
- package/dist/icons/add_column.svg.js +8 -0
- package/dist/icons/add_photo.svg.js +8 -0
- package/dist/icons/add_row.svg.js +8 -0
- package/dist/icons/arrow_drop_down.svg.js +8 -0
- package/dist/icons/arrow_right.svg.js +8 -0
- package/dist/icons/check.svg.js +8 -0
- package/dist/icons/close.svg.js +8 -0
- package/dist/icons/code.svg.js +8 -0
- package/dist/icons/content_copy.svg.js +8 -0
- package/dist/icons/delete.svg.js +8 -0
- package/dist/icons/delete_small.svg.js +8 -0
- package/dist/icons/deployed_code.svg.js +8 -0
- package/dist/icons/difference.svg.js +8 -0
- package/dist/icons/edit.svg.js +8 -0
- package/dist/icons/emergency_home.svg.js +8 -0
- package/dist/icons/format_align_center.svg.js +8 -0
- package/dist/icons/format_align_left.svg.js +8 -0
- package/dist/icons/format_align_right.svg.js +8 -0
- package/dist/icons/format_bold.svg.js +8 -0
- package/dist/icons/format_italic.svg.js +8 -0
- package/dist/icons/format_list_bulleted.svg.js +8 -0
- package/dist/icons/format_list_numbered.svg.js +8 -0
- package/dist/icons/format_underlined.svg.js +8 -0
- package/dist/icons/frame_source.svg.js +8 -0
- package/dist/icons/frontmatter.svg.js +8 -0
- package/dist/icons/horizontal_rule.svg.js +8 -0
- package/dist/icons/insert_col_left.svg.js +8 -0
- package/dist/icons/insert_col_right.svg.js +8 -0
- package/dist/icons/insert_row_above.svg.js +8 -0
- package/dist/icons/insert_row_below.svg.js +8 -0
- package/dist/icons/link.svg.js +8 -0
- package/dist/icons/link_off.svg.js +8 -0
- package/dist/icons/markdown.svg.js +8 -0
- package/dist/icons/more_horiz.svg.js +8 -0
- package/dist/icons/open_in_new.svg.js +8 -0
- package/dist/icons/redo.svg.js +8 -0
- package/dist/icons/rich_text.svg.js +8 -0
- package/dist/icons/settings.svg.js +8 -0
- package/dist/icons/table.svg.js +8 -0
- package/dist/icons/undo.svg.js +8 -0
- package/dist/importMarkdownToLexical.d.ts +84 -0
- package/dist/importMarkdownToLexical.js +65 -0
- package/dist/index.d.ts +49 -1105
- package/dist/index.js +140 -72
- package/dist/jsx-editors/GenericJsxEditor.d.ts +8 -0
- package/dist/jsx-editors/GenericJsxEditor.js +56 -0
- package/dist/node_modules/react-diff-view/style/index.css.js +4 -0
- package/dist/plugins/codeblock/CodeBlockNode.d.ts +99 -0
- package/dist/plugins/codeblock/CodeBlockNode.js +155 -0
- package/dist/plugins/codeblock/CodeBlockVisitor.d.ts +4 -0
- package/dist/plugins/codeblock/CodeBlockVisitor.js +14 -0
- package/dist/plugins/codeblock/MdastCodeVisitor.d.ts +3 -0
- package/dist/plugins/codeblock/MdastCodeVisitor.js +16 -0
- package/dist/plugins/codeblock/index.d.ts +617 -0
- package/dist/plugins/codeblock/index.js +73 -0
- package/dist/plugins/codemirror/CodeMirrorEditor.d.ts +3 -0
- package/dist/plugins/codemirror/CodeMirrorEditor.js +33 -0
- package/dist/plugins/codemirror/index.d.ts +800 -0
- package/dist/plugins/codemirror/index.js +62 -0
- package/dist/plugins/core/LexicalLinebreakVisitor.d.ts +4 -0
- package/dist/plugins/core/LexicalLinebreakVisitor.js +10 -0
- package/dist/plugins/core/LexicalParagraphVisitor.d.ts +4 -0
- package/dist/plugins/core/LexicalParagraphVisitor.js +10 -0
- package/dist/plugins/core/LexicalRootVisitor.d.ts +4 -0
- package/dist/plugins/core/LexicalRootVisitor.js +10 -0
- package/dist/plugins/core/LexicalTextVisitor.d.ts +5 -0
- package/dist/plugins/core/LexicalTextVisitor.js +85 -0
- package/dist/plugins/core/MdastFormattingVisitor.d.ts +4 -0
- package/dist/plugins/core/MdastFormattingVisitor.js +36 -0
- package/dist/plugins/core/MdastInlineCodeVisitor.d.ts +3 -0
- package/dist/plugins/core/MdastInlineCodeVisitor.js +11 -0
- package/dist/plugins/core/MdastParagraphVisitor.d.ts +3 -0
- package/dist/plugins/core/MdastParagraphVisitor.js +15 -0
- package/dist/plugins/core/MdastRootVisitor.d.ts +3 -0
- package/dist/plugins/core/MdastRootVisitor.js +9 -0
- package/dist/plugins/core/MdastTextVisitor.d.ts +3 -0
- package/dist/plugins/core/MdastTextVisitor.js +10 -0
- package/dist/plugins/core/NestedLexicalEditor.d.ts +96 -0
- package/dist/plugins/core/NestedLexicalEditor.js +181 -0
- package/dist/plugins/core/PropertyPopover.d.ts +23 -0
- package/dist/plugins/core/PropertyPopover.js +36 -0
- package/dist/plugins/core/SharedHistoryPlugin.d.ts +2 -0
- package/dist/plugins/core/SharedHistoryPlugin.js +10 -0
- package/dist/plugins/core/index.d.ts +423 -0
- package/dist/plugins/core/index.js +346 -0
- package/dist/plugins/core/ui/PopoverUtils.d.ts +4 -0
- package/dist/plugins/core/ui/PopoverUtils.js +17 -0
- package/dist/plugins/diff-source/DiffSourceWrapper.d.ts +4 -0
- package/dist/plugins/diff-source/DiffSourceWrapper.js +11 -0
- package/dist/plugins/diff-source/DiffViewer.d.ts +2 -0
- package/dist/plugins/diff-source/DiffViewer.js +18 -0
- package/dist/plugins/diff-source/SourceEditor.d.ts +2 -0
- package/dist/plugins/diff-source/SourceEditor.js +27 -0
- package/dist/plugins/diff-source/index.d.ts +544 -0
- package/dist/plugins/diff-source/index.js +55 -0
- package/dist/plugins/directives/DirectiveNode.d.ts +51 -0
- package/dist/plugins/directives/DirectiveNode.js +92 -0
- package/dist/plugins/directives/DirectiveVisitor.d.ts +4 -0
- package/dist/plugins/directives/DirectiveVisitor.js +10 -0
- package/dist/plugins/directives/MdastDirectiveVisitor.d.ts +3 -0
- package/dist/plugins/directives/MdastDirectiveVisitor.js +13 -0
- package/dist/plugins/directives/index.d.ts +603 -0
- package/dist/plugins/directives/index.js +53 -0
- package/dist/plugins/frontmatter/FrontmatterEditor.d.ts +6 -0
- package/dist/plugins/frontmatter/FrontmatterEditor.js +69 -0
- package/dist/plugins/frontmatter/FrontmatterNode.d.ts +35 -0
- package/dist/plugins/frontmatter/FrontmatterNode.js +71 -0
- package/dist/plugins/frontmatter/LexicalFrontmatterVisitor.d.ts +4 -0
- package/dist/plugins/frontmatter/LexicalFrontmatterVisitor.js +10 -0
- package/dist/plugins/frontmatter/MdastFrontmatterVisitor.d.ts +3 -0
- package/dist/plugins/frontmatter/MdastFrontmatterVisitor.js +10 -0
- package/dist/plugins/frontmatter/index.d.ts +523 -0
- package/dist/plugins/frontmatter/index.js +53 -0
- package/dist/plugins/headings/LexicalHeadingVisitor.d.ts +4 -0
- package/dist/plugins/headings/LexicalHeadingVisitor.js +11 -0
- package/dist/plugins/headings/MdastHeadingVisitor.d.ts +3 -0
- package/dist/plugins/headings/MdastHeadingVisitor.js +10 -0
- package/dist/plugins/headings/index.d.ts +118 -0
- package/dist/plugins/headings/index.js +20 -0
- package/dist/plugins/image/ImageEditor.d.ts +9 -0
- package/dist/{ImageEditor-3725ebef.js → plugins/image/ImageEditor.js} +40 -52
- package/dist/plugins/image/ImageNode.d.ts +63 -0
- package/dist/plugins/image/ImageNode.js +136 -0
- package/dist/plugins/image/ImageResizer.d.ts +18 -0
- package/dist/plugins/image/ImageResizer.js +214 -0
- package/dist/plugins/image/LexicalImageVisitor.d.ts +4 -0
- package/dist/plugins/image/LexicalImageVisitor.js +36 -0
- package/dist/plugins/image/MdastImageVisitor.d.ts +6 -0
- package/dist/plugins/image/MdastImageVisitor.js +87 -0
- package/dist/plugins/image/index.d.ts +557 -0
- package/dist/plugins/image/index.js +246 -0
- package/dist/plugins/jsx/LexicalJsxNode.d.ts +54 -0
- package/dist/plugins/jsx/LexicalJsxNode.js +102 -0
- package/dist/plugins/jsx/LexicalJsxVisitor.d.ts +4 -0
- package/dist/plugins/jsx/LexicalJsxVisitor.js +12 -0
- package/dist/plugins/jsx/MdastMdxJsEsmVisitor.d.ts +3 -0
- package/dist/plugins/jsx/MdastMdxJsEsmVisitor.js +8 -0
- package/dist/plugins/jsx/MdastMdxJsxElementVisitor.d.ts +3 -0
- package/dist/plugins/jsx/MdastMdxJsxElementVisitor.js +12 -0
- package/dist/plugins/jsx/index.d.ts +599 -0
- package/dist/plugins/jsx/index.js +59 -0
- package/dist/plugins/link/LexicalLinkVisitor.d.ts +4 -0
- package/dist/plugins/link/LexicalLinkVisitor.js +10 -0
- package/dist/plugins/link/MdastLinkVisitor.d.ts +3 -0
- package/dist/plugins/link/MdastLinkVisitor.js +14 -0
- package/dist/plugins/link/index.d.ts +68 -0
- package/dist/plugins/link/index.js +22 -0
- package/dist/plugins/link-dialog/LinkDialog.d.ts +12 -0
- package/dist/plugins/link-dialog/LinkDialog.js +174 -0
- package/dist/plugins/link-dialog/index.d.ts +508 -0
- package/dist/plugins/link-dialog/index.js +242 -0
- package/dist/plugins/lists/LexicalListItemVisitor.d.ts +4 -0
- package/dist/plugins/lists/LexicalListItemVisitor.js +22 -0
- package/dist/plugins/lists/LexicalListVisitor.d.ts +4 -0
- package/dist/plugins/lists/LexicalListVisitor.js +13 -0
- package/dist/plugins/lists/MdastListItemVisitor.d.ts +3 -0
- package/dist/plugins/lists/MdastListItemVisitor.js +10 -0
- package/dist/plugins/lists/MdastListVisitor.d.ts +3 -0
- package/dist/plugins/lists/MdastListVisitor.js +18 -0
- package/dist/plugins/lists/index.d.ts +533 -0
- package/dist/plugins/lists/index.js +111 -0
- package/dist/plugins/markdown-shortcut/index.d.ts +63 -0
- package/dist/plugins/markdown-shortcut/index.js +34 -0
- package/dist/plugins/quote/LexicalQuoteVisitor.d.ts +4 -0
- package/dist/plugins/quote/LexicalQuoteVisitor.js +12 -0
- package/dist/plugins/quote/MdastBlockQuoteVisitor.d.ts +3 -0
- package/dist/plugins/quote/MdastBlockQuoteVisitor.js +10 -0
- package/dist/plugins/quote/index.d.ts +361 -0
- package/dist/plugins/quote/index.js +26 -0
- package/dist/plugins/sandpack/SandpackEditor.d.ts +7 -0
- package/dist/plugins/sandpack/SandpackEditor.js +35 -0
- package/dist/plugins/sandpack/index.d.ts +839 -0
- package/dist/plugins/sandpack/index.js +93 -0
- package/dist/plugins/sandpack/useCodeMirrorRef.d.ts +4 -0
- package/dist/{useCodeMirrorRef-0def7994.js → plugins/sandpack/useCodeMirrorRef.js} +22 -10
- package/dist/plugins/table/LexicalTableVisitor.d.ts +4 -0
- package/dist/plugins/table/LexicalTableVisitor.js +10 -0
- package/dist/plugins/table/MdastTableVisitor.d.ts +3 -0
- package/dist/plugins/table/MdastTableVisitor.js +10 -0
- package/dist/plugins/table/TableEditor.d.ts +21 -0
- package/dist/plugins/table/TableEditor.js +384 -0
- package/dist/plugins/table/TableNode.d.ts +52 -0
- package/dist/plugins/table/TableNode.js +147 -0
- package/dist/plugins/table/index.d.ts +523 -0
- package/dist/plugins/table/index.js +59 -0
- package/dist/plugins/thematic-break/LexicalThematicBreakVisitor.d.ts +4 -0
- package/dist/plugins/thematic-break/LexicalThematicBreakVisitor.js +10 -0
- package/dist/plugins/thematic-break/MdastThematicBreakVisitor.d.ts +3 -0
- package/dist/plugins/thematic-break/MdastThematicBreakVisitor.js +10 -0
- package/dist/plugins/thematic-break/index.d.ts +523 -0
- package/dist/plugins/thematic-break/index.js +39 -0
- package/dist/plugins/toolbar/components/BlockTypeSelect.d.ts +6 -0
- package/dist/plugins/toolbar/components/BlockTypeSelect.js +52 -0
- package/dist/plugins/toolbar/components/BoldItalicUnderlineToggles.d.ts +5 -0
- package/dist/plugins/toolbar/components/BoldItalicUnderlineToggles.js +35 -0
- package/dist/plugins/toolbar/components/ChangeAdmonitionType.d.ts +6 -0
- package/dist/plugins/toolbar/components/ChangeAdmonitionType.js +30 -0
- package/dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.d.ts +7 -0
- package/dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.js +32 -0
- package/dist/plugins/toolbar/components/CodeToggle.d.ts +6 -0
- package/dist/plugins/toolbar/components/CodeToggle.js +20 -0
- package/dist/plugins/toolbar/components/CreateLink.d.ts +6 -0
- package/dist/plugins/toolbar/components/CreateLink.js +11 -0
- package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.d.ts +18 -0
- package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.js +27 -0
- package/dist/plugins/toolbar/components/InsertAdmonition.d.ts +6 -0
- package/dist/plugins/toolbar/components/InsertAdmonition.js +29 -0
- package/dist/plugins/toolbar/components/InsertCodeBlock.d.ts +7 -0
- package/dist/plugins/toolbar/components/InsertCodeBlock.js +20 -0
- package/dist/plugins/toolbar/components/InsertFrontmatter.d.ts +6 -0
- package/dist/plugins/toolbar/components/InsertFrontmatter.js +11 -0
- package/dist/plugins/toolbar/components/InsertImage.d.ts +6 -0
- package/dist/plugins/toolbar/components/InsertImage.js +23 -0
- package/dist/plugins/toolbar/components/InsertSandpack.d.ts +6 -0
- package/dist/plugins/toolbar/components/InsertSandpack.js +13 -0
- package/dist/plugins/toolbar/components/InsertTable.d.ts +6 -0
- package/dist/plugins/toolbar/components/InsertTable.js +20 -0
- package/dist/plugins/toolbar/components/InsertThematicBreak.d.ts +6 -0
- package/dist/plugins/toolbar/components/InsertThematicBreak.js +11 -0
- package/dist/plugins/toolbar/components/KitchenSinkToolbar.d.ts +7 -0
- package/dist/plugins/toolbar/components/KitchenSinkToolbar.js +58 -0
- package/dist/plugins/toolbar/components/ListsToggle.d.ts +7 -0
- package/dist/plugins/toolbar/components/ListsToggle.js +23 -0
- package/dist/plugins/toolbar/components/ShowSandpackInfo.d.ts +7 -0
- package/dist/plugins/toolbar/components/ShowSandpackInfo.js +32 -0
- package/dist/plugins/toolbar/components/UndoRedo.d.ts +5 -0
- package/dist/plugins/toolbar/components/UndoRedo.js +59 -0
- package/dist/plugins/toolbar/index.d.ts +428 -0
- package/dist/plugins/toolbar/index.js +39 -0
- package/dist/plugins/toolbar/primitives/DialogButton.d.ts +40 -0
- package/dist/plugins/toolbar/primitives/DialogButton.js +115 -0
- package/dist/plugins/toolbar/primitives/TooltipWrap.d.ts +8 -0
- package/dist/plugins/toolbar/primitives/TooltipWrap.js +12 -0
- package/dist/plugins/toolbar/primitives/select.d.ts +50 -0
- package/dist/plugins/toolbar/primitives/select.js +44 -0
- package/dist/plugins/toolbar/primitives/toolbar.d.ts +160 -0
- package/dist/plugins/toolbar/primitives/toolbar.js +111 -0
- package/dist/style.css +556 -249
- package/dist/styles/globals.css.js +4 -0
- package/dist/styles/lexical-theme.module.css.js +53 -0
- package/dist/styles/lexicalTheme.d.ts +2 -0
- package/dist/styles/lexicalTheme.js +28 -0
- package/dist/styles/ui.module.css.js +254 -0
- package/dist/utils/detectMac.d.ts +2 -0
- package/dist/utils/detectMac.js +6 -0
- package/dist/utils/fp.d.ts +47 -0
- package/dist/utils/fp.js +10 -0
- package/dist/utils/isPartOftheEditorUI.d.ts +1 -0
- package/dist/utils/isPartOftheEditorUI.js +12 -0
- package/dist/utils/lexicalHelpers.d.ts +11 -0
- package/dist/utils/lexicalHelpers.js +49 -0
- package/dist/utils/uuid4.d.ts +1 -0
- package/dist/utils/uuid4.js +10 -0
- package/dist/utils/voidEmitter.d.ts +14 -0
- package/dist/utils/voidEmitter.js +15 -0
- package/package.json +246 -14
- package/dist/CodeBlockEditor-6488d3ea.cjs +0 -1
- package/dist/CodeBlockEditor-884743e8.js +0 -79
- package/dist/FrontmatterEditor-435d0430.js +0 -118
- package/dist/FrontmatterEditor-95b69d31.cjs +0 -1
- package/dist/ImageEditor-43997418.cjs +0 -1
- package/dist/JsxEditor-1b8aa6c6.cjs +0 -1
- package/dist/JsxEditor-b2e4afc2.js +0 -108
- package/dist/LeafDirectiveEditor-792cbb83.js +0 -59
- package/dist/LeafDirectiveEditor-c0daefa4.cjs +0 -1
- package/dist/SandpackEditor-56a51f80.js +0 -100
- package/dist/SandpackEditor-a09311db.cjs +0 -1
- package/dist/SourceEditor-1fc83319.cjs +0 -1
- package/dist/SourceEditor-32f2b4d8.js +0 -64
- package/dist/TableEditor-616848bc.cjs +0 -1
- package/dist/TableEditor-777ac58a.js +0 -426
- package/dist/index-51585eed.cjs +0 -1
- package/dist/index-d34aa66b.js +0 -4361
- package/dist/index.cjs +0 -1
- package/dist/useCodeMirrorRef-8f68c999.cjs +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { LexicalVisitor } from '../../exportMarkdownFromLexical';
|
|
2
|
+
import type { Options } from 'mdast-util-to-markdown';
|
|
3
|
+
import type { Config } from 'mdast-util-from-markdown/lib';
|
|
4
|
+
import type { Extension } from 'micromark-util-types';
|
|
5
|
+
import type { Content } from 'mdast';
|
|
6
|
+
import type { MdastImportVisitor } from '../../importMarkdownToLexical';
|
|
7
|
+
import type { EditorSubscription, EditorInFocus, BlockType } from '../core';
|
|
8
|
+
import type { InitialEditorStateType } from '@lexical/react/LexicalComposer';
|
|
9
|
+
import type { JsxComponentDescriptor } from '../jsx';
|
|
10
|
+
import type { HistoryState } from '@lexical/history';
|
|
11
|
+
import type { LexicalEditor, RangeSelection, Klass, LexicalNode, TextFormatType, ElementNode, DecoratorNode } from 'lexical';
|
|
12
|
+
import type { PluginConstructor, SystemSpec, Realm, RealmNode } from '../../gurx';
|
|
13
|
+
import React from 'react';
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const markdownShortcutPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
16
|
+
activeEditor: RealmNode<LexicalEditor | null>;
|
|
17
|
+
inFocus: RealmNode<boolean>;
|
|
18
|
+
historyState: RealmNode<HistoryState>;
|
|
19
|
+
currentSelection: RealmNode<RangeSelection | null>;
|
|
20
|
+
jsxIsAvailable: RealmNode<boolean>;
|
|
21
|
+
jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
|
|
22
|
+
initialRootEditorState: RealmNode<InitialEditorStateType>;
|
|
23
|
+
rootEditor: RealmNode<LexicalEditor | null>;
|
|
24
|
+
createRootEditorSubscription: RealmNode<EditorSubscription>;
|
|
25
|
+
createActiveEditorSubscription: RealmNode<EditorSubscription>;
|
|
26
|
+
importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
|
|
27
|
+
syntaxExtensions: RealmNode<Extension[]>;
|
|
28
|
+
mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
|
|
29
|
+
usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
|
|
30
|
+
addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
|
|
31
|
+
addLexicalNode: RealmNode<Klass<LexicalNode>>;
|
|
32
|
+
addSyntaxExtension: RealmNode<Extension>;
|
|
33
|
+
addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
|
|
34
|
+
toMarkdownExtensions: RealmNode<Options[]>;
|
|
35
|
+
toMarkdownOptions: RealmNode<Options>;
|
|
36
|
+
addToMarkdownExtension: RealmNode<Options>;
|
|
37
|
+
addExportVisitor: RealmNode<LexicalVisitor>;
|
|
38
|
+
exportVisitors: RealmNode<LexicalVisitor[]>;
|
|
39
|
+
initialMarkdown: RealmNode<string>;
|
|
40
|
+
setMarkdown: RealmNode<string>;
|
|
41
|
+
markdown: RealmNode<string>;
|
|
42
|
+
editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
|
|
43
|
+
contentEditableClassName: RealmNode<string>;
|
|
44
|
+
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
45
|
+
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
46
|
+
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
47
|
+
addTopAreaChild: RealmNode<React.ComponentType<{}>>;
|
|
48
|
+
nestedEditorChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
49
|
+
addNestedEditorChild: RealmNode<React.ComponentType<{}>>;
|
|
50
|
+
editorWrappers: RealmNode<React.ComponentType<{
|
|
51
|
+
children: React.ReactNode;
|
|
52
|
+
}>[]>;
|
|
53
|
+
addEditorWrapper: RealmNode<React.ComponentType<{
|
|
54
|
+
children: React.ReactNode;
|
|
55
|
+
}>>;
|
|
56
|
+
currentFormat: RealmNode<number>;
|
|
57
|
+
editorInFocus: RealmNode<EditorInFocus | null>;
|
|
58
|
+
applyFormat: RealmNode<TextFormatType>;
|
|
59
|
+
currentBlockType: RealmNode<BlockType>;
|
|
60
|
+
applyBlockType: RealmNode<BlockType>;
|
|
61
|
+
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
62
|
+
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
63
|
+
}>], (_: Realm) => {}>, object>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CODE, TRANSFORMERS } from "@lexical/markdown";
|
|
2
|
+
import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin";
|
|
3
|
+
import React__default from "react";
|
|
4
|
+
import { CodeBlockNode, $createCodeBlockNode } from "../codeblock/CodeBlockNode.js";
|
|
5
|
+
import { coreSystem } from "../core/index.js";
|
|
6
|
+
import { realmPlugin } from "../../gurx/react.js";
|
|
7
|
+
import { system } from "../../gurx/realmFactory.js";
|
|
8
|
+
function patchMarkdownTransformers(transformers) {
|
|
9
|
+
const transformersCopy = [...transformers];
|
|
10
|
+
const codeTransformer = transformersCopy.find((t) => t === CODE);
|
|
11
|
+
const codeTransformerCopy = {
|
|
12
|
+
...codeTransformer,
|
|
13
|
+
dependencies: [CodeBlockNode],
|
|
14
|
+
replace: (parentNode, _children, match) => {
|
|
15
|
+
const codeBlockNode = $createCodeBlockNode({ code: "", language: match ? match[1] : "", meta: "" });
|
|
16
|
+
parentNode.replace(codeBlockNode);
|
|
17
|
+
setTimeout(() => codeBlockNode.select(), 80);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
transformersCopy.splice(transformersCopy.indexOf(codeTransformer), 1, codeTransformerCopy);
|
|
21
|
+
return transformersCopy;
|
|
22
|
+
}
|
|
23
|
+
const [markdownShortcutPlugin] = realmPlugin({
|
|
24
|
+
id: "markdown-shortcut",
|
|
25
|
+
dependencies: ["lists", "headings", "codeblock", "quote"],
|
|
26
|
+
systemSpec: system((_) => ({}), [coreSystem]),
|
|
27
|
+
init: (realm) => {
|
|
28
|
+
realm.pubKey("addComposerChild", () => /* @__PURE__ */ React__default.createElement(MarkdownShortcutPlugin, { transformers: patchMarkdownTransformers(TRANSFORMERS) }));
|
|
29
|
+
realm.pubKey("addNestedEditorChild", () => /* @__PURE__ */ React__default.createElement(MarkdownShortcutPlugin, { transformers: patchMarkdownTransformers(TRANSFORMERS) }));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
markdownShortcutPlugin
|
|
34
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { $isQuoteNode } from "@lexical/rich-text";
|
|
2
|
+
const LexicalQuoteVisitor = {
|
|
3
|
+
testLexicalNode: $isQuoteNode,
|
|
4
|
+
visitLexicalNode: ({ lexicalNode, mdastParent, actions }) => {
|
|
5
|
+
const paragraph = { type: "paragraph", children: [] };
|
|
6
|
+
actions.appendToParent(mdastParent, { type: "blockquote", children: [paragraph] });
|
|
7
|
+
actions.visitChildren(lexicalNode, paragraph);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
LexicalQuoteVisitor
|
|
12
|
+
};
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import type { RefObject, ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { LexicalVisitor } from '../../exportMarkdownFromLexical';
|
|
3
|
+
import type { Options } from 'mdast-util-to-markdown';
|
|
4
|
+
import type { Config } from 'mdast-util-from-markdown/lib';
|
|
5
|
+
import type { Extension } from 'micromark-util-types';
|
|
6
|
+
import type { Content } from 'mdast';
|
|
7
|
+
import type { MdastImportVisitor } from '../../importMarkdownToLexical';
|
|
8
|
+
import type { EditorSubscription, EditorInFocus, BlockType } from '../core';
|
|
9
|
+
import type { InitialEditorStateType } from '@lexical/react/LexicalComposer';
|
|
10
|
+
import type { JsxComponentDescriptor } from '../jsx';
|
|
11
|
+
import type { HistoryState } from '@lexical/history';
|
|
12
|
+
import type { LexicalEditor, RangeSelection, Klass, LexicalNode, TextFormatType, ElementNode, DecoratorNode } from 'lexical';
|
|
13
|
+
import type { PluginConstructor, SystemSpec, Realm, RealmNode, TypedRealm, ValueForKey, SystemKeys, ValuesForKeys, SystemDict } from '../../gurx';
|
|
14
|
+
/// <reference types="react" />
|
|
15
|
+
export declare const
|
|
16
|
+
/** @internal */
|
|
17
|
+
quotePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
18
|
+
activeEditor: RealmNode<LexicalEditor | null>;
|
|
19
|
+
inFocus: RealmNode<boolean>;
|
|
20
|
+
historyState: RealmNode<HistoryState>;
|
|
21
|
+
currentSelection: RealmNode<RangeSelection | null>;
|
|
22
|
+
jsxIsAvailable: RealmNode<boolean>;
|
|
23
|
+
jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
|
|
24
|
+
initialRootEditorState: RealmNode<InitialEditorStateType>;
|
|
25
|
+
rootEditor: RealmNode<LexicalEditor | null>;
|
|
26
|
+
createRootEditorSubscription: RealmNode<EditorSubscription>;
|
|
27
|
+
createActiveEditorSubscription: RealmNode<EditorSubscription>;
|
|
28
|
+
importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
|
|
29
|
+
syntaxExtensions: RealmNode<Extension[]>;
|
|
30
|
+
mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
|
|
31
|
+
usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
|
|
32
|
+
addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
|
|
33
|
+
addLexicalNode: RealmNode<Klass<LexicalNode>>;
|
|
34
|
+
addSyntaxExtension: RealmNode<Extension>;
|
|
35
|
+
addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
|
|
36
|
+
toMarkdownExtensions: RealmNode<Options[]>;
|
|
37
|
+
toMarkdownOptions: RealmNode<Options>;
|
|
38
|
+
addToMarkdownExtension: RealmNode<Options>;
|
|
39
|
+
addExportVisitor: RealmNode<LexicalVisitor>;
|
|
40
|
+
exportVisitors: RealmNode<LexicalVisitor[]>;
|
|
41
|
+
initialMarkdown: RealmNode<string>;
|
|
42
|
+
setMarkdown: RealmNode<string>;
|
|
43
|
+
markdown: RealmNode<string>;
|
|
44
|
+
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
45
|
+
contentEditableClassName: RealmNode<string>;
|
|
46
|
+
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
47
|
+
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
48
|
+
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
49
|
+
addTopAreaChild: RealmNode<ComponentType<{}>>;
|
|
50
|
+
nestedEditorChildren: RealmNode<ComponentType<{}>[]>;
|
|
51
|
+
addNestedEditorChild: RealmNode<ComponentType<{}>>;
|
|
52
|
+
editorWrappers: RealmNode<ComponentType<{
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
}>[]>;
|
|
55
|
+
addEditorWrapper: RealmNode<ComponentType<{
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
}>>;
|
|
58
|
+
currentFormat: RealmNode<number>;
|
|
59
|
+
editorInFocus: RealmNode<EditorInFocus | null>;
|
|
60
|
+
applyFormat: RealmNode<TextFormatType>;
|
|
61
|
+
currentBlockType: RealmNode<BlockType>;
|
|
62
|
+
applyBlockType: RealmNode<BlockType>;
|
|
63
|
+
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
64
|
+
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
65
|
+
}>], () => {}>, object>,
|
|
66
|
+
/** @internal */
|
|
67
|
+
quotePluginHooks: {
|
|
68
|
+
useRealmContext: () => TypedRealm<{
|
|
69
|
+
activeEditor: RealmNode<LexicalEditor | null>;
|
|
70
|
+
inFocus: RealmNode<boolean>;
|
|
71
|
+
historyState: RealmNode<HistoryState>;
|
|
72
|
+
currentSelection: RealmNode<RangeSelection | null>;
|
|
73
|
+
jsxIsAvailable: RealmNode<boolean>;
|
|
74
|
+
jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
|
|
75
|
+
initialRootEditorState: RealmNode<InitialEditorStateType>;
|
|
76
|
+
rootEditor: RealmNode<LexicalEditor | null>;
|
|
77
|
+
createRootEditorSubscription: RealmNode<EditorSubscription>;
|
|
78
|
+
createActiveEditorSubscription: RealmNode<EditorSubscription>;
|
|
79
|
+
importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
|
|
80
|
+
syntaxExtensions: RealmNode<Extension[]>;
|
|
81
|
+
mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
|
|
82
|
+
usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
|
|
83
|
+
addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
|
|
84
|
+
addLexicalNode: RealmNode<Klass<LexicalNode>>;
|
|
85
|
+
addSyntaxExtension: RealmNode<Extension>;
|
|
86
|
+
addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
|
|
87
|
+
toMarkdownExtensions: RealmNode<Options[]>;
|
|
88
|
+
toMarkdownOptions: RealmNode<Options>;
|
|
89
|
+
addToMarkdownExtension: RealmNode<Options>;
|
|
90
|
+
addExportVisitor: RealmNode<LexicalVisitor>;
|
|
91
|
+
exportVisitors: RealmNode<LexicalVisitor[]>;
|
|
92
|
+
initialMarkdown: RealmNode<string>;
|
|
93
|
+
setMarkdown: RealmNode<string>;
|
|
94
|
+
markdown: RealmNode<string>;
|
|
95
|
+
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
96
|
+
contentEditableClassName: RealmNode<string>;
|
|
97
|
+
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
98
|
+
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
99
|
+
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
100
|
+
addTopAreaChild: RealmNode<ComponentType<{}>>;
|
|
101
|
+
nestedEditorChildren: RealmNode<ComponentType<{}>[]>;
|
|
102
|
+
addNestedEditorChild: RealmNode<ComponentType<{}>>;
|
|
103
|
+
editorWrappers: RealmNode<ComponentType<{
|
|
104
|
+
children: ReactNode;
|
|
105
|
+
}>[]>;
|
|
106
|
+
addEditorWrapper: RealmNode<ComponentType<{
|
|
107
|
+
children: ReactNode;
|
|
108
|
+
}>>;
|
|
109
|
+
currentFormat: RealmNode<number>;
|
|
110
|
+
editorInFocus: RealmNode<EditorInFocus | null>;
|
|
111
|
+
applyFormat: RealmNode<TextFormatType>;
|
|
112
|
+
currentBlockType: RealmNode<BlockType>;
|
|
113
|
+
applyBlockType: RealmNode<BlockType>;
|
|
114
|
+
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
115
|
+
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
116
|
+
}>;
|
|
117
|
+
useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode">(key: K, callback: (value: ValueForKey<{
|
|
118
|
+
activeEditor: RealmNode<LexicalEditor | null>;
|
|
119
|
+
inFocus: RealmNode<boolean>;
|
|
120
|
+
historyState: RealmNode<HistoryState>;
|
|
121
|
+
currentSelection: RealmNode<RangeSelection | null>;
|
|
122
|
+
jsxIsAvailable: RealmNode<boolean>;
|
|
123
|
+
jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
|
|
124
|
+
initialRootEditorState: RealmNode<InitialEditorStateType>;
|
|
125
|
+
rootEditor: RealmNode<LexicalEditor | null>;
|
|
126
|
+
createRootEditorSubscription: RealmNode<EditorSubscription>;
|
|
127
|
+
createActiveEditorSubscription: RealmNode<EditorSubscription>;
|
|
128
|
+
importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
|
|
129
|
+
syntaxExtensions: RealmNode<Extension[]>;
|
|
130
|
+
mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
|
|
131
|
+
usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
|
|
132
|
+
addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
|
|
133
|
+
addLexicalNode: RealmNode<Klass<LexicalNode>>;
|
|
134
|
+
addSyntaxExtension: RealmNode<Extension>;
|
|
135
|
+
addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
|
|
136
|
+
toMarkdownExtensions: RealmNode<Options[]>;
|
|
137
|
+
toMarkdownOptions: RealmNode<Options>;
|
|
138
|
+
addToMarkdownExtension: RealmNode<Options>;
|
|
139
|
+
addExportVisitor: RealmNode<LexicalVisitor>;
|
|
140
|
+
exportVisitors: RealmNode<LexicalVisitor[]>;
|
|
141
|
+
initialMarkdown: RealmNode<string>;
|
|
142
|
+
setMarkdown: RealmNode<string>;
|
|
143
|
+
markdown: RealmNode<string>;
|
|
144
|
+
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
145
|
+
contentEditableClassName: RealmNode<string>;
|
|
146
|
+
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
147
|
+
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
148
|
+
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
149
|
+
addTopAreaChild: RealmNode<ComponentType<{}>>;
|
|
150
|
+
nestedEditorChildren: RealmNode<ComponentType<{}>[]>;
|
|
151
|
+
addNestedEditorChild: RealmNode<ComponentType<{}>>;
|
|
152
|
+
editorWrappers: RealmNode<ComponentType<{
|
|
153
|
+
children: ReactNode;
|
|
154
|
+
}>[]>;
|
|
155
|
+
addEditorWrapper: RealmNode<ComponentType<{
|
|
156
|
+
children: ReactNode;
|
|
157
|
+
}>>;
|
|
158
|
+
currentFormat: RealmNode<number>;
|
|
159
|
+
editorInFocus: RealmNode<EditorInFocus | null>;
|
|
160
|
+
applyFormat: RealmNode<TextFormatType>;
|
|
161
|
+
currentBlockType: RealmNode<BlockType>;
|
|
162
|
+
applyBlockType: RealmNode<BlockType>;
|
|
163
|
+
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
164
|
+
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
165
|
+
}, K>) => void) => void;
|
|
166
|
+
useEmitterValues: <K_1 extends SystemKeys<{
|
|
167
|
+
activeEditor: RealmNode<LexicalEditor | null>;
|
|
168
|
+
inFocus: RealmNode<boolean>;
|
|
169
|
+
historyState: RealmNode<HistoryState>;
|
|
170
|
+
currentSelection: RealmNode<RangeSelection | null>;
|
|
171
|
+
jsxIsAvailable: RealmNode<boolean>;
|
|
172
|
+
jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
|
|
173
|
+
initialRootEditorState: RealmNode<InitialEditorStateType>;
|
|
174
|
+
rootEditor: RealmNode<LexicalEditor | null>;
|
|
175
|
+
createRootEditorSubscription: RealmNode<EditorSubscription>;
|
|
176
|
+
createActiveEditorSubscription: RealmNode<EditorSubscription>;
|
|
177
|
+
importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
|
|
178
|
+
syntaxExtensions: RealmNode<Extension[]>;
|
|
179
|
+
mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
|
|
180
|
+
usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
|
|
181
|
+
addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
|
|
182
|
+
addLexicalNode: RealmNode<Klass<LexicalNode>>;
|
|
183
|
+
addSyntaxExtension: RealmNode<Extension>;
|
|
184
|
+
addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
|
|
185
|
+
toMarkdownExtensions: RealmNode<Options[]>;
|
|
186
|
+
toMarkdownOptions: RealmNode<Options>;
|
|
187
|
+
addToMarkdownExtension: RealmNode<Options>;
|
|
188
|
+
addExportVisitor: RealmNode<LexicalVisitor>;
|
|
189
|
+
exportVisitors: RealmNode<LexicalVisitor[]>;
|
|
190
|
+
initialMarkdown: RealmNode<string>;
|
|
191
|
+
setMarkdown: RealmNode<string>;
|
|
192
|
+
markdown: RealmNode<string>;
|
|
193
|
+
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
194
|
+
contentEditableClassName: RealmNode<string>;
|
|
195
|
+
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
196
|
+
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
197
|
+
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
198
|
+
addTopAreaChild: RealmNode<ComponentType<{}>>;
|
|
199
|
+
nestedEditorChildren: RealmNode<ComponentType<{}>[]>;
|
|
200
|
+
addNestedEditorChild: RealmNode<ComponentType<{}>>;
|
|
201
|
+
editorWrappers: RealmNode<ComponentType<{
|
|
202
|
+
children: ReactNode;
|
|
203
|
+
}>[]>;
|
|
204
|
+
addEditorWrapper: RealmNode<ComponentType<{
|
|
205
|
+
children: ReactNode;
|
|
206
|
+
}>>;
|
|
207
|
+
currentFormat: RealmNode<number>;
|
|
208
|
+
editorInFocus: RealmNode<EditorInFocus | null>;
|
|
209
|
+
applyFormat: RealmNode<TextFormatType>;
|
|
210
|
+
currentBlockType: RealmNode<BlockType>;
|
|
211
|
+
applyBlockType: RealmNode<BlockType>;
|
|
212
|
+
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
213
|
+
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
214
|
+
}>>(...keys: K_1) => ValuesForKeys<{
|
|
215
|
+
activeEditor: RealmNode<LexicalEditor | null>;
|
|
216
|
+
inFocus: RealmNode<boolean>;
|
|
217
|
+
historyState: RealmNode<HistoryState>;
|
|
218
|
+
currentSelection: RealmNode<RangeSelection | null>;
|
|
219
|
+
jsxIsAvailable: RealmNode<boolean>;
|
|
220
|
+
jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
|
|
221
|
+
initialRootEditorState: RealmNode<InitialEditorStateType>;
|
|
222
|
+
rootEditor: RealmNode<LexicalEditor | null>;
|
|
223
|
+
createRootEditorSubscription: RealmNode<EditorSubscription>;
|
|
224
|
+
createActiveEditorSubscription: RealmNode<EditorSubscription>;
|
|
225
|
+
importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
|
|
226
|
+
syntaxExtensions: RealmNode<Extension[]>;
|
|
227
|
+
mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
|
|
228
|
+
usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
|
|
229
|
+
addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
|
|
230
|
+
addLexicalNode: RealmNode<Klass<LexicalNode>>;
|
|
231
|
+
addSyntaxExtension: RealmNode<Extension>;
|
|
232
|
+
addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
|
|
233
|
+
toMarkdownExtensions: RealmNode<Options[]>;
|
|
234
|
+
toMarkdownOptions: RealmNode<Options>;
|
|
235
|
+
addToMarkdownExtension: RealmNode<Options>;
|
|
236
|
+
addExportVisitor: RealmNode<LexicalVisitor>;
|
|
237
|
+
exportVisitors: RealmNode<LexicalVisitor[]>;
|
|
238
|
+
initialMarkdown: RealmNode<string>;
|
|
239
|
+
setMarkdown: RealmNode<string>;
|
|
240
|
+
markdown: RealmNode<string>;
|
|
241
|
+
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
242
|
+
contentEditableClassName: RealmNode<string>;
|
|
243
|
+
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
244
|
+
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
245
|
+
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
246
|
+
addTopAreaChild: RealmNode<ComponentType<{}>>;
|
|
247
|
+
nestedEditorChildren: RealmNode<ComponentType<{}>[]>;
|
|
248
|
+
addNestedEditorChild: RealmNode<ComponentType<{}>>;
|
|
249
|
+
editorWrappers: RealmNode<ComponentType<{
|
|
250
|
+
children: ReactNode;
|
|
251
|
+
}>[]>;
|
|
252
|
+
addEditorWrapper: RealmNode<ComponentType<{
|
|
253
|
+
children: ReactNode;
|
|
254
|
+
}>>;
|
|
255
|
+
currentFormat: RealmNode<number>;
|
|
256
|
+
editorInFocus: RealmNode<EditorInFocus | null>;
|
|
257
|
+
applyFormat: RealmNode<TextFormatType>;
|
|
258
|
+
currentBlockType: RealmNode<BlockType>;
|
|
259
|
+
applyBlockType: RealmNode<BlockType>;
|
|
260
|
+
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
261
|
+
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
262
|
+
}, K_1>;
|
|
263
|
+
usePubKeys: () => (values: SystemDict<{
|
|
264
|
+
activeEditor: RealmNode<LexicalEditor | null>;
|
|
265
|
+
inFocus: RealmNode<boolean>;
|
|
266
|
+
historyState: RealmNode<HistoryState>;
|
|
267
|
+
currentSelection: RealmNode<RangeSelection | null>;
|
|
268
|
+
jsxIsAvailable: RealmNode<boolean>;
|
|
269
|
+
jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
|
|
270
|
+
initialRootEditorState: RealmNode<InitialEditorStateType>;
|
|
271
|
+
rootEditor: RealmNode<LexicalEditor | null>;
|
|
272
|
+
createRootEditorSubscription: RealmNode<EditorSubscription>;
|
|
273
|
+
createActiveEditorSubscription: RealmNode<EditorSubscription>;
|
|
274
|
+
importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
|
|
275
|
+
syntaxExtensions: RealmNode<Extension[]>;
|
|
276
|
+
mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
|
|
277
|
+
usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
|
|
278
|
+
addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
|
|
279
|
+
addLexicalNode: RealmNode<Klass<LexicalNode>>;
|
|
280
|
+
addSyntaxExtension: RealmNode<Extension>;
|
|
281
|
+
addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
|
|
282
|
+
toMarkdownExtensions: RealmNode<Options[]>;
|
|
283
|
+
toMarkdownOptions: RealmNode<Options>;
|
|
284
|
+
addToMarkdownExtension: RealmNode<Options>;
|
|
285
|
+
addExportVisitor: RealmNode<LexicalVisitor>;
|
|
286
|
+
exportVisitors: RealmNode<LexicalVisitor[]>;
|
|
287
|
+
initialMarkdown: RealmNode<string>;
|
|
288
|
+
setMarkdown: RealmNode<string>;
|
|
289
|
+
markdown: RealmNode<string>;
|
|
290
|
+
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
291
|
+
contentEditableClassName: RealmNode<string>;
|
|
292
|
+
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
293
|
+
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
294
|
+
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
295
|
+
addTopAreaChild: RealmNode<ComponentType<{}>>;
|
|
296
|
+
nestedEditorChildren: RealmNode<ComponentType<{}>[]>;
|
|
297
|
+
addNestedEditorChild: RealmNode<ComponentType<{}>>;
|
|
298
|
+
editorWrappers: RealmNode<ComponentType<{
|
|
299
|
+
children: ReactNode;
|
|
300
|
+
}>[]>;
|
|
301
|
+
addEditorWrapper: RealmNode<ComponentType<{
|
|
302
|
+
children: ReactNode;
|
|
303
|
+
}>>;
|
|
304
|
+
currentFormat: RealmNode<number>;
|
|
305
|
+
editorInFocus: RealmNode<EditorInFocus | null>;
|
|
306
|
+
applyFormat: RealmNode<TextFormatType>;
|
|
307
|
+
currentBlockType: RealmNode<BlockType>;
|
|
308
|
+
applyBlockType: RealmNode<BlockType>;
|
|
309
|
+
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
310
|
+
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
311
|
+
}>) => void;
|
|
312
|
+
usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode">(key: K_2) => (value: ValueForKey<{
|
|
313
|
+
activeEditor: RealmNode<LexicalEditor | null>;
|
|
314
|
+
inFocus: RealmNode<boolean>;
|
|
315
|
+
historyState: RealmNode<HistoryState>;
|
|
316
|
+
currentSelection: RealmNode<RangeSelection | null>;
|
|
317
|
+
jsxIsAvailable: RealmNode<boolean>;
|
|
318
|
+
jsxComponentDescriptors: RealmNode<JsxComponentDescriptor[]>;
|
|
319
|
+
initialRootEditorState: RealmNode<InitialEditorStateType>;
|
|
320
|
+
rootEditor: RealmNode<LexicalEditor | null>;
|
|
321
|
+
createRootEditorSubscription: RealmNode<EditorSubscription>;
|
|
322
|
+
createActiveEditorSubscription: RealmNode<EditorSubscription>;
|
|
323
|
+
importVisitors: RealmNode<MdastImportVisitor<Content>[]>;
|
|
324
|
+
syntaxExtensions: RealmNode<Extension[]>;
|
|
325
|
+
mdastExtensions: RealmNode<(Partial<Config> | Partial<Config>[])[] | null | undefined>;
|
|
326
|
+
usedLexicalNodes: RealmNode<Klass<LexicalNode>[]>;
|
|
327
|
+
addImportVisitor: RealmNode<MdastImportVisitor<Content>>;
|
|
328
|
+
addLexicalNode: RealmNode<Klass<LexicalNode>>;
|
|
329
|
+
addSyntaxExtension: RealmNode<Extension>;
|
|
330
|
+
addMdastExtension: RealmNode<Partial<Config> | Partial<Config>[]>;
|
|
331
|
+
toMarkdownExtensions: RealmNode<Options[]>;
|
|
332
|
+
toMarkdownOptions: RealmNode<Options>;
|
|
333
|
+
addToMarkdownExtension: RealmNode<Options>;
|
|
334
|
+
addExportVisitor: RealmNode<LexicalVisitor>;
|
|
335
|
+
exportVisitors: RealmNode<LexicalVisitor[]>;
|
|
336
|
+
initialMarkdown: RealmNode<string>;
|
|
337
|
+
setMarkdown: RealmNode<string>;
|
|
338
|
+
markdown: RealmNode<string>;
|
|
339
|
+
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
340
|
+
contentEditableClassName: RealmNode<string>;
|
|
341
|
+
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
342
|
+
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
343
|
+
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
344
|
+
addTopAreaChild: RealmNode<ComponentType<{}>>;
|
|
345
|
+
nestedEditorChildren: RealmNode<ComponentType<{}>[]>;
|
|
346
|
+
addNestedEditorChild: RealmNode<ComponentType<{}>>;
|
|
347
|
+
editorWrappers: RealmNode<ComponentType<{
|
|
348
|
+
children: ReactNode;
|
|
349
|
+
}>[]>;
|
|
350
|
+
addEditorWrapper: RealmNode<ComponentType<{
|
|
351
|
+
children: ReactNode;
|
|
352
|
+
}>>;
|
|
353
|
+
currentFormat: RealmNode<number>;
|
|
354
|
+
editorInFocus: RealmNode<EditorInFocus | null>;
|
|
355
|
+
applyFormat: RealmNode<TextFormatType>;
|
|
356
|
+
currentBlockType: RealmNode<BlockType>;
|
|
357
|
+
applyBlockType: RealmNode<BlockType>;
|
|
358
|
+
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
359
|
+
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
360
|
+
}, K_2>) => void;
|
|
361
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { coreSystem } from "../core/index.js";
|
|
2
|
+
import { QuoteNode } from "@lexical/rich-text";
|
|
3
|
+
import { MdastBlockQuoteVisitor } from "./MdastBlockQuoteVisitor.js";
|
|
4
|
+
import { LexicalQuoteVisitor } from "./LexicalQuoteVisitor.js";
|
|
5
|
+
import { realmPlugin } from "../../gurx/react.js";
|
|
6
|
+
import { system } from "../../gurx/realmFactory.js";
|
|
7
|
+
const [
|
|
8
|
+
/** @internal */
|
|
9
|
+
quotePlugin,
|
|
10
|
+
/** @internal */
|
|
11
|
+
quotePluginHooks
|
|
12
|
+
] = realmPlugin({
|
|
13
|
+
id: "quote",
|
|
14
|
+
systemSpec: system(() => {
|
|
15
|
+
return {};
|
|
16
|
+
}, [coreSystem]),
|
|
17
|
+
init: (realm) => {
|
|
18
|
+
realm.pubKey("addImportVisitor", MdastBlockQuoteVisitor);
|
|
19
|
+
realm.pubKey("addLexicalNode", QuoteNode);
|
|
20
|
+
realm.pubKey("addExportVisitor", LexicalQuoteVisitor);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
quotePlugin,
|
|
25
|
+
quotePluginHooks
|
|
26
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SandpackPreset } from '.';
|
|
3
|
+
import { CodeBlockEditorProps } from '../codeblock';
|
|
4
|
+
export interface SandpackEditorProps extends CodeBlockEditorProps {
|
|
5
|
+
preset: SandpackPreset;
|
|
6
|
+
}
|
|
7
|
+
export declare const SandpackEditor: ({ nodeKey, code, focusEmitter, preset }: SandpackEditorProps) => React.JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React__default from "react";
|
|
2
|
+
import { useCodeMirrorRef } from "./useCodeMirrorRef.js";
|
|
3
|
+
import { SandpackProvider, SandpackLayout, SandpackCodeEditor, SandpackPreview, useSandpack } from "@codesandbox/sandpack-react";
|
|
4
|
+
import { useCodeBlockEditorContext } from "../codeblock/CodeBlockNode.js";
|
|
5
|
+
const CodeUpdateEmitter = ({ onChange, snippetFileName }) => {
|
|
6
|
+
const { sandpack } = useSandpack();
|
|
7
|
+
onChange(sandpack.files[snippetFileName].code);
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
const SandpackEditor = ({ nodeKey, code, focusEmitter, preset }) => {
|
|
11
|
+
const codeMirrorRef = useCodeMirrorRef(nodeKey, "sandpack", "jsx", focusEmitter);
|
|
12
|
+
const { setCode } = useCodeBlockEditorContext();
|
|
13
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14
|
+
SandpackProvider,
|
|
15
|
+
{
|
|
16
|
+
template: preset.sandpackTemplate,
|
|
17
|
+
theme: preset.sandpackTheme,
|
|
18
|
+
files: {
|
|
19
|
+
[preset.snippetFileName]: code,
|
|
20
|
+
...Object.entries(preset.files || {}).reduce(
|
|
21
|
+
(acc, [filePath, fileContents]) => ({ ...acc, ...{ [filePath]: { code: fileContents, readOnly: true } } }),
|
|
22
|
+
{}
|
|
23
|
+
)
|
|
24
|
+
},
|
|
25
|
+
customSetup: {
|
|
26
|
+
dependencies: preset.dependencies
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
/* @__PURE__ */ React__default.createElement(SandpackLayout, null, /* @__PURE__ */ React__default.createElement(SandpackCodeEditor, { showLineNumbers: true, showInlineErrors: true, ref: codeMirrorRef }), /* @__PURE__ */ React__default.createElement(SandpackPreview, null)),
|
|
30
|
+
/* @__PURE__ */ React__default.createElement(CodeUpdateEmitter, { onChange: setCode, snippetFileName: preset.snippetFileName })
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
SandpackEditor
|
|
35
|
+
};
|