mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-06-16 01:49:25 +08:00
refactor(editor): 修改代码块描述内容在dsl中的键名为codeBlock字段
This commit is contained in:
parent
92f3696e44
commit
415ecad24c
@ -61,7 +61,8 @@ class App extends EventEmitter {
|
||||
super();
|
||||
|
||||
this.env = new Env(options.ua);
|
||||
this.codeDsl = options.config?.methods;
|
||||
// 代码块描述内容在dsl codeBlock字段
|
||||
this.codeDsl = options.config?.codeBlock;
|
||||
options.platform && (this.platform = options.platform);
|
||||
options.jsEngine && (this.jsEngine = options.jsEngine);
|
||||
options.designWidth && (this.designWidth = options.designWidth);
|
||||
@ -141,7 +142,7 @@ class App extends EventEmitter {
|
||||
* @param curPage 当前页面id
|
||||
*/
|
||||
public setConfig(config: MApp, curPage?: Id) {
|
||||
this.codeDsl = config.methods;
|
||||
this.codeDsl = config.codeBlock;
|
||||
this.pages = new Map();
|
||||
config.items?.forEach((page) => {
|
||||
this.pages.set(
|
||||
|
@ -69,7 +69,7 @@ class CodeBlock extends BaseService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活动的代码块dsl数据源(默认从dsl中的methods字段读取)
|
||||
* 获取活动的代码块dsl数据源(默认从dsl中的codeBlock字段读取)
|
||||
* @param {boolean} forceRefresh 是否强制从活动dsl拉取刷新
|
||||
* @returns {CodeBlockDSL | null}
|
||||
*/
|
||||
|
@ -767,23 +767,23 @@ class Editor extends BaseService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 从dsl中的methods字段读取活动的代码块
|
||||
* 从dsl中的codeBlock字段读取活动的代码块
|
||||
* @returns {CodeBlockDSL | null}
|
||||
*/
|
||||
public async getCodeDsl(): Promise<CodeBlockDSL | null> {
|
||||
const root = this.get<MApp | null>('root');
|
||||
if (!root) return null;
|
||||
return root.methods || null;
|
||||
return root.codeBlock || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置代码块到dsl的methods字段
|
||||
* 设置代码块到dsl的codeBlock字段
|
||||
* @param {CodeBlockDSL} codeDsl 代码DSL
|
||||
* @returns {void}
|
||||
*/
|
||||
public async setCodeDsl(codeDsl: CodeBlockDSL): Promise<void> {
|
||||
if (!this.state.root) return;
|
||||
this.state.root.methods = codeDsl;
|
||||
this.state.root.codeBlock = codeDsl;
|
||||
}
|
||||
|
||||
private addModifiedNodeId(id: Id) {
|
||||
|
@ -20,7 +20,7 @@ export default {
|
||||
id: '75f0extui9d7yksklx27hff8xg',
|
||||
name: 'test',
|
||||
type: 'app',
|
||||
methods: {
|
||||
codeBlock: {
|
||||
code_5336: {
|
||||
name: 'getData',
|
||||
// eslint-disable-next-line no-eval
|
||||
|
Loading…
x
Reference in New Issue
Block a user