Skip to content

Commit

Permalink
feat: format
Browse files Browse the repository at this point in the history
  • Loading branch information
kungfuboy committed Jul 15, 2022
1 parent 4708008 commit 3b2373f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 22 deletions.
17 changes: 6 additions & 11 deletions src/workbench/browser/src/app/pages/api/test/api-test.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class ApiTestComponent implements OnInit, OnDestroy {
private testServerService: TestServerService,
private messageService: MessageService,
private storage: StorageService,
private lang:LanguageService
private lang: LanguageService
) {
this.testServer = this.testServerService.instance;
this.testServer.init((message) => {
Expand All @@ -91,16 +91,11 @@ export class ApiTestComponent implements OnInit, OnDestroy {
});
}
clickTest() {
switch (this.status) {
case 'testing': {
this.abort();
break;
}
default: {
this.test();
break;
}
if (this.status === 'testing') {
this.abort();
return;
}
this.test();
}
/**
* click history to restore data from history
Expand Down Expand Up @@ -193,7 +188,7 @@ export class ApiTestComponent implements OnInit, OnDestroy {
env: this.env,
beforeScript: this.beforeScript,
afterScript: this.afterScript,
lang:this.lang.systemLanguage==='zh-Hans'?'cn':'en'
lang: this.lang.systemLanguage === 'zh-Hans' ? 'cn' : 'en',
}),
});
this.status$.next('testing');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
<div class="flex eo-api-script">
<div class="w-[340px] h-[322px] overflow-auto">
<div class="w-[300px] h-[322px] overflow-auto">
<div class="flex justify-between p-3">
<div i18n>Snippets</div>
<div>
<a href="https://eoapi.io/docs/script-function" class="text-blue-400" target="_blank" rel="noopener noreferrer"
i18n>Learn more</a>
<a
href="https://eoapi.io/docs/script-function"
class="text-blue-400"
target="_blank"
rel="noopener noreferrer"
i18n
>Learn more</a
>
</div>
</div>
<nz-tree-view [nzTreeControl]="treeControl" [nzDataSource]="dataSource" [nzBlockNode]="true">
<nz-tree-view [nzTreeControl]="treeControl" [nzDataSource]="dataSource" nzBlockNode>
<nz-tree-node *nzTreeNodeDef="let node" nzTreeNodePadding>
<nz-tree-node-toggle nzTreeNodeNoopToggle></nz-tree-node-toggle>
<nz-tree-node-option [nzDisabled]="node.disabled" [nzSelected]="false" (nzClick)="insertCode(node)">
<span class="text-sm text-blue-400"> {{ node.name }}</span>
<ng-container *ngIf="node.note">
<span [nzTooltipTitle]="titleTemplate" [nzTooltipPlacement]="['topLeft', 'leftTop']" class="text-blue-400"
nzTooltipColor="black" nz-tooltip>
<span
[nzTooltipTitle]="titleTemplate"
[nzTooltipPlacement]="['topLeft', 'leftTop']"
class="text-blue-400"
nzTooltipColor="black"
nz-tooltip
>
[?]
</span>
<ng-template #titleTemplate let-thing>
Expand All @@ -36,7 +47,6 @@
</ng-container>
</nz-tree-node-option>
</nz-tree-node>

<nz-tree-node *nzTreeNodeDef="let node; when: hasChild" nzTreeNodePadding>
<nz-tree-node-toggle>
<i nz-icon nzType="caret-down" nzTreeNodeToggleRotateIcon></i>
Expand All @@ -48,8 +58,13 @@
</nz-tree-view>
</div>
<div class="flex-1">
<eo-editor [(code)]="code" editorType="javascript" [eventList]="['format', 'copy', 'search', 'replace']"
(codeChange)="handleChange($event)" [completions]="completions">
<eo-editor
[(code)]="code"
editorType="javascript"
[eventList]="['format', 'copy', 'search', 'replace']"
(codeChange)="handleChange($event)"
[completions]="completions"
>
</eo-editor>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const COMMON_DATA: TreeNode[] = [
],
},
{
name: $localize`Encode & Decode`, // 编解码
name: $localize`Encode and Decode`, // 编解码
children: [
{
name: $localize`JSON Encode`, // JSON 编码
Expand Down Expand Up @@ -246,7 +246,7 @@ const COMMON_DATA: TreeNode[] = [
],
},
{
name: $localize`Encryption And Decryption`, // 加解密
name: $localize`Encryption and Decryption`, // 加解密
children: [
{
name: $localize`MD5`, // MD5
Expand Down

0 comments on commit 3b2373f

Please sign in to comment.