Skip to content

Commit

Permalink
fix(editor): dsl存储代码块的字段改为methods
Browse files Browse the repository at this point in the history
  • Loading branch information
parisma authored and jia000 committed Sep 22, 2022
1 parent 5b220a0 commit fa01497
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/editor/src/services/codeBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class CodeBlock extends BaseService {
}

/**
* 获取活动的代码块dsl数据源(默认从dsl中的method字段读取
* 获取活动的代码块dsl数据源(默认从dsl中的methods字段读取
* @returns {CodeBlockDSL | null}
*/
public async getCodeDsl(): Promise<CodeBlockDSL | null> {
Expand Down
8 changes: 4 additions & 4 deletions packages/editor/src/services/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -763,23 +763,23 @@ class Editor extends BaseService {
}

/**
* 从dsl中的method字段读取活动的代码块
* 从dsl中的methods字段读取活动的代码块
* @returns {CodeBlockDSL | null}
*/
public async getCodeDsl(): Promise<CodeBlockDSL | null> {
const root = this.get<MApp | null>('root');
if (!root) return null;
return root.method || null;
return root.methods || null;
}

/**
* 设置代码块到dsl的method字段
* 设置代码块到dsl的methods字段
* @param {CodeBlockDSL} codeDsl 代码DSL
* @returns {void}
*/
public async setCodeDsl(codeDsl: CodeBlockDSL): Promise<void> {
if (!this.state.root) return;
this.state.root.method = codeDsl;
this.state.root.methods = codeDsl;
}

private addModifiedNodeId(id: Id) {
Expand Down
2 changes: 1 addition & 1 deletion playground/src/configs/dsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
id: '75f0extui9d7yksklx27hff8xg',
name: 'test',
type: 'app',
method: {
methods: {
l7znj1q24wilb357ay6: {
name: 'getData',
content: () => {
Expand Down

0 comments on commit fa01497

Please sign in to comment.