@uiw/react-codemirror 4.21.23 → 4.21.25
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/cjs/getDefaultExtensions.d.ts +2 -2
- package/cjs/index.d.ts +4 -4
- package/cjs/useCodeMirror.d.ts +3 -3
- package/cjs/utils.d.ts +2 -2
- package/dist/codemirror.js +77 -31
- package/dist/codemirror.min.js +1 -1
- package/esm/getDefaultExtensions.d.ts +2 -2
- package/esm/index.d.ts +4 -4
- package/esm/useCodeMirror.d.ts +3 -3
- package/esm/utils.d.ts +2 -2
- package/package.json +2 -2
- package/src/getDefaultExtensions.ts +2 -2
- package/src/index.tsx +4 -4
- package/src/useCodeMirror.ts +4 -4
- package/src/utils.ts +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Extension } from '@codemirror/state';
|
|
2
|
-
import { BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup';
|
|
1
|
+
import { type Extension } from '@codemirror/state';
|
|
2
|
+
import { type BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup';
|
|
3
3
|
export * from '@codemirror/theme-one-dark';
|
|
4
4
|
export * from './theme/light';
|
|
5
5
|
export interface DefaultExtensionsOptions {
|
package/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { EditorState, EditorStateConfig, Extension, StateField } from '@codemirror/state';
|
|
3
|
-
import { EditorView, ViewUpdate } from '@codemirror/view';
|
|
4
|
-
import { BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup';
|
|
5
|
-
import { Statistics } from './utils';
|
|
2
|
+
import type { EditorState, EditorStateConfig, Extension, StateField } from '@codemirror/state';
|
|
3
|
+
import type { EditorView, ViewUpdate } from '@codemirror/view';
|
|
4
|
+
import { type BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup';
|
|
5
|
+
import { type Statistics } from './utils';
|
|
6
6
|
export * from '@codemirror/view';
|
|
7
7
|
export * from '@codemirror/state';
|
|
8
8
|
export * from '@uiw/codemirror-extensions-basic-setup';
|
package/esm/useCodeMirror.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EditorState } from '@codemirror/state';
|
|
2
2
|
import { EditorView } from '@codemirror/view';
|
|
3
|
-
import { ReactCodeMirrorProps } from '.';
|
|
3
|
+
import { type ReactCodeMirrorProps } from '.';
|
|
4
4
|
export interface UseCodeMirror extends ReactCodeMirrorProps {
|
|
5
5
|
container?: HTMLDivElement | null;
|
|
6
6
|
}
|
|
@@ -9,6 +9,6 @@ export declare function useCodeMirror(props: UseCodeMirror): {
|
|
|
9
9
|
setState: import("react").Dispatch<import("react").SetStateAction<EditorState | undefined>>;
|
|
10
10
|
view: EditorView | undefined;
|
|
11
11
|
setView: import("react").Dispatch<import("react").SetStateAction<EditorView | undefined>>;
|
|
12
|
-
container: HTMLDivElement | undefined;
|
|
13
|
-
setContainer: import("react").Dispatch<import("react").SetStateAction<HTMLDivElement | undefined>>;
|
|
12
|
+
container: HTMLDivElement | null | undefined;
|
|
13
|
+
setContainer: import("react").Dispatch<import("react").SetStateAction<HTMLDivElement | null | undefined>>;
|
|
14
14
|
};
|
package/esm/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EditorSelection, SelectionRange, Line } from '@codemirror/state';
|
|
2
|
-
import { ViewUpdate } from '@codemirror/view';
|
|
1
|
+
import type { EditorSelection, SelectionRange, Line } from '@codemirror/state';
|
|
2
|
+
import type { ViewUpdate } from '@codemirror/view';
|
|
3
3
|
export interface Statistics {
|
|
4
4
|
/** total length of the document */
|
|
5
5
|
length: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uiw/react-codemirror",
|
|
3
|
-
"version": "4.21.
|
|
3
|
+
"version": "4.21.25",
|
|
4
4
|
"description": "CodeMirror component for React.",
|
|
5
5
|
"homepage": "https://uiwjs.github.io/react-codemirror",
|
|
6
6
|
"funding": "https://jaywcjlove.github.io/#/sponsor",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@codemirror/commands": "^6.1.0",
|
|
40
40
|
"@codemirror/state": "^6.1.1",
|
|
41
41
|
"@codemirror/theme-one-dark": "^6.0.0",
|
|
42
|
-
"@uiw/codemirror-extensions-basic-setup": "4.21.
|
|
42
|
+
"@uiw/codemirror-extensions-basic-setup": "4.21.25",
|
|
43
43
|
"codemirror": "^6.0.0"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Extension } from '@codemirror/state';
|
|
1
|
+
import { type Extension } from '@codemirror/state';
|
|
2
2
|
import { indentWithTab } from '@codemirror/commands';
|
|
3
|
-
import { basicSetup, BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup';
|
|
3
|
+
import { basicSetup, type BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup';
|
|
4
4
|
import { EditorView, keymap, placeholder } from '@codemirror/view';
|
|
5
5
|
import { oneDark } from '@codemirror/theme-one-dark';
|
|
6
6
|
import { EditorState } from '@codemirror/state';
|
package/src/index.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useRef, forwardRef, useImperativeHandle } from 'react';
|
|
2
|
-
import { EditorState, EditorStateConfig, Extension, StateField } from '@codemirror/state';
|
|
3
|
-
import { EditorView, ViewUpdate } from '@codemirror/view';
|
|
4
|
-
import { BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup';
|
|
2
|
+
import type { EditorState, EditorStateConfig, Extension, StateField } from '@codemirror/state';
|
|
3
|
+
import type { EditorView, ViewUpdate } from '@codemirror/view';
|
|
4
|
+
import { type BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup';
|
|
5
5
|
import { useCodeMirror } from './useCodeMirror';
|
|
6
|
-
import { Statistics } from './utils';
|
|
6
|
+
import { type Statistics } from './utils';
|
|
7
7
|
|
|
8
8
|
export * from '@codemirror/view';
|
|
9
9
|
export * from '@codemirror/state';
|
package/src/useCodeMirror.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { Annotation, EditorState, StateEffect, type Extension } from '@codemirror/state';
|
|
3
|
-
import { EditorView, ViewUpdate } from '@codemirror/view';
|
|
3
|
+
import { EditorView, type ViewUpdate } from '@codemirror/view';
|
|
4
4
|
import { getDefaultExtensions } from './getDefaultExtensions';
|
|
5
5
|
import { getStatistics } from './utils';
|
|
6
|
-
import { ReactCodeMirrorProps } from '.';
|
|
6
|
+
import { type ReactCodeMirrorProps } from '.';
|
|
7
7
|
|
|
8
8
|
const External = Annotation.define<boolean>();
|
|
9
9
|
|
|
@@ -38,7 +38,7 @@ export function useCodeMirror(props: UseCodeMirror) {
|
|
|
38
38
|
root,
|
|
39
39
|
initialState,
|
|
40
40
|
} = props;
|
|
41
|
-
const [container, setContainer] = useState<HTMLDivElement>();
|
|
41
|
+
const [container, setContainer] = useState<HTMLDivElement | null>();
|
|
42
42
|
const [view, setView] = useState<EditorView>();
|
|
43
43
|
const [state, setState] = useState<EditorState>();
|
|
44
44
|
const defaultThemeOption = EditorView.theme({
|
|
@@ -114,7 +114,7 @@ export function useCodeMirror(props: UseCodeMirror) {
|
|
|
114
114
|
};
|
|
115
115
|
}, [container, state]);
|
|
116
116
|
|
|
117
|
-
useEffect(() => setContainer(props.container
|
|
117
|
+
useEffect(() => setContainer(props.container), [props.container]);
|
|
118
118
|
|
|
119
119
|
useEffect(
|
|
120
120
|
() => () => {
|
package/src/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EditorSelection, SelectionRange, Line } from '@codemirror/state';
|
|
2
|
-
import { ViewUpdate } from '@codemirror/view';
|
|
1
|
+
import type { EditorSelection, SelectionRange, Line } from '@codemirror/state';
|
|
2
|
+
import type { ViewUpdate } from '@codemirror/view';
|
|
3
3
|
|
|
4
4
|
export interface Statistics {
|
|
5
5
|
/** total length of the document */
|