Skip to content

Commit 639cd51

Browse files
committed
doc: Update document. (#202) (#204)
1 parent 21d77c3 commit 639cd51

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,17 @@ import { EditorView, ViewUpdate } from '@codemirror/view';
180180
export * from '@codemirror/view';
181181
export * from '@codemirror/basic-setup';
182182
export * from '@codemirror/state';
183-
export * from './useCodeMirror';
183+
export interface UseCodeMirror extends ReactCodeMirrorProps {
184+
container?: HTMLDivElement | null;
185+
}
186+
export declare function useCodeMirror(props: UseCodeMirror): {
187+
state: EditorState | undefined;
188+
setState: import('react').Dispatch<import('react').SetStateAction<EditorState | undefined>>;
189+
view: EditorView | undefined;
190+
setView: import('react').Dispatch<import('react').SetStateAction<EditorView | undefined>>;
191+
container: HTMLDivElement | null | undefined;
192+
setContainer: import('react').Dispatch<import('react').SetStateAction<HTMLDivElement | null | undefined>>;
193+
};
184194
export interface ReactCodeMirrorProps
185195
extends Omit<EditorStateConfig, 'doc' | 'extensions'>,
186196
Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'placeholder'> {
@@ -227,6 +237,11 @@ export interface ReactCodeMirrorProps
227237
* or objects with an extension in its `extension` property. Extensions can be nested in arrays arbitrarily deep—they will be flattened when processed.
228238
*/
229239
extensions?: Extension[];
240+
/**
241+
* 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.
242+
* Originally from the [config of EditorView](https://codemirror.net/6/docs/ref/#view.EditorView.constructor%5Econfig.root)
243+
*/
244+
root?: ShadowRoot | Document;
230245
}
231246
export interface ReactCodeMirrorRef {
232247
editor?: HTMLDivElement | null;

0 commit comments

Comments
 (0)