diff --git a/src/workbench/browser/src/app/shared/components/api-script/api-script.component.html b/src/workbench/browser/src/app/shared/components/api-script/api-script.component.html
index 0f6a7494..0a1e6a03 100644
--- a/src/workbench/browser/src/app/shared/components/api-script/api-script.component.html
+++ b/src/workbench/browser/src/app/shared/components/api-script/api-script.component.html
@@ -48,7 +48,8 @@
-
+
diff --git a/src/workbench/browser/src/app/shared/components/api-script/api-script.component.ts b/src/workbench/browser/src/app/shared/components/api-script/api-script.component.ts
index ad3e0cc8..49d90f06 100644
--- a/src/workbench/browser/src/app/shared/components/api-script/api-script.component.ts
+++ b/src/workbench/browser/src/app/shared/components/api-script/api-script.component.ts
@@ -1,7 +1,7 @@
import { SelectionModel } from '@angular/cdk/collections';
import { FlatTreeControl } from '@angular/cdk/tree';
// import { FlatTreeControl } from 'ng-zorro-antd/node_modules/@angular/cdk/tree';
-import { Component, OnInit, ViewChild } from '@angular/core';
+import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core';
import { EoEditorComponent } from 'eo/workbench/browser/src/app/eoui/editor/eo-editor/eo-editor.component';
import { NzTreeFlatDataSource, NzTreeFlattener } from 'ng-zorro-antd/tree-view';
@@ -14,8 +14,11 @@ import { TREE_DATA } from './constant';
styleUrls: ['./api-script.component.scss'],
})
export class ApiScriptComponent implements OnInit {
+ @Output() codeChange = new EventEmitter();
@ViewChild(EoEditorComponent, { static: false }) eoEditor?: EoEditorComponent;
+ private code = '';
+
private transformer = (node: TreeNode, level: number): FlatNode => ({
...node,
expandable: !!node.children && node.children.length > 0,
@@ -50,7 +53,16 @@ export class ApiScriptComponent implements OnInit {
hasChild = (_: number, node: FlatNode): boolean => node.expandable;
+ handleChange(code) {
+ this.code = code;
+ setTimeout(() => {
+ this.codeChange.emit(code);
+ }, 0);
+ }
+
insertCode = (node: FlatNode) => {
this.eoEditor.handleInsert(node.value);
};
+
+ getCode = () => this.code;
}