@uiw/react-codemirror 4.20.4 → 4.21.0
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 +4 -2
- package/cjs/getDefaultExtensions.js +27 -8
- package/dist/codemirror.js +9689 -9506
- package/dist/codemirror.min.js +1 -1
- package/esm/getDefaultExtensions.d.ts +4 -2
- package/esm/getDefaultExtensions.js +3 -7
- package/package.json +2 -2
- package/src/getDefaultExtensions.ts +6 -12
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Extension } from '@codemirror/state';
|
|
2
2
|
import { BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup';
|
|
3
|
-
export
|
|
3
|
+
export * from '@codemirror/theme-one-dark';
|
|
4
|
+
export * from './theme/light';
|
|
5
|
+
export interface DefaultExtensionsOptions {
|
|
4
6
|
indentWithTab?: boolean;
|
|
5
7
|
basicSetup?: boolean | BasicSetupOptions;
|
|
6
8
|
placeholder?: string | HTMLElement;
|
|
7
9
|
theme?: 'light' | 'dark' | 'none' | Extension;
|
|
8
10
|
readOnly?: boolean;
|
|
9
11
|
editable?: boolean;
|
|
10
|
-
}
|
|
12
|
+
}
|
|
11
13
|
export declare const getDefaultExtensions: (optios?: DefaultExtensionsOptions) => Extension[];
|
|
@@ -3,6 +3,9 @@ import { basicSetup } from '@uiw/codemirror-extensions-basic-setup';
|
|
|
3
3
|
import { EditorView, keymap, placeholder } from '@codemirror/view';
|
|
4
4
|
import { oneDark } from '@codemirror/theme-one-dark';
|
|
5
5
|
import { EditorState } from '@codemirror/state';
|
|
6
|
+
import { defaultLightThemeOption } from './theme/light';
|
|
7
|
+
export * from '@codemirror/theme-one-dark';
|
|
8
|
+
export * from './theme/light';
|
|
6
9
|
export var getDefaultExtensions = function getDefaultExtensions(optios) {
|
|
7
10
|
if (optios === void 0) {
|
|
8
11
|
optios = {};
|
|
@@ -16,13 +19,6 @@ export var getDefaultExtensions = function getDefaultExtensions(optios) {
|
|
|
16
19
|
basicSetup: defaultBasicSetup = true
|
|
17
20
|
} = optios;
|
|
18
21
|
var getExtensions = [];
|
|
19
|
-
var defaultLightThemeOption = EditorView.theme({
|
|
20
|
-
'&': {
|
|
21
|
-
backgroundColor: '#fff'
|
|
22
|
-
}
|
|
23
|
-
}, {
|
|
24
|
-
dark: false
|
|
25
|
-
});
|
|
26
22
|
if (defaultIndentWithTab) {
|
|
27
23
|
getExtensions.unshift(keymap.of([indentWithTab]));
|
|
28
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uiw/react-codemirror",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.21.0",
|
|
4
4
|
"description": "CodeMirror component for React.",
|
|
5
5
|
"homepage": "https://uiwjs.github.io/react-codemirror",
|
|
6
6
|
"author": "kenny wong <wowohoo@qq.com>",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@codemirror/commands": "^6.1.0",
|
|
41
41
|
"@codemirror/state": "^6.1.1",
|
|
42
42
|
"@codemirror/theme-one-dark": "^6.0.0",
|
|
43
|
-
"@uiw/codemirror-extensions-basic-setup": "4.
|
|
43
|
+
"@uiw/codemirror-extensions-basic-setup": "4.21.0",
|
|
44
44
|
"codemirror": "^6.0.0"
|
|
45
45
|
},
|
|
46
46
|
"keywords": [
|
|
@@ -4,15 +4,19 @@ import { basicSetup, BasicSetupOptions } from '@uiw/codemirror-extensions-basic-
|
|
|
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';
|
|
7
|
+
import { defaultLightThemeOption } from './theme/light';
|
|
7
8
|
|
|
8
|
-
export
|
|
9
|
+
export * from '@codemirror/theme-one-dark';
|
|
10
|
+
export * from './theme/light';
|
|
11
|
+
|
|
12
|
+
export interface DefaultExtensionsOptions {
|
|
9
13
|
indentWithTab?: boolean;
|
|
10
14
|
basicSetup?: boolean | BasicSetupOptions;
|
|
11
15
|
placeholder?: string | HTMLElement;
|
|
12
16
|
theme?: 'light' | 'dark' | 'none' | Extension;
|
|
13
17
|
readOnly?: boolean;
|
|
14
18
|
editable?: boolean;
|
|
15
|
-
}
|
|
19
|
+
}
|
|
16
20
|
|
|
17
21
|
export const getDefaultExtensions = (optios: DefaultExtensionsOptions = {}): Extension[] => {
|
|
18
22
|
const {
|
|
@@ -24,16 +28,6 @@ export const getDefaultExtensions = (optios: DefaultExtensionsOptions = {}): Ext
|
|
|
24
28
|
basicSetup: defaultBasicSetup = true,
|
|
25
29
|
} = optios;
|
|
26
30
|
const getExtensions: Extension[] = [];
|
|
27
|
-
const defaultLightThemeOption = EditorView.theme(
|
|
28
|
-
{
|
|
29
|
-
'&': {
|
|
30
|
-
backgroundColor: '#fff',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
dark: false,
|
|
35
|
-
},
|
|
36
|
-
);
|
|
37
31
|
if (defaultIndentWithTab) {
|
|
38
32
|
getExtensions.unshift(keymap.of([indentWithTab]));
|
|
39
33
|
}
|