diff --git a/README.md b/README.md index f9c81cac6..4aa3c7297 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,17 @@ import { EditorView, ViewUpdate } from '@codemirror/view'; export * from '@codemirror/view'; export * from '@codemirror/basic-setup'; export * from '@codemirror/state'; -export * from './useCodeMirror'; +export interface UseCodeMirror extends ReactCodeMirrorProps { + container?: HTMLDivElement | null; +} +export declare function useCodeMirror(props: UseCodeMirror): { + state: EditorState | undefined; + setState: import('react').Dispatch>; + view: EditorView | undefined; + setView: import('react').Dispatch>; + container: HTMLDivElement | null | undefined; + setContainer: import('react').Dispatch>; +}; export interface ReactCodeMirrorProps extends Omit, Omit, 'onChange' | 'placeholder'> { @@ -227,6 +237,11 @@ export interface ReactCodeMirrorProps * or objects with an extension in its `extension` property. Extensions can be nested in arrays arbitrarily deep—they will be flattened when processed. */ extensions?: Extension[]; + /** + * If the view is going to be mounted in a shadow root or document other than the one held by the global variable document (the default), you should pass it here. + * Originally from the [config of EditorView](https://codemirror.net/6/docs/ref/#view.EditorView.constructor%5Econfig.root) + */ + root?: ShadowRoot | Document; } export interface ReactCodeMirrorRef { editor?: HTMLDivElement | null;