@mdxeditor/editor 0.11.1 → 0.13.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.d.ts +8 -0
- package/dist/MDXEditor.js +13 -10
- package/dist/exportMarkdownFromLexical.d.ts +19 -0
- package/dist/gurx/react.d.ts +34 -6
- package/dist/gurx/realm.d.ts +18 -2
- package/dist/gurx/realmFactory.d.ts +23 -2
- package/dist/icons/rich_text.svg.js +2 -2
- package/dist/importMarkdownToLexical.d.ts +7 -0
- package/dist/plugins/codeblock/index.d.ts +23 -3
- package/dist/plugins/codemirror/index.d.ts +31 -3
- package/dist/plugins/core/NestedLexicalEditor.d.ts +1 -1
- package/dist/plugins/core/NestedLexicalEditor.js +4 -4
- package/dist/plugins/core/SharedHistoryPlugin.js +1 -1
- package/dist/plugins/core/index.d.ts +31 -3
- package/dist/plugins/core/index.js +11 -1
- package/dist/plugins/diff-source/index.d.ts +23 -3
- package/dist/plugins/directives/index.d.ts +23 -3
- package/dist/plugins/frontmatter/FrontmatterEditor.js +1 -2
- package/dist/plugins/frontmatter/index.d.ts +23 -3
- package/dist/plugins/headings/index.d.ts +5 -1
- package/dist/plugins/image/ImageEditor.js +2 -2
- package/dist/plugins/image/index.d.ts +23 -3
- package/dist/plugins/jsx/index.d.ts +22 -2
- package/dist/plugins/link/AutoLinkPlugin.d.ts +9 -0
- package/dist/plugins/link/AutoLinkPlugin.js +18 -0
- package/dist/plugins/link/index.d.ts +22 -4
- package/dist/plugins/link/index.js +16 -5
- package/dist/plugins/link-dialog/index.d.ts +19 -3
- package/dist/plugins/link-dialog/index.js +1 -0
- package/dist/plugins/lists/index.d.ts +23 -3
- package/dist/plugins/lists/index.js +2 -2
- package/dist/plugins/markdown-shortcut/index.d.ts +2 -0
- package/dist/plugins/markdown-shortcut/index.js +1 -1
- package/dist/plugins/quote/index.d.ts +17 -3
- package/dist/plugins/sandpack/index.d.ts +30 -2
- package/dist/plugins/table/TableEditor.js +5 -5
- package/dist/plugins/table/index.d.ts +23 -3
- package/dist/plugins/thematic-break/LexicalThematicBreakVisitor.d.ts +1 -1
- package/dist/plugins/thematic-break/LexicalThematicBreakVisitor.js +1 -1
- package/dist/plugins/thematic-break/MdastThematicBreakVisitor.js +1 -1
- package/dist/plugins/thematic-break/index.d.ts +23 -3
- package/dist/plugins/thematic-break/index.js +2 -2
- package/dist/plugins/toolbar/index.d.ts +18 -2
- package/dist/plugins/toolbar/primitives/select.js +1 -1
- package/dist/style.css +186 -164
- package/dist/styles/ui.module.css.js +90 -84
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CodeBlockEditorDescriptor, CreateCodeBlockNodeOptions } from '../codeblock';
|
|
2
|
-
import type { RefObject,
|
|
2
|
+
import type { RefObject, ReactNode, ComponentType } from 'react';
|
|
3
3
|
import type { Options } from 'mdast-util-to-markdown';
|
|
4
4
|
import type { Config } from 'mdast-util-from-markdown/lib';
|
|
5
5
|
import type { Extension } from 'micromark-util-types';
|
|
@@ -42,6 +42,8 @@ export declare const codeMirrorSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
42
42
|
markdown: RealmNode<string>;
|
|
43
43
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
44
44
|
contentEditableClassName: RealmNode<string>;
|
|
45
|
+
placeholder: RealmNode<ReactNode>;
|
|
46
|
+
autoFocus: RealmNode<boolean>;
|
|
45
47
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
46
48
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
47
49
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -90,6 +92,8 @@ export declare const codeMirrorSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
90
92
|
markdown: RealmNode<string>;
|
|
91
93
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
92
94
|
contentEditableClassName: RealmNode<string>;
|
|
95
|
+
placeholder: RealmNode<ReactNode>;
|
|
96
|
+
autoFocus: RealmNode<boolean>;
|
|
93
97
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
94
98
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
95
99
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -138,6 +142,8 @@ export declare const codeMirrorSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
138
142
|
markdown: RealmNode<string>;
|
|
139
143
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
140
144
|
contentEditableClassName: RealmNode<string>;
|
|
145
|
+
placeholder: RealmNode<ReactNode>;
|
|
146
|
+
autoFocus: RealmNode<boolean>;
|
|
141
147
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
142
148
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
143
149
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -191,6 +197,8 @@ export declare const codeMirrorSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
191
197
|
markdown: RealmNode<string>;
|
|
192
198
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
193
199
|
contentEditableClassName: RealmNode<string>;
|
|
200
|
+
placeholder: RealmNode<ReactNode>;
|
|
201
|
+
autoFocus: RealmNode<boolean>;
|
|
194
202
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
195
203
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
196
204
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -253,6 +261,8 @@ codeMirrorPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
253
261
|
markdown: RealmNode<string>;
|
|
254
262
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
255
263
|
contentEditableClassName: RealmNode<string>;
|
|
264
|
+
placeholder: RealmNode<ReactNode>;
|
|
265
|
+
autoFocus: RealmNode<boolean>;
|
|
256
266
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
257
267
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
258
268
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -301,6 +311,8 @@ codeMirrorPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
301
311
|
markdown: RealmNode<string>;
|
|
302
312
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
303
313
|
contentEditableClassName: RealmNode<string>;
|
|
314
|
+
placeholder: RealmNode<ReactNode>;
|
|
315
|
+
autoFocus: RealmNode<boolean>;
|
|
304
316
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
305
317
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
306
318
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -349,6 +361,8 @@ codeMirrorPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
349
361
|
markdown: RealmNode<string>;
|
|
350
362
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
351
363
|
contentEditableClassName: RealmNode<string>;
|
|
364
|
+
placeholder: RealmNode<ReactNode>;
|
|
365
|
+
autoFocus: RealmNode<boolean>;
|
|
352
366
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
353
367
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
354
368
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -402,6 +416,8 @@ codeMirrorPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
402
416
|
markdown: RealmNode<string>;
|
|
403
417
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
404
418
|
contentEditableClassName: RealmNode<string>;
|
|
419
|
+
placeholder: RealmNode<ReactNode>;
|
|
420
|
+
autoFocus: RealmNode<boolean>;
|
|
405
421
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
406
422
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
407
423
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -472,6 +488,8 @@ codeMirrorHooks: {
|
|
|
472
488
|
markdown: RealmNode<string>;
|
|
473
489
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
474
490
|
contentEditableClassName: RealmNode<string>;
|
|
491
|
+
placeholder: RealmNode<ReactNode>;
|
|
492
|
+
autoFocus: RealmNode<boolean>;
|
|
475
493
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
476
494
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
477
495
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -497,7 +515,7 @@ codeMirrorHooks: {
|
|
|
497
515
|
appendCodeBlockEditorDescriptor: RealmNode<CodeBlockEditorDescriptor>;
|
|
498
516
|
insertCodeBlock: RealmNode<Partial<CreateCodeBlockNodeOptions>>;
|
|
499
517
|
}>;
|
|
500
|
-
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" | "codeBlockEditorDescriptors" | "defaultCodeBlockLanguage" | "appendCodeBlockEditorDescriptor" | "insertCodeBlock" | "codeBlockLanguages" | "insertCodeMirror">(key: K, callback: (value: ValueForKey<{
|
|
518
|
+
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" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "codeBlockEditorDescriptors" | "defaultCodeBlockLanguage" | "appendCodeBlockEditorDescriptor" | "insertCodeBlock" | "codeBlockLanguages" | "insertCodeMirror">(key: K, callback: (value: ValueForKey<{
|
|
501
519
|
codeBlockLanguages: RealmNode<Record<string, string>>;
|
|
502
520
|
insertCodeMirror: RealmNode<{
|
|
503
521
|
language: string;
|
|
@@ -532,6 +550,8 @@ codeMirrorHooks: {
|
|
|
532
550
|
markdown: RealmNode<string>;
|
|
533
551
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
534
552
|
contentEditableClassName: RealmNode<string>;
|
|
553
|
+
placeholder: RealmNode<ReactNode>;
|
|
554
|
+
autoFocus: RealmNode<boolean>;
|
|
535
555
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
536
556
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
537
557
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -592,6 +612,8 @@ codeMirrorHooks: {
|
|
|
592
612
|
markdown: RealmNode<string>;
|
|
593
613
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
594
614
|
contentEditableClassName: RealmNode<string>;
|
|
615
|
+
placeholder: RealmNode<ReactNode>;
|
|
616
|
+
autoFocus: RealmNode<boolean>;
|
|
595
617
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
596
618
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
597
619
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -651,6 +673,8 @@ codeMirrorHooks: {
|
|
|
651
673
|
markdown: RealmNode<string>;
|
|
652
674
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
653
675
|
contentEditableClassName: RealmNode<string>;
|
|
676
|
+
placeholder: RealmNode<ReactNode>;
|
|
677
|
+
autoFocus: RealmNode<boolean>;
|
|
654
678
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
655
679
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
656
680
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -711,6 +735,8 @@ codeMirrorHooks: {
|
|
|
711
735
|
markdown: RealmNode<string>;
|
|
712
736
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
713
737
|
contentEditableClassName: RealmNode<string>;
|
|
738
|
+
placeholder: RealmNode<ReactNode>;
|
|
739
|
+
autoFocus: RealmNode<boolean>;
|
|
714
740
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
715
741
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
716
742
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -736,7 +762,7 @@ codeMirrorHooks: {
|
|
|
736
762
|
appendCodeBlockEditorDescriptor: RealmNode<CodeBlockEditorDescriptor>;
|
|
737
763
|
insertCodeBlock: RealmNode<Partial<CreateCodeBlockNodeOptions>>;
|
|
738
764
|
}>) => void;
|
|
739
|
-
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" | "codeBlockEditorDescriptors" | "defaultCodeBlockLanguage" | "appendCodeBlockEditorDescriptor" | "insertCodeBlock" | "codeBlockLanguages" | "insertCodeMirror">(key: K_2) => (value: ValueForKey<{
|
|
765
|
+
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" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "codeBlockEditorDescriptors" | "defaultCodeBlockLanguage" | "appendCodeBlockEditorDescriptor" | "insertCodeBlock" | "codeBlockLanguages" | "insertCodeMirror">(key: K_2) => (value: ValueForKey<{
|
|
740
766
|
codeBlockLanguages: RealmNode<Record<string, string>>;
|
|
741
767
|
insertCodeMirror: RealmNode<{
|
|
742
768
|
language: string;
|
|
@@ -771,6 +797,8 @@ codeMirrorHooks: {
|
|
|
771
797
|
markdown: RealmNode<string>;
|
|
772
798
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
773
799
|
contentEditableClassName: RealmNode<string>;
|
|
800
|
+
placeholder: RealmNode<ReactNode>;
|
|
801
|
+
autoFocus: RealmNode<boolean>;
|
|
774
802
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
775
803
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
776
804
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -2,7 +2,7 @@ import { DecoratorNode, EditorConfig, LexicalEditor } from 'lexical';
|
|
|
2
2
|
import * as Mdast from 'mdast';
|
|
3
3
|
import type { Data, Node } from 'unist';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
5
|
+
import { ContentEditable } from '@lexical/react/LexicalContentEditable.js';
|
|
6
6
|
import { VoidEmitter } from '../../utils/voidEmitter';
|
|
7
7
|
/**
|
|
8
8
|
* The value of the {@link NestedEditorsContext} React context.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { $addUpdateTag, $getNodeByKey, createEditor, $getRoot, BLUR_COMMAND, COMMAND_PRIORITY_EDITOR, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_HIGH, KEY_BACKSPACE_COMMAND, COMMAND_PRIORITY_CRITICAL } from "lexical";
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
import { corePluginHooks, NESTED_EDITOR_UPDATED_COMMAND } from "./index.js";
|
|
4
|
-
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
5
|
-
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
|
|
6
|
-
import { LexicalNestedComposer } from "@lexical/react/LexicalNestedComposer";
|
|
7
|
-
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
4
|
+
import { ContentEditable } from "@lexical/react/LexicalContentEditable.js";
|
|
5
|
+
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary.js";
|
|
6
|
+
import { LexicalNestedComposer } from "@lexical/react/LexicalNestedComposer.js";
|
|
7
|
+
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
8
8
|
import { lexicalTheme } from "../../styles/lexicalTheme.js";
|
|
9
9
|
import { exportLexicalTreeToMdast } from "../../exportMarkdownFromLexical.js";
|
|
10
10
|
import { importMdastTreeToLexical } from "../../importMarkdownToLexical.js";
|
|
@@ -2,7 +2,7 @@ import type { Options } from 'mdast-util-to-markdown/lib/types';
|
|
|
2
2
|
import type { Config } from 'mdast-util-from-markdown/lib';
|
|
3
3
|
import type { Extension } from 'micromark-util-types';
|
|
4
4
|
import type { HistoryState } from '@lexical/history';
|
|
5
|
-
import { InitialEditorStateType } from '@lexical/react/LexicalComposer';
|
|
5
|
+
import { InitialEditorStateType } from '@lexical/react/LexicalComposer.js';
|
|
6
6
|
import { HeadingTagType } from '@lexical/rich-text';
|
|
7
7
|
import type { LexicalCommand, DecoratorNode, ElementNode, Klass, LexicalEditor, LexicalNode, RangeSelection, TextFormatType } from 'lexical';
|
|
8
8
|
import * as Mdast from 'mdast';
|
|
@@ -11,13 +11,23 @@ import type { LexicalVisitor, LexicalConvertOptions } from '../../exportMarkdown
|
|
|
11
11
|
import type { SystemSpec, Realm, PluginConstructor, TypedRealm, ValueForKey, SystemKeys, ValuesForKeys, SystemDict, RealmNode } from '../../gurx';
|
|
12
12
|
import { MdastImportVisitor } from '../../importMarkdownToLexical';
|
|
13
13
|
import type { JsxComponentDescriptor } from '../jsx';
|
|
14
|
+
/** @internal */
|
|
14
15
|
export type EditorSubscription = (activeEditor: LexicalEditor) => () => void;
|
|
16
|
+
/** @internal */
|
|
15
17
|
export type BlockType = 'paragraph' | 'quote' | HeadingTagType | '';
|
|
18
|
+
/**
|
|
19
|
+
* The type of the editor being edited currently. Custom editors can override this, so that the toolbar can change contents.
|
|
20
|
+
*/
|
|
16
21
|
export interface EditorInFocus {
|
|
17
22
|
editorType: string;
|
|
18
23
|
rootNode: LexicalNode | null;
|
|
19
24
|
}
|
|
25
|
+
/** @internal */
|
|
20
26
|
export declare const NESTED_EDITOR_UPDATED_COMMAND: LexicalCommand<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Add the the core system when creating systemf for your own plugins.
|
|
29
|
+
* This gives you access to the component core state and logic, like the visitors, the lexical nodes, and the publishers used to insert nodes in the editor.
|
|
30
|
+
*/
|
|
21
31
|
export declare const coreSystem: SystemSpec<[], (r: Realm) => {
|
|
22
32
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
23
33
|
inFocus: RealmNode<boolean>;
|
|
@@ -47,6 +57,8 @@ export declare const coreSystem: SystemSpec<[], (r: Realm) => {
|
|
|
47
57
|
markdown: RealmNode<string>;
|
|
48
58
|
editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
|
|
49
59
|
contentEditableClassName: RealmNode<string>;
|
|
60
|
+
placeholder: RealmNode<React.ReactNode>;
|
|
61
|
+
autoFocus: RealmNode<boolean>;
|
|
50
62
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
51
63
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
52
64
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -70,6 +82,8 @@ export declare const coreSystem: SystemSpec<[], (r: Realm) => {
|
|
|
70
82
|
interface CorePluginParams {
|
|
71
83
|
initialMarkdown: string;
|
|
72
84
|
contentEditableClassName: string;
|
|
85
|
+
placeholder?: React.ReactNode;
|
|
86
|
+
autoFocus: boolean;
|
|
73
87
|
onChange: (markdown: string) => void;
|
|
74
88
|
toMarkdownOptions: NonNullable<LexicalConvertOptions['toMarkdownOptions']>;
|
|
75
89
|
}
|
|
@@ -104,6 +118,8 @@ corePlugin: PluginConstructor<SystemSpec<[], (r: Realm) => {
|
|
|
104
118
|
markdown: RealmNode<string>;
|
|
105
119
|
editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
|
|
106
120
|
contentEditableClassName: RealmNode<string>;
|
|
121
|
+
placeholder: RealmNode<React.ReactNode>;
|
|
122
|
+
autoFocus: RealmNode<boolean>;
|
|
107
123
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
108
124
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
109
125
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -155,6 +171,8 @@ corePluginHooks: {
|
|
|
155
171
|
markdown: RealmNode<string>;
|
|
156
172
|
editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
|
|
157
173
|
contentEditableClassName: RealmNode<string>;
|
|
174
|
+
placeholder: RealmNode<React.ReactNode>;
|
|
175
|
+
autoFocus: RealmNode<boolean>;
|
|
158
176
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
159
177
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
160
178
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -175,7 +193,7 @@ corePluginHooks: {
|
|
|
175
193
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
176
194
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
177
195
|
}>;
|
|
178
|
-
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<{
|
|
196
|
+
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" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode">(key: K, callback: (value: ValueForKey<{
|
|
179
197
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
180
198
|
inFocus: RealmNode<boolean>;
|
|
181
199
|
historyState: RealmNode<HistoryState>;
|
|
@@ -204,6 +222,8 @@ corePluginHooks: {
|
|
|
204
222
|
markdown: RealmNode<string>;
|
|
205
223
|
editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
|
|
206
224
|
contentEditableClassName: RealmNode<string>;
|
|
225
|
+
placeholder: RealmNode<React.ReactNode>;
|
|
226
|
+
autoFocus: RealmNode<boolean>;
|
|
207
227
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
208
228
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
209
229
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -253,6 +273,8 @@ corePluginHooks: {
|
|
|
253
273
|
markdown: RealmNode<string>;
|
|
254
274
|
editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
|
|
255
275
|
contentEditableClassName: RealmNode<string>;
|
|
276
|
+
placeholder: RealmNode<React.ReactNode>;
|
|
277
|
+
autoFocus: RealmNode<boolean>;
|
|
256
278
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
257
279
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
258
280
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -301,6 +323,8 @@ corePluginHooks: {
|
|
|
301
323
|
markdown: RealmNode<string>;
|
|
302
324
|
editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
|
|
303
325
|
contentEditableClassName: RealmNode<string>;
|
|
326
|
+
placeholder: RealmNode<React.ReactNode>;
|
|
327
|
+
autoFocus: RealmNode<boolean>;
|
|
304
328
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
305
329
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
306
330
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -350,6 +374,8 @@ corePluginHooks: {
|
|
|
350
374
|
markdown: RealmNode<string>;
|
|
351
375
|
editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
|
|
352
376
|
contentEditableClassName: RealmNode<string>;
|
|
377
|
+
placeholder: RealmNode<React.ReactNode>;
|
|
378
|
+
autoFocus: RealmNode<boolean>;
|
|
353
379
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
354
380
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
355
381
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -370,7 +396,7 @@ corePluginHooks: {
|
|
|
370
396
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
371
397
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
372
398
|
}>) => void;
|
|
373
|
-
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<{
|
|
399
|
+
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" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode">(key: K_2) => (value: ValueForKey<{
|
|
374
400
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
375
401
|
inFocus: RealmNode<boolean>;
|
|
376
402
|
historyState: RealmNode<HistoryState>;
|
|
@@ -399,6 +425,8 @@ corePluginHooks: {
|
|
|
399
425
|
markdown: RealmNode<string>;
|
|
400
426
|
editorRootElementRef: RealmNode<React.RefObject<HTMLDivElement> | null>;
|
|
401
427
|
contentEditableClassName: RealmNode<string>;
|
|
428
|
+
placeholder: RealmNode<React.ReactNode>;
|
|
429
|
+
autoFocus: RealmNode<boolean>;
|
|
402
430
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
403
431
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
404
432
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createEmptyHistoryState } from "@lexical/react/LexicalHistoryPlugin";
|
|
1
|
+
import { createEmptyHistoryState } from "@lexical/react/LexicalHistoryPlugin.js";
|
|
2
2
|
import { $isHeadingNode } from "@lexical/rich-text";
|
|
3
3
|
import { $setBlocksType } from "@lexical/selection";
|
|
4
4
|
import { $findMatchingParent, $wrapNodeInElement, $insertNodeToNearestRoot } from "@lexical/utils";
|
|
@@ -15,6 +15,7 @@ import { MdastParagraphVisitor } from "./MdastParagraphVisitor.js";
|
|
|
15
15
|
import { MdastRootVisitor } from "./MdastRootVisitor.js";
|
|
16
16
|
import { MdastTextVisitor } from "./MdastTextVisitor.js";
|
|
17
17
|
import { SharedHistoryPlugin } from "./SharedHistoryPlugin.js";
|
|
18
|
+
import { noop } from "../../utils/fp.js";
|
|
18
19
|
import { system } from "../../gurx/realmFactory.js";
|
|
19
20
|
import { realmPlugin } from "../../gurx/react.js";
|
|
20
21
|
const NESTED_EDITOR_UPDATED_COMMAND = createCommand("NESTED_EDITOR_UPDATED_COMMAND");
|
|
@@ -39,6 +40,8 @@ const coreSystem = system((r) => {
|
|
|
39
40
|
const rootEditor = r.node(null);
|
|
40
41
|
const activeEditor = r.node(null, true);
|
|
41
42
|
const contentEditableClassName = r.node("");
|
|
43
|
+
const placeholder = r.node("");
|
|
44
|
+
const autoFocus = r.node(false);
|
|
42
45
|
const inFocus = r.node(false, true);
|
|
43
46
|
const currentFormat = r.node(0, true);
|
|
44
47
|
const applyFormat = r.node();
|
|
@@ -154,6 +157,9 @@ const coreSystem = system((r) => {
|
|
|
154
157
|
markdown: r.getValue(initialMarkdown),
|
|
155
158
|
syntaxExtensions: r.getValue(syntaxExtensions)
|
|
156
159
|
});
|
|
160
|
+
if (r.getValue(autoFocus)) {
|
|
161
|
+
setTimeout(() => theRootEditor.focus(noop, { defaultSelection: "rootStart" }));
|
|
162
|
+
}
|
|
157
163
|
});
|
|
158
164
|
r.pub(createActiveEditorSubscription, (editor) => {
|
|
159
165
|
return editor.registerUpdateListener(({ editorState }) => {
|
|
@@ -290,6 +296,8 @@ const coreSystem = system((r) => {
|
|
|
290
296
|
// DOM
|
|
291
297
|
editorRootElementRef,
|
|
292
298
|
contentEditableClassName,
|
|
299
|
+
placeholder,
|
|
300
|
+
autoFocus,
|
|
293
301
|
// child controls
|
|
294
302
|
composerChildren,
|
|
295
303
|
addComposerChild,
|
|
@@ -320,6 +328,8 @@ const [
|
|
|
320
328
|
applyParamsToSystem(realm, params) {
|
|
321
329
|
realm.pubKey("contentEditableClassName", params.contentEditableClassName);
|
|
322
330
|
realm.pubKey("toMarkdownOptions", params.toMarkdownOptions);
|
|
331
|
+
realm.pubKey("autoFocus", params.autoFocus);
|
|
332
|
+
realm.pubKey("placeholder", params.placeholder);
|
|
323
333
|
realm.singletonSubKey("markdown", params.onChange);
|
|
324
334
|
},
|
|
325
335
|
init(realm, params) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RefObject,
|
|
1
|
+
import type { RefObject, ReactNode, ComponentType } from 'react';
|
|
2
2
|
import type { Options } from 'mdast-util-to-markdown';
|
|
3
3
|
import type { Config } from 'mdast-util-from-markdown/lib';
|
|
4
4
|
import type { Extension } from 'micromark-util-types';
|
|
@@ -43,6 +43,8 @@ export declare const diffSourceSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
43
43
|
markdown: RealmNode<string>;
|
|
44
44
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
45
45
|
contentEditableClassName: RealmNode<string>;
|
|
46
|
+
placeholder: RealmNode<ReactNode>;
|
|
47
|
+
autoFocus: RealmNode<boolean>;
|
|
46
48
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
47
49
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
48
50
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -91,6 +93,8 @@ export declare const diffSourceSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
91
93
|
markdown: RealmNode<string>;
|
|
92
94
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
93
95
|
contentEditableClassName: RealmNode<string>;
|
|
96
|
+
placeholder: RealmNode<ReactNode>;
|
|
97
|
+
autoFocus: RealmNode<boolean>;
|
|
94
98
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
95
99
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
96
100
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -146,6 +150,8 @@ diffSourcePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
146
150
|
markdown: RealmNode<string>;
|
|
147
151
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
148
152
|
contentEditableClassName: RealmNode<string>;
|
|
153
|
+
placeholder: RealmNode<ReactNode>;
|
|
154
|
+
autoFocus: RealmNode<boolean>;
|
|
149
155
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
150
156
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
151
157
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -194,6 +200,8 @@ diffSourcePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
194
200
|
markdown: RealmNode<string>;
|
|
195
201
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
196
202
|
contentEditableClassName: RealmNode<string>;
|
|
203
|
+
placeholder: RealmNode<ReactNode>;
|
|
204
|
+
autoFocus: RealmNode<boolean>;
|
|
197
205
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
198
206
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
199
207
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -256,6 +264,8 @@ diffSourcePluginHooks: {
|
|
|
256
264
|
markdown: RealmNode<string>;
|
|
257
265
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
258
266
|
contentEditableClassName: RealmNode<string>;
|
|
267
|
+
placeholder: RealmNode<ReactNode>;
|
|
268
|
+
autoFocus: RealmNode<boolean>;
|
|
259
269
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
260
270
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
261
271
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -276,7 +286,7 @@ diffSourcePluginHooks: {
|
|
|
276
286
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
277
287
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
278
288
|
}>;
|
|
279
|
-
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" | "viewMode" | "diffMarkdown" | "markdownSourceEditorValue">(key: K, callback: (value: ValueForKey<{
|
|
289
|
+
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" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "viewMode" | "diffMarkdown" | "markdownSourceEditorValue">(key: K, callback: (value: ValueForKey<{
|
|
280
290
|
viewMode: RealmNode<ViewMode>;
|
|
281
291
|
diffMarkdown: RealmNode<string>;
|
|
282
292
|
markdownSourceEditorValue: RealmNode<string>;
|
|
@@ -309,6 +319,8 @@ diffSourcePluginHooks: {
|
|
|
309
319
|
markdown: RealmNode<string>;
|
|
310
320
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
311
321
|
contentEditableClassName: RealmNode<string>;
|
|
322
|
+
placeholder: RealmNode<ReactNode>;
|
|
323
|
+
autoFocus: RealmNode<boolean>;
|
|
312
324
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
313
325
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
314
326
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -362,6 +374,8 @@ diffSourcePluginHooks: {
|
|
|
362
374
|
markdown: RealmNode<string>;
|
|
363
375
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
364
376
|
contentEditableClassName: RealmNode<string>;
|
|
377
|
+
placeholder: RealmNode<ReactNode>;
|
|
378
|
+
autoFocus: RealmNode<boolean>;
|
|
365
379
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
366
380
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
367
381
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -414,6 +428,8 @@ diffSourcePluginHooks: {
|
|
|
414
428
|
markdown: RealmNode<string>;
|
|
415
429
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
416
430
|
contentEditableClassName: RealmNode<string>;
|
|
431
|
+
placeholder: RealmNode<ReactNode>;
|
|
432
|
+
autoFocus: RealmNode<boolean>;
|
|
417
433
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
418
434
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
419
435
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -467,6 +483,8 @@ diffSourcePluginHooks: {
|
|
|
467
483
|
markdown: RealmNode<string>;
|
|
468
484
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
469
485
|
contentEditableClassName: RealmNode<string>;
|
|
486
|
+
placeholder: RealmNode<ReactNode>;
|
|
487
|
+
autoFocus: RealmNode<boolean>;
|
|
470
488
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
471
489
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
472
490
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -487,7 +505,7 @@ diffSourcePluginHooks: {
|
|
|
487
505
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
488
506
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
489
507
|
}>) => void;
|
|
490
|
-
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" | "viewMode" | "diffMarkdown" | "markdownSourceEditorValue">(key: K_2) => (value: ValueForKey<{
|
|
508
|
+
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" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "viewMode" | "diffMarkdown" | "markdownSourceEditorValue">(key: K_2) => (value: ValueForKey<{
|
|
491
509
|
viewMode: RealmNode<ViewMode>;
|
|
492
510
|
diffMarkdown: RealmNode<string>;
|
|
493
511
|
markdownSourceEditorValue: RealmNode<string>;
|
|
@@ -520,6 +538,8 @@ diffSourcePluginHooks: {
|
|
|
520
538
|
markdown: RealmNode<string>;
|
|
521
539
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
522
540
|
contentEditableClassName: RealmNode<string>;
|
|
541
|
+
placeholder: RealmNode<ReactNode>;
|
|
542
|
+
autoFocus: RealmNode<boolean>;
|
|
523
543
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
524
544
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
525
545
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RefObject,
|
|
1
|
+
import type { RefObject, ReactNode, ComponentType } from 'react';
|
|
2
2
|
import type { Options } from 'mdast-util-to-markdown';
|
|
3
3
|
import type { Config } from 'mdast-util-from-markdown/lib';
|
|
4
4
|
import type { Extension } from 'micromark-util-types';
|
|
@@ -100,6 +100,8 @@ export declare const directivesSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
100
100
|
markdown: RealmNode<string>;
|
|
101
101
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
102
102
|
contentEditableClassName: RealmNode<string>;
|
|
103
|
+
placeholder: RealmNode<ReactNode>;
|
|
104
|
+
autoFocus: RealmNode<boolean>;
|
|
103
105
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
104
106
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
105
107
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -148,6 +150,8 @@ export declare const directivesSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
148
150
|
markdown: RealmNode<string>;
|
|
149
151
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
150
152
|
contentEditableClassName: RealmNode<string>;
|
|
153
|
+
placeholder: RealmNode<ReactNode>;
|
|
154
|
+
autoFocus: RealmNode<boolean>;
|
|
151
155
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
152
156
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
153
157
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -214,6 +218,8 @@ directivesPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
214
218
|
markdown: RealmNode<string>;
|
|
215
219
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
216
220
|
contentEditableClassName: RealmNode<string>;
|
|
221
|
+
placeholder: RealmNode<ReactNode>;
|
|
222
|
+
autoFocus: RealmNode<boolean>;
|
|
217
223
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
218
224
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
219
225
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -262,6 +268,8 @@ directivesPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
262
268
|
markdown: RealmNode<string>;
|
|
263
269
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
264
270
|
contentEditableClassName: RealmNode<string>;
|
|
271
|
+
placeholder: RealmNode<ReactNode>;
|
|
272
|
+
autoFocus: RealmNode<boolean>;
|
|
265
273
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
266
274
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
267
275
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -319,6 +327,8 @@ directivesPluginHooks: {
|
|
|
319
327
|
markdown: RealmNode<string>;
|
|
320
328
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
321
329
|
contentEditableClassName: RealmNode<string>;
|
|
330
|
+
placeholder: RealmNode<ReactNode>;
|
|
331
|
+
autoFocus: RealmNode<boolean>;
|
|
322
332
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
323
333
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
324
334
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -339,7 +349,7 @@ directivesPluginHooks: {
|
|
|
339
349
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
340
350
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
341
351
|
}>;
|
|
342
|
-
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" | "directiveDescriptors" | "insertDirective">(key: K, callback: (value: ValueForKey<{
|
|
352
|
+
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" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "directiveDescriptors" | "insertDirective">(key: K, callback: (value: ValueForKey<{
|
|
343
353
|
directiveDescriptors: RealmNode<DirectiveDescriptor<any>[]>;
|
|
344
354
|
insertDirective: RealmNode<InsertDirectivePayload>;
|
|
345
355
|
} & {
|
|
@@ -371,6 +381,8 @@ directivesPluginHooks: {
|
|
|
371
381
|
markdown: RealmNode<string>;
|
|
372
382
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
373
383
|
contentEditableClassName: RealmNode<string>;
|
|
384
|
+
placeholder: RealmNode<ReactNode>;
|
|
385
|
+
autoFocus: RealmNode<boolean>;
|
|
374
386
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
375
387
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
376
388
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -423,6 +435,8 @@ directivesPluginHooks: {
|
|
|
423
435
|
markdown: RealmNode<string>;
|
|
424
436
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
425
437
|
contentEditableClassName: RealmNode<string>;
|
|
438
|
+
placeholder: RealmNode<ReactNode>;
|
|
439
|
+
autoFocus: RealmNode<boolean>;
|
|
426
440
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
427
441
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
428
442
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -474,6 +488,8 @@ directivesPluginHooks: {
|
|
|
474
488
|
markdown: RealmNode<string>;
|
|
475
489
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
476
490
|
contentEditableClassName: RealmNode<string>;
|
|
491
|
+
placeholder: RealmNode<ReactNode>;
|
|
492
|
+
autoFocus: RealmNode<boolean>;
|
|
477
493
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
478
494
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
479
495
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -526,6 +542,8 @@ directivesPluginHooks: {
|
|
|
526
542
|
markdown: RealmNode<string>;
|
|
527
543
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
528
544
|
contentEditableClassName: RealmNode<string>;
|
|
545
|
+
placeholder: RealmNode<ReactNode>;
|
|
546
|
+
autoFocus: RealmNode<boolean>;
|
|
529
547
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
530
548
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
531
549
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -546,7 +564,7 @@ directivesPluginHooks: {
|
|
|
546
564
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
547
565
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
548
566
|
}>) => void;
|
|
549
|
-
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" | "directiveDescriptors" | "insertDirective">(key: K_2) => (value: ValueForKey<{
|
|
567
|
+
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" | "placeholder" | "autoFocus" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "directiveDescriptors" | "insertDirective">(key: K_2) => (value: ValueForKey<{
|
|
550
568
|
directiveDescriptors: RealmNode<DirectiveDescriptor<any>[]>;
|
|
551
569
|
insertDirective: RealmNode<InsertDirectivePayload>;
|
|
552
570
|
} & {
|
|
@@ -578,6 +596,8 @@ directivesPluginHooks: {
|
|
|
578
596
|
markdown: RealmNode<string>;
|
|
579
597
|
editorRootElementRef: RealmNode<RefObject<HTMLDivElement> | null>;
|
|
580
598
|
contentEditableClassName: RealmNode<string>;
|
|
599
|
+
placeholder: RealmNode<ReactNode>;
|
|
600
|
+
autoFocus: RealmNode<boolean>;
|
|
581
601
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
582
602
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
583
603
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -60,8 +60,7 @@ const FrontmatterEditor = ({ yaml, onChange }) => {
|
|
|
60
60
|
"Add new key"
|
|
61
61
|
)))))));
|
|
62
62
|
};
|
|
63
|
-
const TableInput = React__default.forwardRef(({ className, autofocusIfEmpty, ...props }, ref) => {
|
|
64
|
-
props.autoFocus = Boolean(!props.value && autofocusIfEmpty);
|
|
63
|
+
const TableInput = React__default.forwardRef(({ className, autofocusIfEmpty: _, ...props }, ref) => {
|
|
65
64
|
return /* @__PURE__ */ React__default.createElement("input", { className: classNames(styles.propertyEditorInput, className), ...props, ref });
|
|
66
65
|
});
|
|
67
66
|
export {
|