@fe-free/core 1.4.13 → 1.4.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 1.4.15
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: editor
8
+ - @fe-free/tool@1.4.15
9
+
10
+ ## 1.4.14
11
+
12
+ ### Patch Changes
13
+
14
+ - feat: editor
15
+ - @fe-free/tool@1.4.14
16
+
3
17
  ## 1.4.13
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "1.4.13",
3
+ "version": "1.4.15",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -22,6 +22,7 @@
22
22
  "@codemirror/language": "^6.10.3",
23
23
  "@codemirror/view": "^6.33.0",
24
24
  "@lezer/highlight": "^1.2.1",
25
+ "@uiw/codemirror-theme-basic": "^4.23.12",
25
26
  "@uiw/codemirror-themes": "^4.23.12",
26
27
  "@uiw/react-codemirror": "^4.23.12",
27
28
  "ace-builds": "^1.33.1",
@@ -35,7 +36,7 @@
35
36
  "react-syntax-highlighter": "^15.5.0",
36
37
  "vanilla-jsoneditor": "^0.23.1",
37
38
  "zustand": "^4.5.4",
38
- "@fe-free/tool": "1.4.13"
39
+ "@fe-free/tool": "1.4.15"
39
40
  },
40
41
  "peerDependencies": {
41
42
  "@ant-design/pro-components": "^2.8.7",
@@ -39,6 +39,14 @@ export const ReadOnly: Story = {
39
39
  render: (props) => <BasicDemo {...props} />,
40
40
  };
41
41
 
42
+ export const Wrap: Story = {
43
+ args: {
44
+ value:
45
+ 'hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!',
46
+ },
47
+ render: (props) => <BasicDemo {...props} />,
48
+ };
49
+
42
50
  // 不可编辑模式
43
51
  export const Editable: Story = {
44
52
  args: {
@@ -2,6 +2,8 @@ import { javascript } from '@codemirror/lang-javascript';
2
2
  import { json } from '@codemirror/lang-json';
3
3
  import { markdown } from '@codemirror/lang-markdown';
4
4
  import { python } from '@codemirror/lang-python';
5
+ import { EditorView } from '@codemirror/view';
6
+ import { basicDarkInit } from '@uiw/codemirror-theme-basic/dark';
5
7
  import type { ReactCodeMirrorProps } from '@uiw/react-codemirror';
6
8
  import CodeMirror from '@uiw/react-codemirror';
7
9
  import { useCallback, useMemo } from 'react';
@@ -23,6 +25,13 @@ interface EditorProps {
23
25
  extensions?: ReactCodeMirrorProps['extensions'];
24
26
  }
25
27
 
28
+ const defaultTheme = basicDarkInit({
29
+ settings: {
30
+ caret: '#c6c6c6',
31
+ fontFamily: 'monospace',
32
+ },
33
+ });
34
+
26
35
  function Editor(props: EditorProps) {
27
36
  const {
28
37
  language,
@@ -34,12 +43,12 @@ function Editor(props: EditorProps) {
34
43
  placeholder,
35
44
  height,
36
45
  width,
37
- theme,
46
+ theme = defaultTheme,
38
47
  extensions: originExtensions,
39
48
  } = props;
40
49
 
41
50
  const extensions = useMemo(() => {
42
- const result: ReactCodeMirrorProps['extensions'] = [];
51
+ const result: ReactCodeMirrorProps['extensions'] = [EditorView.lineWrapping];
43
52
 
44
53
  if (originExtensions) {
45
54
  result.push(...originExtensions);