From 639cd513f47cf45e765470b88be49c70650d57b3 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Fri, 15 Oct 2021 13:50:36 +0800 Subject: [PATCH] doc: Update document. (#202) (#204) --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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;