@mdxeditor/editor 0.15.2 → 0.17.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 +5 -0
- package/dist/MDXEditor.js +8 -2
- package/dist/gurx/react.js +1 -1
- package/dist/index.js +2 -1
- package/dist/plugins/codeblock/index.d.ts +12 -2
- package/dist/plugins/codemirror/CodeMirrorEditor.js +6 -3
- package/dist/plugins/codemirror/index.d.ts +16 -2
- package/dist/plugins/core/index.d.ts +11 -2
- package/dist/plugins/core/index.js +12 -4
- package/dist/plugins/diff-source/SourceEditor.js +2 -1
- package/dist/plugins/diff-source/index.d.ts +12 -2
- package/dist/plugins/directives/index.d.ts +12 -2
- package/dist/plugins/frontmatter/FrontmatterEditor.js +4 -1
- package/dist/plugins/frontmatter/index.d.ts +12 -2
- package/dist/plugins/headings/index.d.ts +348 -3
- package/dist/plugins/headings/index.js +22 -10
- package/dist/plugins/image/index.d.ts +12 -2
- package/dist/plugins/jsx/index.d.ts +12 -2
- package/dist/plugins/link/index.d.ts +1 -0
- package/dist/plugins/link-dialog/index.d.ts +10 -2
- package/dist/plugins/lists/index.d.ts +12 -2
- package/dist/plugins/markdown-shortcut/index.d.ts +2 -1
- package/dist/plugins/markdown-shortcut/index.js +35 -3
- package/dist/plugins/quote/index.d.ts +9 -2
- package/dist/plugins/sandpack/SandpackEditor.js +3 -1
- package/dist/plugins/sandpack/index.d.ts +16 -2
- package/dist/plugins/table/index.d.ts +12 -2
- package/dist/plugins/thematic-break/index.d.ts +12 -2
- package/dist/plugins/toolbar/components/BlockTypeSelect.js +3 -1
- package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.js +1 -1
- package/dist/plugins/toolbar/index.d.ts +10 -2
- package/dist/plugins/toolbar/index.js +3 -2
- package/dist/plugins/toolbar/primitives/DialogButton.js +2 -2
- package/dist/plugins/toolbar/primitives/select.js +14 -2
- package/dist/plugins/toolbar/primitives/toolbar.d.ts +4 -1
- package/dist/plugins/toolbar/primitives/toolbar.js +12 -8
- package/dist/style.css +211 -169
- package/dist/styles/ui.module.css.js +88 -85
- package/package.json +1 -1
package/dist/MDXEditor.d.ts
CHANGED
|
@@ -42,6 +42,11 @@ export interface MDXEditorProps {
|
|
|
42
42
|
* The placeholder contents, displayed when the editor is empty.
|
|
43
43
|
*/
|
|
44
44
|
placeholder?: React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* pass if you would like to have the editor in read-only mode.
|
|
47
|
+
* Note: Don't use this mode to render content for consumption - reander the markdown using a library of your choice instead.
|
|
48
|
+
*/
|
|
49
|
+
readOnly?: boolean;
|
|
45
50
|
}
|
|
46
51
|
/**
|
|
47
52
|
* The interface for the {@link MDXEditor} object reference.
|
package/dist/MDXEditor.js
CHANGED
|
@@ -10,11 +10,16 @@ import classNames from "classnames";
|
|
|
10
10
|
import { noop } from "./utils/fp.js";
|
|
11
11
|
import { RealmPluginInitializer } from "./gurx/react.js";
|
|
12
12
|
const LexicalProvider = ({ children }) => {
|
|
13
|
-
const [initialRootEditorState, nodes] = corePluginHooks.useEmitterValues(
|
|
13
|
+
const [initialRootEditorState, nodes, readOnly] = corePluginHooks.useEmitterValues(
|
|
14
|
+
"initialRootEditorState",
|
|
15
|
+
"usedLexicalNodes",
|
|
16
|
+
"readOnly"
|
|
17
|
+
);
|
|
14
18
|
return /* @__PURE__ */ React__default.createElement(
|
|
15
19
|
LexicalComposer,
|
|
16
20
|
{
|
|
17
21
|
initialConfig: {
|
|
22
|
+
editable: !readOnly,
|
|
18
23
|
editorState: initialRootEditorState,
|
|
19
24
|
namespace: "MDXEditor",
|
|
20
25
|
theme: lexicalTheme,
|
|
@@ -101,7 +106,8 @@ const MDXEditor = React__default.forwardRef((props, ref) => {
|
|
|
101
106
|
onChange: props.onChange ?? noop,
|
|
102
107
|
toMarkdownOptions: props.toMarkdownOptions ?? DEFAULT_MARKDOWN_OPTIONS,
|
|
103
108
|
autoFocus: props.autoFocus ?? false,
|
|
104
|
-
placeholder: props.placeholder ?? ""
|
|
109
|
+
placeholder: props.placeholder ?? "",
|
|
110
|
+
readOnly: Boolean(props.readOnly)
|
|
105
111
|
}),
|
|
106
112
|
...props.plugins || []
|
|
107
113
|
]
|
package/dist/gurx/react.js
CHANGED
|
@@ -164,7 +164,7 @@ const RealmPluginInitializer = function({
|
|
|
164
164
|
return true;
|
|
165
165
|
});
|
|
166
166
|
return validPlugins2;
|
|
167
|
-
}, []);
|
|
167
|
+
}, [plugins]);
|
|
168
168
|
const realm = React__default.useMemo(() => {
|
|
169
169
|
const specs = validPlugins.map((plugin) => plugin.systemSpec);
|
|
170
170
|
const pluginIds = validPlugins.map((plugin) => plugin.id);
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { MDXEditor } from "./MDXEditor.js";
|
|
|
3
3
|
import { importMarkdownToLexical, importMdastTreeToLexical } from "./importMarkdownToLexical.js";
|
|
4
4
|
import { exportLexicalTreeToMdast, exportMarkdownFromLexical } from "./exportMarkdownFromLexical.js";
|
|
5
5
|
import { NESTED_EDITOR_UPDATED_COMMAND, corePlugin, corePluginHooks, coreSystem } from "./plugins/core/index.js";
|
|
6
|
-
import { headingsPlugin, headingsSystem } from "./plugins/headings/index.js";
|
|
6
|
+
import { headingsPlugin, headingsPluginHooks, headingsSystem } from "./plugins/headings/index.js";
|
|
7
7
|
import { thematicBreakPlugin, thematicBreakPluginHooks, thematicBreakSystem } from "./plugins/thematic-break/index.js";
|
|
8
8
|
import { listsPlugin, listsPluginHooks, listsSystem } from "./plugins/lists/index.js";
|
|
9
9
|
import { tablePlugin, tablePluginHooks, tableSystem } from "./plugins/table/index.js";
|
|
@@ -128,6 +128,7 @@ export {
|
|
|
128
128
|
frontmatterSystem,
|
|
129
129
|
getRealmFactory,
|
|
130
130
|
headingsPlugin,
|
|
131
|
+
headingsPluginHooks,
|
|
131
132
|
headingsSystem,
|
|
132
133
|
imagePlugin,
|
|
133
134
|
imagePluginHooks,
|
|
@@ -96,6 +96,7 @@ export declare const codeBlockSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
96
96
|
contentEditableClassName: RealmNode<string>;
|
|
97
97
|
placeholder: RealmNode<ReactNode>;
|
|
98
98
|
autoFocus: RealmNode<boolean>;
|
|
99
|
+
readOnly: RealmNode<boolean>;
|
|
99
100
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
100
101
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
101
102
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -146,6 +147,7 @@ export declare const codeBlockSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
146
147
|
contentEditableClassName: RealmNode<string>;
|
|
147
148
|
placeholder: RealmNode<ReactNode>;
|
|
148
149
|
autoFocus: RealmNode<boolean>;
|
|
150
|
+
readOnly: RealmNode<boolean>;
|
|
149
151
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
150
152
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
151
153
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -219,6 +221,7 @@ codeBlockPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
219
221
|
contentEditableClassName: RealmNode<string>;
|
|
220
222
|
placeholder: RealmNode<ReactNode>;
|
|
221
223
|
autoFocus: RealmNode<boolean>;
|
|
224
|
+
readOnly: RealmNode<boolean>;
|
|
222
225
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
223
226
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
224
227
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -269,6 +272,7 @@ codeBlockPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
269
272
|
contentEditableClassName: RealmNode<string>;
|
|
270
273
|
placeholder: RealmNode<ReactNode>;
|
|
271
274
|
autoFocus: RealmNode<boolean>;
|
|
275
|
+
readOnly: RealmNode<boolean>;
|
|
272
276
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
273
277
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
274
278
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -334,6 +338,7 @@ codeBlockPluginHooks: {
|
|
|
334
338
|
contentEditableClassName: RealmNode<string>;
|
|
335
339
|
placeholder: RealmNode<ReactNode>;
|
|
336
340
|
autoFocus: RealmNode<boolean>;
|
|
341
|
+
readOnly: RealmNode<boolean>;
|
|
337
342
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
338
343
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
339
344
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -354,7 +359,7 @@ codeBlockPluginHooks: {
|
|
|
354
359
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
355
360
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
356
361
|
}>;
|
|
357
|
-
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">(key: K, callback: (value: ValueForKey<{
|
|
362
|
+
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" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "codeBlockEditorDescriptors" | "defaultCodeBlockLanguage" | "appendCodeBlockEditorDescriptor" | "insertCodeBlock">(key: K, callback: (value: ValueForKey<{
|
|
358
363
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
359
364
|
defaultCodeBlockLanguage: RealmNode<string>;
|
|
360
365
|
appendCodeBlockEditorDescriptor: RealmNode<CodeBlockEditorDescriptor>;
|
|
@@ -390,6 +395,7 @@ codeBlockPluginHooks: {
|
|
|
390
395
|
contentEditableClassName: RealmNode<string>;
|
|
391
396
|
placeholder: RealmNode<ReactNode>;
|
|
392
397
|
autoFocus: RealmNode<boolean>;
|
|
398
|
+
readOnly: RealmNode<boolean>;
|
|
393
399
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
394
400
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
395
401
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -446,6 +452,7 @@ codeBlockPluginHooks: {
|
|
|
446
452
|
contentEditableClassName: RealmNode<string>;
|
|
447
453
|
placeholder: RealmNode<ReactNode>;
|
|
448
454
|
autoFocus: RealmNode<boolean>;
|
|
455
|
+
readOnly: RealmNode<boolean>;
|
|
449
456
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
450
457
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
451
458
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -501,6 +508,7 @@ codeBlockPluginHooks: {
|
|
|
501
508
|
contentEditableClassName: RealmNode<string>;
|
|
502
509
|
placeholder: RealmNode<ReactNode>;
|
|
503
510
|
autoFocus: RealmNode<boolean>;
|
|
511
|
+
readOnly: RealmNode<boolean>;
|
|
504
512
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
505
513
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
506
514
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -557,6 +565,7 @@ codeBlockPluginHooks: {
|
|
|
557
565
|
contentEditableClassName: RealmNode<string>;
|
|
558
566
|
placeholder: RealmNode<ReactNode>;
|
|
559
567
|
autoFocus: RealmNode<boolean>;
|
|
568
|
+
readOnly: RealmNode<boolean>;
|
|
560
569
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
561
570
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
562
571
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -577,7 +586,7 @@ codeBlockPluginHooks: {
|
|
|
577
586
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
578
587
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
579
588
|
}>) => void;
|
|
580
|
-
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">(key: K_2) => (value: ValueForKey<{
|
|
589
|
+
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" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "codeBlockEditorDescriptors" | "defaultCodeBlockLanguage" | "appendCodeBlockEditorDescriptor" | "insertCodeBlock">(key: K_2) => (value: ValueForKey<{
|
|
581
590
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
582
591
|
defaultCodeBlockLanguage: RealmNode<string>;
|
|
583
592
|
appendCodeBlockEditorDescriptor: RealmNode<CodeBlockEditorDescriptor>;
|
|
@@ -613,6 +622,7 @@ codeBlockPluginHooks: {
|
|
|
613
622
|
contentEditableClassName: RealmNode<string>;
|
|
614
623
|
placeholder: RealmNode<ReactNode>;
|
|
615
624
|
autoFocus: RealmNode<boolean>;
|
|
625
|
+
readOnly: RealmNode<boolean>;
|
|
616
626
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
617
627
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
618
628
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import React__default from "react";
|
|
2
|
-
import { useCodeMirrorRef } from "../sandpack/useCodeMirrorRef.js";
|
|
3
1
|
import { SandpackProvider, CodeEditor } from "@codesandbox/sandpack-react";
|
|
4
|
-
import
|
|
2
|
+
import React__default from "react";
|
|
5
3
|
import styles from "../../styles/ui.module.css.js";
|
|
4
|
+
import { useCodeBlockEditorContext } from "../codeblock/CodeBlockNode.js";
|
|
5
|
+
import { corePluginHooks } from "../core/index.js";
|
|
6
|
+
import { useCodeMirrorRef } from "../sandpack/useCodeMirrorRef.js";
|
|
6
7
|
const CodeMirrorEditor = ({ language, nodeKey, code, focusEmitter }) => {
|
|
7
8
|
const codeMirrorRef = useCodeMirrorRef(nodeKey, "codeblock", "jsx", focusEmitter);
|
|
9
|
+
const [readOnly] = corePluginHooks.useEmitterValues("readOnly");
|
|
8
10
|
const { setCode } = useCodeBlockEditorContext();
|
|
9
11
|
return /* @__PURE__ */ React__default.createElement(
|
|
10
12
|
"div",
|
|
@@ -17,6 +19,7 @@ const CodeMirrorEditor = ({ language, nodeKey, code, focusEmitter }) => {
|
|
|
17
19
|
/* @__PURE__ */ React__default.createElement(SandpackProvider, null, /* @__PURE__ */ React__default.createElement(
|
|
18
20
|
CodeEditor,
|
|
19
21
|
{
|
|
22
|
+
readOnly,
|
|
20
23
|
showLineNumbers: true,
|
|
21
24
|
initMode: "immediate",
|
|
22
25
|
key: language,
|
|
@@ -44,6 +44,7 @@ export declare const codeMirrorSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
44
44
|
contentEditableClassName: RealmNode<string>;
|
|
45
45
|
placeholder: RealmNode<ReactNode>;
|
|
46
46
|
autoFocus: RealmNode<boolean>;
|
|
47
|
+
readOnly: RealmNode<boolean>;
|
|
47
48
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
48
49
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
49
50
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -94,6 +95,7 @@ export declare const codeMirrorSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
94
95
|
contentEditableClassName: RealmNode<string>;
|
|
95
96
|
placeholder: RealmNode<ReactNode>;
|
|
96
97
|
autoFocus: RealmNode<boolean>;
|
|
98
|
+
readOnly: RealmNode<boolean>;
|
|
97
99
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
98
100
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
99
101
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -144,6 +146,7 @@ export declare const codeMirrorSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
144
146
|
contentEditableClassName: RealmNode<string>;
|
|
145
147
|
placeholder: RealmNode<ReactNode>;
|
|
146
148
|
autoFocus: RealmNode<boolean>;
|
|
149
|
+
readOnly: RealmNode<boolean>;
|
|
147
150
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
148
151
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
149
152
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -199,6 +202,7 @@ export declare const codeMirrorSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
199
202
|
contentEditableClassName: RealmNode<string>;
|
|
200
203
|
placeholder: RealmNode<ReactNode>;
|
|
201
204
|
autoFocus: RealmNode<boolean>;
|
|
205
|
+
readOnly: RealmNode<boolean>;
|
|
202
206
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
203
207
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
204
208
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -263,6 +267,7 @@ codeMirrorPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
263
267
|
contentEditableClassName: RealmNode<string>;
|
|
264
268
|
placeholder: RealmNode<ReactNode>;
|
|
265
269
|
autoFocus: RealmNode<boolean>;
|
|
270
|
+
readOnly: RealmNode<boolean>;
|
|
266
271
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
267
272
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
268
273
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -313,6 +318,7 @@ codeMirrorPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
313
318
|
contentEditableClassName: RealmNode<string>;
|
|
314
319
|
placeholder: RealmNode<ReactNode>;
|
|
315
320
|
autoFocus: RealmNode<boolean>;
|
|
321
|
+
readOnly: RealmNode<boolean>;
|
|
316
322
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
317
323
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
318
324
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -363,6 +369,7 @@ codeMirrorPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
363
369
|
contentEditableClassName: RealmNode<string>;
|
|
364
370
|
placeholder: RealmNode<ReactNode>;
|
|
365
371
|
autoFocus: RealmNode<boolean>;
|
|
372
|
+
readOnly: RealmNode<boolean>;
|
|
366
373
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
367
374
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
368
375
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -418,6 +425,7 @@ codeMirrorPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
418
425
|
contentEditableClassName: RealmNode<string>;
|
|
419
426
|
placeholder: RealmNode<ReactNode>;
|
|
420
427
|
autoFocus: RealmNode<boolean>;
|
|
428
|
+
readOnly: RealmNode<boolean>;
|
|
421
429
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
422
430
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
423
431
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -490,6 +498,7 @@ codeMirrorHooks: {
|
|
|
490
498
|
contentEditableClassName: RealmNode<string>;
|
|
491
499
|
placeholder: RealmNode<ReactNode>;
|
|
492
500
|
autoFocus: RealmNode<boolean>;
|
|
501
|
+
readOnly: RealmNode<boolean>;
|
|
493
502
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
494
503
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
495
504
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -515,7 +524,7 @@ codeMirrorHooks: {
|
|
|
515
524
|
appendCodeBlockEditorDescriptor: RealmNode<CodeBlockEditorDescriptor>;
|
|
516
525
|
insertCodeBlock: RealmNode<Partial<CreateCodeBlockNodeOptions>>;
|
|
517
526
|
}>;
|
|
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<{
|
|
527
|
+
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" | "readOnly" | "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<{
|
|
519
528
|
codeBlockLanguages: RealmNode<Record<string, string>>;
|
|
520
529
|
insertCodeMirror: RealmNode<{
|
|
521
530
|
language: string;
|
|
@@ -552,6 +561,7 @@ codeMirrorHooks: {
|
|
|
552
561
|
contentEditableClassName: RealmNode<string>;
|
|
553
562
|
placeholder: RealmNode<ReactNode>;
|
|
554
563
|
autoFocus: RealmNode<boolean>;
|
|
564
|
+
readOnly: RealmNode<boolean>;
|
|
555
565
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
556
566
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
557
567
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -614,6 +624,7 @@ codeMirrorHooks: {
|
|
|
614
624
|
contentEditableClassName: RealmNode<string>;
|
|
615
625
|
placeholder: RealmNode<ReactNode>;
|
|
616
626
|
autoFocus: RealmNode<boolean>;
|
|
627
|
+
readOnly: RealmNode<boolean>;
|
|
617
628
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
618
629
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
619
630
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -675,6 +686,7 @@ codeMirrorHooks: {
|
|
|
675
686
|
contentEditableClassName: RealmNode<string>;
|
|
676
687
|
placeholder: RealmNode<ReactNode>;
|
|
677
688
|
autoFocus: RealmNode<boolean>;
|
|
689
|
+
readOnly: RealmNode<boolean>;
|
|
678
690
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
679
691
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
680
692
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -737,6 +749,7 @@ codeMirrorHooks: {
|
|
|
737
749
|
contentEditableClassName: RealmNode<string>;
|
|
738
750
|
placeholder: RealmNode<ReactNode>;
|
|
739
751
|
autoFocus: RealmNode<boolean>;
|
|
752
|
+
readOnly: RealmNode<boolean>;
|
|
740
753
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
741
754
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
742
755
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -762,7 +775,7 @@ codeMirrorHooks: {
|
|
|
762
775
|
appendCodeBlockEditorDescriptor: RealmNode<CodeBlockEditorDescriptor>;
|
|
763
776
|
insertCodeBlock: RealmNode<Partial<CreateCodeBlockNodeOptions>>;
|
|
764
777
|
}>) => void;
|
|
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<{
|
|
778
|
+
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" | "readOnly" | "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<{
|
|
766
779
|
codeBlockLanguages: RealmNode<Record<string, string>>;
|
|
767
780
|
insertCodeMirror: RealmNode<{
|
|
768
781
|
language: string;
|
|
@@ -799,6 +812,7 @@ codeMirrorHooks: {
|
|
|
799
812
|
contentEditableClassName: RealmNode<string>;
|
|
800
813
|
placeholder: RealmNode<ReactNode>;
|
|
801
814
|
autoFocus: RealmNode<boolean>;
|
|
815
|
+
readOnly: RealmNode<boolean>;
|
|
802
816
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
803
817
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
804
818
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -59,6 +59,7 @@ export declare const coreSystem: SystemSpec<[], (r: Realm) => {
|
|
|
59
59
|
contentEditableClassName: RealmNode<string>;
|
|
60
60
|
placeholder: RealmNode<React.ReactNode>;
|
|
61
61
|
autoFocus: RealmNode<boolean>;
|
|
62
|
+
readOnly: RealmNode<boolean>;
|
|
62
63
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
63
64
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
64
65
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -86,6 +87,7 @@ interface CorePluginParams {
|
|
|
86
87
|
autoFocus: boolean;
|
|
87
88
|
onChange: (markdown: string) => void;
|
|
88
89
|
toMarkdownOptions: NonNullable<LexicalConvertOptions['toMarkdownOptions']>;
|
|
90
|
+
readOnly: boolean;
|
|
89
91
|
}
|
|
90
92
|
export declare const
|
|
91
93
|
/** @internal */
|
|
@@ -120,6 +122,7 @@ corePlugin: PluginConstructor<SystemSpec<[], (r: Realm) => {
|
|
|
120
122
|
contentEditableClassName: RealmNode<string>;
|
|
121
123
|
placeholder: RealmNode<React.ReactNode>;
|
|
122
124
|
autoFocus: RealmNode<boolean>;
|
|
125
|
+
readOnly: RealmNode<boolean>;
|
|
123
126
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
124
127
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
125
128
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -173,6 +176,7 @@ corePluginHooks: {
|
|
|
173
176
|
contentEditableClassName: RealmNode<string>;
|
|
174
177
|
placeholder: RealmNode<React.ReactNode>;
|
|
175
178
|
autoFocus: RealmNode<boolean>;
|
|
179
|
+
readOnly: RealmNode<boolean>;
|
|
176
180
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
177
181
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
178
182
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -193,7 +197,7 @@ corePluginHooks: {
|
|
|
193
197
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
194
198
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
195
199
|
}>;
|
|
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<{
|
|
200
|
+
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" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode">(key: K, callback: (value: ValueForKey<{
|
|
197
201
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
198
202
|
inFocus: RealmNode<boolean>;
|
|
199
203
|
historyState: RealmNode<HistoryState>;
|
|
@@ -224,6 +228,7 @@ corePluginHooks: {
|
|
|
224
228
|
contentEditableClassName: RealmNode<string>;
|
|
225
229
|
placeholder: RealmNode<React.ReactNode>;
|
|
226
230
|
autoFocus: RealmNode<boolean>;
|
|
231
|
+
readOnly: RealmNode<boolean>;
|
|
227
232
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
228
233
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
229
234
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -275,6 +280,7 @@ corePluginHooks: {
|
|
|
275
280
|
contentEditableClassName: RealmNode<string>;
|
|
276
281
|
placeholder: RealmNode<React.ReactNode>;
|
|
277
282
|
autoFocus: RealmNode<boolean>;
|
|
283
|
+
readOnly: RealmNode<boolean>;
|
|
278
284
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
279
285
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
280
286
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -325,6 +331,7 @@ corePluginHooks: {
|
|
|
325
331
|
contentEditableClassName: RealmNode<string>;
|
|
326
332
|
placeholder: RealmNode<React.ReactNode>;
|
|
327
333
|
autoFocus: RealmNode<boolean>;
|
|
334
|
+
readOnly: RealmNode<boolean>;
|
|
328
335
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
329
336
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
330
337
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -376,6 +383,7 @@ corePluginHooks: {
|
|
|
376
383
|
contentEditableClassName: RealmNode<string>;
|
|
377
384
|
placeholder: RealmNode<React.ReactNode>;
|
|
378
385
|
autoFocus: RealmNode<boolean>;
|
|
386
|
+
readOnly: RealmNode<boolean>;
|
|
379
387
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
380
388
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
381
389
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -396,7 +404,7 @@ corePluginHooks: {
|
|
|
396
404
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
397
405
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
398
406
|
}>) => void;
|
|
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<{
|
|
407
|
+
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" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode">(key: K_2) => (value: ValueForKey<{
|
|
400
408
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
401
409
|
inFocus: RealmNode<boolean>;
|
|
402
410
|
historyState: RealmNode<HistoryState>;
|
|
@@ -427,6 +435,7 @@ corePluginHooks: {
|
|
|
427
435
|
contentEditableClassName: RealmNode<string>;
|
|
428
436
|
placeholder: RealmNode<React.ReactNode>;
|
|
429
437
|
autoFocus: RealmNode<boolean>;
|
|
438
|
+
readOnly: RealmNode<boolean>;
|
|
430
439
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
431
440
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
432
441
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -41,6 +41,7 @@ const coreSystem = system((r) => {
|
|
|
41
41
|
const rootEditor = r.node(null);
|
|
42
42
|
const activeEditor = r.node(null, true);
|
|
43
43
|
const contentEditableClassName = r.node("");
|
|
44
|
+
const readOnly = r.node(false);
|
|
44
45
|
const placeholder = r.node("");
|
|
45
46
|
const autoFocus = r.node(false);
|
|
46
47
|
const inFocus = r.node(false, true);
|
|
@@ -285,6 +286,9 @@ const coreSystem = system((r) => {
|
|
|
285
286
|
{ defaultSelection: "rootEnd" }
|
|
286
287
|
);
|
|
287
288
|
});
|
|
289
|
+
r.sub(r.pipe(readOnly, r.o.withLatestFrom(rootEditor)), ([readOnly2, theRootEditor]) => {
|
|
290
|
+
theRootEditor == null ? void 0 : theRootEditor.setEditable(!readOnly2);
|
|
291
|
+
});
|
|
288
292
|
return {
|
|
289
293
|
// state
|
|
290
294
|
activeEditor,
|
|
@@ -323,6 +327,7 @@ const coreSystem = system((r) => {
|
|
|
323
327
|
contentEditableClassName,
|
|
324
328
|
placeholder,
|
|
325
329
|
autoFocus,
|
|
330
|
+
readOnly,
|
|
326
331
|
// child controls
|
|
327
332
|
composerChildren,
|
|
328
333
|
addComposerChild,
|
|
@@ -351,10 +356,13 @@ const [
|
|
|
351
356
|
id: "core",
|
|
352
357
|
systemSpec: coreSystem,
|
|
353
358
|
applyParamsToSystem(realm, params) {
|
|
354
|
-
realm.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
359
|
+
realm.pubKeys({
|
|
360
|
+
contentEditableClassName: params.contentEditableClassName,
|
|
361
|
+
toMarkdownOptions: params.toMarkdownOptions,
|
|
362
|
+
autoFocus: params.autoFocus,
|
|
363
|
+
placeholder: params.placeholder,
|
|
364
|
+
readOnly: params.readOnly
|
|
365
|
+
});
|
|
358
366
|
realm.singletonSubKey("markdown", params.onChange);
|
|
359
367
|
},
|
|
360
368
|
init(realm, params) {
|
|
@@ -5,12 +5,13 @@ import { diffSourcePluginHooks } from "./index.js";
|
|
|
5
5
|
import { corePluginHooks } from "../core/index.js";
|
|
6
6
|
import { EditorView } from "@codemirror/view";
|
|
7
7
|
const SourceEditor = () => {
|
|
8
|
-
const [markdown$1] = corePluginHooks.useEmitterValues("markdown");
|
|
8
|
+
const [markdown$1, readOnly] = corePluginHooks.useEmitterValues("markdown", "readOnly");
|
|
9
9
|
const updateMarkdown = diffSourcePluginHooks.usePublisher("markdownSourceEditorValue");
|
|
10
10
|
const codeMirrorRef = React__default.useRef(null);
|
|
11
11
|
return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(React__default.Suspense, { fallback: null }, /* @__PURE__ */ React__default.createElement(SandpackProvider, null, /* @__PURE__ */ React__default.createElement(
|
|
12
12
|
CodeEditor,
|
|
13
13
|
{
|
|
14
|
+
readOnly,
|
|
14
15
|
extensions: [EditorView.lineWrapping],
|
|
15
16
|
showLineNumbers: true,
|
|
16
17
|
additionalLanguages: [{ name: "markdown", extensions: ["md"], language: markdown() }],
|
|
@@ -45,6 +45,7 @@ export declare const diffSourceSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
45
45
|
contentEditableClassName: RealmNode<string>;
|
|
46
46
|
placeholder: RealmNode<ReactNode>;
|
|
47
47
|
autoFocus: RealmNode<boolean>;
|
|
48
|
+
readOnly: RealmNode<boolean>;
|
|
48
49
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
49
50
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
50
51
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -95,6 +96,7 @@ export declare const diffSourceSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
95
96
|
contentEditableClassName: RealmNode<string>;
|
|
96
97
|
placeholder: RealmNode<ReactNode>;
|
|
97
98
|
autoFocus: RealmNode<boolean>;
|
|
99
|
+
readOnly: RealmNode<boolean>;
|
|
98
100
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
99
101
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
100
102
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -152,6 +154,7 @@ diffSourcePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
152
154
|
contentEditableClassName: RealmNode<string>;
|
|
153
155
|
placeholder: RealmNode<ReactNode>;
|
|
154
156
|
autoFocus: RealmNode<boolean>;
|
|
157
|
+
readOnly: RealmNode<boolean>;
|
|
155
158
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
156
159
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
157
160
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -202,6 +205,7 @@ diffSourcePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
202
205
|
contentEditableClassName: RealmNode<string>;
|
|
203
206
|
placeholder: RealmNode<ReactNode>;
|
|
204
207
|
autoFocus: RealmNode<boolean>;
|
|
208
|
+
readOnly: RealmNode<boolean>;
|
|
205
209
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
206
210
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
207
211
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -266,6 +270,7 @@ diffSourcePluginHooks: {
|
|
|
266
270
|
contentEditableClassName: RealmNode<string>;
|
|
267
271
|
placeholder: RealmNode<ReactNode>;
|
|
268
272
|
autoFocus: RealmNode<boolean>;
|
|
273
|
+
readOnly: RealmNode<boolean>;
|
|
269
274
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
270
275
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
271
276
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -286,7 +291,7 @@ diffSourcePluginHooks: {
|
|
|
286
291
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
287
292
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
288
293
|
}>;
|
|
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<{
|
|
294
|
+
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" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "viewMode" | "diffMarkdown" | "markdownSourceEditorValue">(key: K, callback: (value: ValueForKey<{
|
|
290
295
|
viewMode: RealmNode<ViewMode>;
|
|
291
296
|
diffMarkdown: RealmNode<string>;
|
|
292
297
|
markdownSourceEditorValue: RealmNode<string>;
|
|
@@ -321,6 +326,7 @@ diffSourcePluginHooks: {
|
|
|
321
326
|
contentEditableClassName: RealmNode<string>;
|
|
322
327
|
placeholder: RealmNode<ReactNode>;
|
|
323
328
|
autoFocus: RealmNode<boolean>;
|
|
329
|
+
readOnly: RealmNode<boolean>;
|
|
324
330
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
325
331
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
326
332
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -376,6 +382,7 @@ diffSourcePluginHooks: {
|
|
|
376
382
|
contentEditableClassName: RealmNode<string>;
|
|
377
383
|
placeholder: RealmNode<ReactNode>;
|
|
378
384
|
autoFocus: RealmNode<boolean>;
|
|
385
|
+
readOnly: RealmNode<boolean>;
|
|
379
386
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
380
387
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
381
388
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -430,6 +437,7 @@ diffSourcePluginHooks: {
|
|
|
430
437
|
contentEditableClassName: RealmNode<string>;
|
|
431
438
|
placeholder: RealmNode<ReactNode>;
|
|
432
439
|
autoFocus: RealmNode<boolean>;
|
|
440
|
+
readOnly: RealmNode<boolean>;
|
|
433
441
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
434
442
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
435
443
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -485,6 +493,7 @@ diffSourcePluginHooks: {
|
|
|
485
493
|
contentEditableClassName: RealmNode<string>;
|
|
486
494
|
placeholder: RealmNode<ReactNode>;
|
|
487
495
|
autoFocus: RealmNode<boolean>;
|
|
496
|
+
readOnly: RealmNode<boolean>;
|
|
488
497
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
489
498
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
490
499
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -505,7 +514,7 @@ diffSourcePluginHooks: {
|
|
|
505
514
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
506
515
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
507
516
|
}>) => void;
|
|
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<{
|
|
517
|
+
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" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "viewMode" | "diffMarkdown" | "markdownSourceEditorValue">(key: K_2) => (value: ValueForKey<{
|
|
509
518
|
viewMode: RealmNode<ViewMode>;
|
|
510
519
|
diffMarkdown: RealmNode<string>;
|
|
511
520
|
markdownSourceEditorValue: RealmNode<string>;
|
|
@@ -540,6 +549,7 @@ diffSourcePluginHooks: {
|
|
|
540
549
|
contentEditableClassName: RealmNode<string>;
|
|
541
550
|
placeholder: RealmNode<ReactNode>;
|
|
542
551
|
autoFocus: RealmNode<boolean>;
|
|
552
|
+
readOnly: RealmNode<boolean>;
|
|
543
553
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
544
554
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
545
555
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|