Skip to content

Commit 9bdc7fd

Browse files
committed
fix: 修复从 schema2code 时, state 恢复错误的问题
1 parent f02abc6 commit 9bdc7fd

File tree

16 files changed

+111
-35
lines changed

16 files changed

+111
-35
lines changed

.eslintrc.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ module.exports = {
3131
'@typescript-eslint/indent': 0,
3232
'import/no-cycle': 0,
3333
'@typescript-eslint/no-shadow': 0,
34-
'max-len': ["error", {"code": 180}]
35-
}
34+
'max-len': ['error', { code: 180 }],
35+
'comma-dangle': [
36+
'warn',
37+
{
38+
objects: 'always',
39+
arrays: 'always',
40+
imports: 'never',
41+
functions: 'never',
42+
},
43+
],
44+
semi: ['error', 'always'],
45+
},
3646
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
quote_type = single
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/
2+
build/
3+
dist/
4+
**/*.min.js
5+
**/*-min.js
6+
**/*.bundle.js
7+
*.js
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
extends: [
3+
'eslint-config-ali/typescript/react',
4+
'prettier',
5+
'prettier/@typescript-eslint',
6+
'prettier/react',
7+
],
8+
rules: {
9+
'no-param-reassign': 0,
10+
},
11+
};

packages/plugin-code-editor/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.4 / 2022-11-18
2+
3+
- 修复从 schema2code 时, state 恢复错误的问题
4+
15
## 1.0.3 / 2022-07-11
26

37
- Fix 源码面板高度塌陷的 [bug](https://github.com/alibaba/lowcode-engine/issues/803)

packages/plugin-code-editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@alilc/lowcode-plugin-code-editor",
33
"author": "59174526@qq.com & humphry.huang9@gmail.com",
4-
"version": "1.0.3",
4+
"version": "1.0.4",
55
"description": "CodeEditor",
66
"files": [
77
"es",

packages/plugin-code-editor/src/config/default-code.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const defaultCode = `
2-
export default class LowcodeComponent extends Component {
2+
export default class Page extends Component {
33
// 可以在 state 中定义搭建所需要的 State
44
state = {
55
test: 1,

packages/plugin-code-editor/src/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const plugin = (ctx: ILowCodePluginContext) => {
1414
},
1515
// 插件的初始化函数,在引擎初始化之后会立刻调用
1616
init() {
17-
const schemaDock = ctx.skeleton.add({
17+
const codeEditorDock = ctx.skeleton.add({
1818
area: 'leftArea',
1919
name: 'codeEditor',
2020
type: 'PanelDock',
@@ -35,9 +35,9 @@ const plugin = (ctx: ILowCodePluginContext) => {
3535
),
3636
});
3737

38-
schemaDock && schemaDock.disable();
38+
codeEditorDock && codeEditorDock.disable();
3939
project.onSimulatorRendererReady(() => {
40-
schemaDock.enable();
40+
codeEditorDock.enable();
4141
});
4242
},
4343
};
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { JSFunction, JSExpression } from '@alilc/lowcode-types';
2+
export type Method = JSExpression | JSFunction & {
3+
source: string;
4+
}
5+
16
export interface Methods {
2-
[key: string]: {
3-
type: 'JSFunction';
4-
value: string;
5-
originalCode: string;
6-
};
7+
[key: string]: Method;
78
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { JSExpression } from '@alilc/lowcode-types';
22

3-
export interface IState extends JSExpression{
4-
// 原始代码
5-
originCode: string;
3+
export interface IState extends JSExpression {
4+
// 原始代码
5+
source: string;
66
}

0 commit comments

Comments
 (0)