@fe-free/core 4.1.3 → 4.1.4

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,13 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 4.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: editor
8
+ - @fe-free/icons@4.1.4
9
+ - @fe-free/tool@4.1.4
10
+
3
11
  ## 4.1.3
4
12
 
5
13
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "4.1.3",
3
+ "version": "4.1.4",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -50,8 +50,8 @@
50
50
  "i18next-icu": "^2.4.1",
51
51
  "react": "^19.2.0",
52
52
  "react-i18next": "^16.4.0",
53
- "@fe-free/icons": "4.1.3",
54
- "@fe-free/tool": "4.1.3"
53
+ "@fe-free/tool": "4.1.4",
54
+ "@fe-free/icons": "4.1.4"
55
55
  },
56
56
  "scripts": {
57
57
  "i18n-extract": "rm -rf ./src/locales/zh-CN && npx i18next-cli extract"
@@ -115,3 +115,11 @@ This is a markdown file.
115
115
  },
116
116
  render: (props) => <BasicDemo {...props} />,
117
117
  };
118
+
119
+ export const HTML: Story = {
120
+ args: {
121
+ language: 'html',
122
+ value: '<html><body><h1>Hello, World!</h1></body></html>',
123
+ },
124
+ render: (props) => <BasicDemo {...props} />,
125
+ };
@@ -1,3 +1,4 @@
1
+ import { html } from '@codemirror/lang-html';
1
2
  import { javascript } from '@codemirror/lang-javascript';
2
3
  import { json } from '@codemirror/lang-json';
3
4
  import { markdown } from '@codemirror/lang-markdown';
@@ -9,7 +10,7 @@ import CodeMirror from '@uiw/react-codemirror';
9
10
  import { useCallback, useMemo } from 'react';
10
11
 
11
12
  interface EditorProps {
12
- language?: 'javascript' | 'python' | 'json' | 'markdown';
13
+ language?: 'javascript' | 'python' | 'json' | 'markdown' | 'html';
13
14
  value?: string;
14
15
  onChange?: (value: string) => void;
15
16
  autoFocus?: boolean;
@@ -73,12 +74,15 @@ function Editor(props: EditorProps) {
73
74
  case 'markdown':
74
75
  result.push(markdown());
75
76
  break;
77
+ case 'html':
78
+ result.push(html());
79
+ break;
76
80
  default:
77
81
  break;
78
82
  }
79
83
 
80
84
  return result;
81
- }, [language, originExtensions]);
85
+ }, [language, originExtensions, lineWrapping]);
82
86
 
83
87
  const handleChange = useCallback(
84
88
  (value: string) => {
@@ -89,7 +93,7 @@ function Editor(props: EditorProps) {
89
93
 
90
94
  return (
91
95
  <CodeMirror
92
- className="w-full h-full"
96
+ className="h-full w-full"
93
97
  height={height || '100%'}
94
98
  width={width || '100%'}
95
99
  value={value}
@@ -289,7 +289,7 @@ function AvatarImageUpload(props: AvatarImageUploadProps) {
289
289
  itemRender={() => null}
290
290
  >
291
291
  {value ? (
292
- <div className="group relative h-20 w-20">
292
+ <div className="group relative h-20 w-20 cursor-pointer">
293
293
  <Avatar size={80} src={value} shape="square" className="bg-01 shadow" />
294
294
  <CloseOutlined
295
295
  className="absolute right-1 top-1 cursor-pointer rounded-full bg-black/50 p-1 text-[10px] text-white opacity-0 transition-opacity group-hover:opacity-100"