Editor
import { Editor } from '@dxos/react-ui-editor';import { createBasicExtensions, createThemeExtensions } from '@dxos/ui-editor';npm install @dxos/react-ui-editor @dxos/ui-editor @effect/atom-reactEditor is the text editor Composer uses for documents, built on CodeMirror.
- The React parts draw the editor and its toolbar.
- The extensions from
@dxos/ui-editordecide what the editor does: markdown, formatting, themes, and binding the text to an ECHO object.
| Part | What it is |
|---|---|
Editor.Root |
The root, which holds the extensions and the editorโs state. viewMode sets source, preview or read-only |
Editor.Content |
The layout that fills its container, with the toolbar above the text |
Editor.View |
The CodeMirror editor. Pass value and onChange when the text lives in your state |
Editor.Toolbar |
The formatting actions, as an ActionToolbar |
Editor.ToolbarMenu |
The same actions as a menu, for where a toolbar does not fit |
Editor.Blocks |
The part that draws the embedded blocks the extensions contribute |
Editor.BlockFrame |
The frame of one embedded block, which takes focus for it |
Editor.Diagnostics |
A developer panel of live editor state |
Plain text
Section titled โPlain textโFor plain text, the editor takes two sets of extensions:
createBasicExtensionsgives the editor its editing behavior, with options such as a placeholder and line wrapping.createThemeExtensionsmatches the appโs light or dark theme. Read the mode withuseThemeMode, and rebuild the extensions when it changes.
Rebuilding the extensions recreates the editor, so keep the editorโs text in state and pass it as value with
onChange.
Example (Editing plain text held in state)
import { function useMemo<T>(factory: () => T, deps: React.DependencyList): T
useMemo will only recompute the memoized value when one of the deps has changed.
useMemo, function useState<S>(initialState: S | (() => S)): [S, React.Dispatch<React.SetStateAction<S>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState } from 'react';import { const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor } from '@dxos/react-ui-editor';import * as import Hooks
Hooks from '@dxos/react-ui/Hooks';import { const createBasicExtensions: (propsProp?: BasicExtensionsOptions) => Extension
Assembles the base editor setup: keymaps, history, bracket matching/closing, drop cursor,
read-only handling, line wrapping, and tab handling.
createBasicExtensions, const createThemeExtensions: ({ monospace, scrollbarThin, slots: slotsProp, syntaxHighlighting: syntaxHighlightingProp, themeMode, }?: ThemeExtensionsOptions) => Extension
createThemeExtensions } from '@dxos/ui-editor';
/** A plain-text editor: the basic extensions give it editing, and the theme extensions match the app's theme. */export const const NotesEditor: () => React.JSX.Element
A plain-text editor: the basic extensions give it editing, and the theme extensions match the app's theme.
NotesEditor = () => { const const themeMode: ThemeMode
themeMode = import Hooks
Hooks.const useThemeMode: () => ThemeMode
The ThemeProvider's light or dark mode.
useThemeMode(); // The text lives in state, so it survives the editor being rebuilt when the theme changes. const [const text: string
text, const setText: React.Dispatch<React.SetStateAction<string>>
setText] = useState<string>(initialState: string | (() => string)): [string, React.Dispatch<React.SetStateAction<string>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState(''); const const extensions: Extension[]
extensions = useMemo<Extension[]>(factory: () => Extension[], deps: React.DependencyList): Extension[]
useMemo will only recompute the memoized value when one of the deps has changed.
useMemo( () => [ function createBasicExtensions(propsProp?: BasicExtensionsOptions): Extension
Assembles the base editor setup: keymaps, history, bracket matching/closing, drop cursor,
read-only handling, line wrapping, and tab handling.
createBasicExtensions({ placeholder?: string | undefined
placeholder: 'Write a noteโฆ', lineWrapping?: boolean | undefined
If false then do not set a max-width or side margin on the editor.
lineWrapping: true, }), function createThemeExtensions({ monospace, scrollbarThin, slots: slotsProp, syntaxHighlighting: syntaxHighlightingProp, themeMode, }?: ThemeExtensionsOptions): Extension
createThemeExtensions({ themeMode?: ThemeMode | undefined
themeMode }), ], [const themeMode: ThemeMode
themeMode], );
return ( <const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"];} & { children?: React.ReactNode | undefined;} & React.RefAttributes<EditorController | null>>
Root extensions?: Extension[] | undefined
extensions={const extensions: Extension[]
extensions}> <const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type View: { ({ extensions: providedExtensions, ...props }: EditorViewProps): React.JSX.Element; displayName: string;}
View value?: string | undefined
value={const text: string
text} onChange?: ((value: string) => void) | undefined
onChange={const setText: React.Dispatch<React.SetStateAction<string>>
setText} /> </const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"];} & { children?: React.ReactNode | undefined;} & React.RefAttributes<EditorController | null>>
Root> );};
useMemo rebuilds the extensions only when themeMode changes, so typing does not recreate the editor.
Markdown with a toolbar
Section titled โMarkdown with a toolbarโcreateMarkdownExtensions parses markdown, and decorateMarkdown styles it as you type.
Editor.Toolbar is an ActionToolbar, so its actions live in an atom.
Wrap your app in RegistryProvider from @effect/atom-react. This is best practice, because your app then controls
the registry that the toolbar reads. Without a provider, the toolbar reads the libraryโs default registry.
Add the strings from @dxos/react-ui-menu/translations and @dxos/react-ui-editor/translations to the
resourceExtensions of Theme.Provider.
The toolbar is dimmed until its surface has the userโs attention. Outside Composer, you set that up with two
components from @dxos/react-ui-attention:
- Put a
RootAttentionProvideraround the app. - Put an
AttendableContaineraround the toolbar and the editor.
Then pass the containerโs id to the toolbar as attendableId.
Example (Editing markdown with a formatting toolbar)
import { function useMemo<T>(factory: () => T, deps: React.DependencyList): T
useMemo will only recompute the memoized value when one of the deps has changed.
useMemo, function useState<S>(initialState: S | (() => S)): [S, React.Dispatch<React.SetStateAction<S>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState } from 'react';import { const AttendableContainer: React.ForwardRefExoticComponent<Omit<AttendableContainerProps, "ref"> & React.RefAttributes<HTMLDivElement>>
Note that DeckPlugin and StackPlugin both handle attention on their own,
and when rendering content in those cases it is not necessary to also render an AttendableContainer.
This component is primarily for Storybook stories and other testing scenarios,
or the rare cases where an attendable entity is rendered outside of either of those plugins.
AttendableContainer, const RootAttentionProvider: ({ children, attention: propsAttention, onChange }: RootAttentionProviderProps) => React.JSX.Element
RootAttentionProvider } from '@dxos/react-ui-attention';import { const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor } from '@dxos/react-ui-editor';import * as import Hooks
Hooks from '@dxos/react-ui/Hooks';import { const createBasicExtensions: (propsProp?: BasicExtensionsOptions) => Extension
Assembles the base editor setup: keymaps, history, bracket matching/closing, drop cursor,
read-only handling, line wrapping, and tab handling.
createBasicExtensions, const createMarkdownExtensions: (options?: MarkdownBundleOptions) => Extension[]
Creates markdown extensions.
To be used in conjunction with createBasicExtensions.
Refs:
https://codemirror.net/docs/community
https://codemirror.net/docs/ref/#codemirror.basicSetup
createMarkdownExtensions, const createThemeExtensions: ({ monospace, scrollbarThin, slots: slotsProp, syntaxHighlighting: syntaxHighlightingProp, themeMode, }?: ThemeExtensionsOptions) => Extension
createThemeExtensions, const decorateMarkdown: (options?: DecorateOptions) => import("@codemirror/state").Extension[]
WYSIWYG markdown decorator (headings, lists, tasks, quotes, code, links, horizontal rules);
bundles image, table, adjustChanges, and formattingStyles.
decorateMarkdown } from '@dxos/ui-editor';
const const NOTES: "# Notes\n\nSome **bold** text and a [link](https://dxos.org).\n"
NOTES = '# Notes\n\nSome **bold** text and a [link](https://dxos.org).\n';
/** * A markdown editor with a formatting toolbar, filling its container. The toolbar is active while the container it * shares with the editor has the user's attention. */export const const MarkdownEditor: () => React.JSX.Element
A markdown editor with a formatting toolbar, filling its container. The toolbar is active while the container it
shares with the editor has the user's attention.
MarkdownEditor = () => { const const themeMode: ThemeMode
themeMode = import Hooks
Hooks.const useThemeMode: () => ThemeMode
The ThemeProvider's light or dark mode.
useThemeMode(); // The text lives in state, so it survives the editor being rebuilt when the theme changes. const [const text: string
text, const setText: React.Dispatch<React.SetStateAction<string>>
setText] = useState<string>(initialState: string | (() => string)): [string, React.Dispatch<React.SetStateAction<string>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState(const NOTES: "# Notes\n\nSome **bold** text and a [link](https://dxos.org).\n"
NOTES); const const extensions: Extension[]
extensions = useMemo<Extension[]>(factory: () => Extension[], deps: React.DependencyList): Extension[]
useMemo will only recompute the memoized value when one of the deps has changed.
useMemo( () => [ function createBasicExtensions(propsProp?: BasicExtensionsOptions): Extension
Assembles the base editor setup: keymaps, history, bracket matching/closing, drop cursor,
read-only handling, line wrapping, and tab handling.
createBasicExtensions({ lineWrapping?: boolean | undefined
If false then do not set a max-width or side margin on the editor.
lineWrapping: true }), // Padding inside the scroller keeps the text off the container's edges. function createThemeExtensions({ monospace, scrollbarThin, slots: slotsProp, syntaxHighlighting: syntaxHighlightingProp, themeMode, }?: ThemeExtensionsOptions): Extension
createThemeExtensions({ themeMode?: ThemeMode | undefined
themeMode, slots?: { editor?: { className?: string; }; scroller?: { className?: string; }; content?: { className?: string; };} | undefined
slots: { scroller?: { className?: string;} | undefined
scroller: { className?: string | undefined
className: 'px-4 py-2' } }, }), function createMarkdownExtensions(options?: MarkdownBundleOptions): Extension[]
Creates markdown extensions.
To be used in conjunction with createBasicExtensions.
Refs:
https://codemirror.net/docs/community
https://codemirror.net/docs/ref/#codemirror.basicSetup
createMarkdownExtensions(), function decorateMarkdown(options?: DecorateOptions): import("@codemirror/state").Extension[]
WYSIWYG markdown decorator (headings, lists, tasks, quotes, code, links, horizontal rules);
bundles image, table, adjustChanges, and formattingStyles.
decorateMarkdown(), ], [const themeMode: ThemeMode
themeMode], );
return ( <const RootAttentionProvider: ({ children, attention: propsAttention, onChange }: RootAttentionProviderProps) => React.JSX.Element
RootAttentionProvider> <const AttendableContainer: React.ForwardRefExoticComponent<Omit<AttendableContainerProps, "ref"> & React.RefAttributes<HTMLDivElement>>
Note that DeckPlugin and StackPlugin both handle attention on their own,
and when rendering content in those cases it is not necessary to also render an AttendableContainer.
This component is primarily for Storybook stories and other testing scenarios,
or the rare cases where an attendable entity is rendered outside of either of those plugins.
AttendableContainer id: string
id='notes' classNames?: ClassNameValue
classNames='h-full'> <const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"];} & { children?: React.ReactNode | undefined;} & React.RefAttributes<EditorController | null>>
Root extensions?: Extension[] | undefined
extensions={const extensions: Extension[]
extensions} viewMode?: "source" | "preview" | "readonly" | undefined
viewMode='preview'> <const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type Content: { ({ classNames, children }: EditorContentProps): React.JSX.Element; displayName: string;}
Content> <const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type Toolbar: { (props: EditorToolbarProps): React.JSX.Element; displayName: string;}
Toolbar attendableId?: string | undefined
attendableId='notes' /> <const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type View: { ({ extensions: providedExtensions, ...props }: EditorViewProps): React.JSX.Element; displayName: string;}
View value?: string | undefined
value={const text: string
text} onChange?: ((value: string) => void) | undefined
onChange={const setText: React.Dispatch<React.SetStateAction<string>>
setText} /> </const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type Content: { ({ classNames, children }: EditorContentProps): React.JSX.Element; displayName: string;}
Content> </const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"];} & { children?: React.ReactNode | undefined;} & React.RefAttributes<EditorController | null>>
Root> </const AttendableContainer: React.ForwardRefExoticComponent<Omit<AttendableContainerProps, "ref"> & React.RefAttributes<HTMLDivElement>>
Note that DeckPlugin and StackPlugin both handle attention on their own,
and when rendering content in those cases it is not necessary to also render an AttendableContainer.
This component is primarily for Storybook stories and other testing scenarios,
or the rare cases where an attendable entity is rendered outside of either of those plugins.
AttendableContainer> </const RootAttentionProvider: ({ children, attention: propsAttention, onChange }: RootAttentionProviderProps) => React.JSX.Element
RootAttentionProvider> );};
AttendableContainer and Editor.Toolbar share the id notes. RootAttentionProvider wraps the editor here so
that the sample stands alone. In an app it goes at the root, with the RegistryProvider and the strings, which the
sample leaves out.
Bind the text to ECHO
Section titled โBind the text to ECHOโAn ECHO Text object from @dxos/schema holds a documentโs text. The automerge extension binds the editor to one of
the objectโs properties:
- Each edit goes into the object.
- Each change to the object, from another window or device, shows in the editor.
With the binding, Editor.View needs no value.
Example (Binding the editor to a Text object)
import { function useMemo<T>(factory: () => T, deps: React.DependencyList): T
useMemo will only recompute the memoized value when one of the deps has changed.
useMemo } from 'react';import { import Doc
Doc } from '@dxos/echo-doc';import { const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor } from '@dxos/react-ui-editor';import * as import Hooks
Hooks from '@dxos/react-ui/Hooks';import { import Text
Text } from '@dxos/schema';import { const automerge: (accessor: Doc.Accessor) => Extension
CodeMirror extension that two-way syncs the editor with the string the
Doc.Accessor
points
at, reconciling local edits and remote document mutations via Automerge.
automerge, const createBasicExtensions: (propsProp?: BasicExtensionsOptions) => Extension
Assembles the base editor setup: keymaps, history, bracket matching/closing, drop cursor,
read-only handling, line wrapping, and tab handling.
createBasicExtensions, const createMarkdownExtensions: (options?: MarkdownBundleOptions) => Extension[]
Creates markdown extensions.
To be used in conjunction with createBasicExtensions.
Refs:
https://codemirror.net/docs/community
https://codemirror.net/docs/ref/#codemirror.basicSetup
createMarkdownExtensions, const createThemeExtensions: ({ monospace, scrollbarThin, slots: slotsProp, syntaxHighlighting: syntaxHighlightingProp, themeMode, }?: ThemeExtensionsOptions) => Extension
createThemeExtensions, const decorateMarkdown: (options?: DecorateOptions) => import("@codemirror/state").Extension[]
WYSIWYG markdown decorator (headings, lists, tasks, quotes, code, links, horizontal rules);
bundles image, table, adjustChanges, and formattingStyles.
decorateMarkdown } from '@dxos/ui-editor';
/** * An editor bound to an ECHO `Text` object: edits go into the object, and edits made to it elsewhere (another * window, another device) appear in the editor. */export const const SharedEditor: ({ text }: { text: Text.Text;}) => React.JSX.Element
An editor bound to an ECHO Text object: edits go into the object, and edits made to it elsewhere (another
window, another device) appear in the editor.
SharedEditor = ({ text: Text.Text
text }: { text: Text.Text
text: import Text
Text.class Text
Text }) => { const const themeMode: ThemeMode
themeMode = import Hooks
Hooks.const useThemeMode: () => ThemeMode
The ThemeProvider's light or dark mode.
useThemeMode(); const const extensions: Extension[]
extensions = useMemo<Extension[]>(factory: () => Extension[], deps: React.DependencyList): Extension[]
useMemo will only recompute the memoized value when one of the deps has changed.
useMemo( () => [ function createBasicExtensions(propsProp?: BasicExtensionsOptions): Extension
Assembles the base editor setup: keymaps, history, bracket matching/closing, drop cursor,
read-only handling, line wrapping, and tab handling.
createBasicExtensions({ lineWrapping?: boolean | undefined
If false then do not set a max-width or side margin on the editor.
lineWrapping: true }), function createThemeExtensions({ monospace, scrollbarThin, slots: slotsProp, syntaxHighlighting: syntaxHighlightingProp, themeMode, }?: ThemeExtensionsOptions): Extension
createThemeExtensions({ themeMode?: ThemeMode | undefined
themeMode }), function createMarkdownExtensions(options?: MarkdownBundleOptions): Extension[]
Creates markdown extensions.
To be used in conjunction with createBasicExtensions.
Refs:
https://codemirror.net/docs/community
https://codemirror.net/docs/ref/#codemirror.basicSetup
createMarkdownExtensions(), function decorateMarkdown(options?: DecorateOptions): import("@codemirror/state").Extension[]
WYSIWYG markdown decorator (headings, lists, tasks, quotes, code, links, horizontal rules);
bundles image, table, adjustChanges, and formattingStyles.
decorateMarkdown(), function automerge(accessor: Doc.Accessor): Extension
CodeMirror extension that two-way syncs the editor with the string the
Doc.Accessor
points
at, reconciling local edits and remote document mutations via Automerge.
automerge(import Doc
Doc.const createAccessor: <Text.Text>(obj: Text.Text, path: KeyPath | keyof Text.Text) => Doc.Accessor<Text.Text>
Resolves an
Accessor
for a value within an object, agnostic to whether the object is
in-memory or attached to a database. An Obj.make object has no ObjectCore until db.add,
so an in-memory core is materialized (via createObject) to let the accessor bind before
persistence; the object's edits then survive a later db.add.
createAccessor(text: Text.Text
text, ['content'])), ], [const themeMode: ThemeMode
themeMode, text: Text.Text
text], );
return ( <const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"];} & { children?: React.ReactNode | undefined;} & React.RefAttributes<EditorController | null>>
Root extensions?: Extension[] | undefined
extensions={const extensions: Extension[]
extensions}> <const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type View: { ({ extensions: providedExtensions, ...props }: EditorViewProps): React.JSX.Element; displayName: string;}
View /> </const Editor: { Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"]; } & { children?: React.ReactNode | undefined; } & React.RefAttributes<EditorController | null>>; ... 6 more ...; Diagnostics: { ...; };}
Editor.type Root: React.ForwardRefExoticComponent<Pick<EditorContextValue, "extensions" | "widgets"> & Omit<UseEditorMenuProps, "viewRef"> & Pick<EditorMenuProviderProps, "numItems" | "searchPlaceholder"> & { viewMode?: EditorToolbarState["viewMode"];} & { children?: React.ReactNode | undefined;} & React.RefAttributes<EditorController | null>>
Root> );};
Doc.createAccessor points the automerge extension at the content property of text.
This preview binds to a Text object that is not in a database, so its edits stay in this page: