Skip to content

Commit

Permalink
feat: add getContainer api
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Oct 11, 2023
1 parent 760f06b commit c944872
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/en/guide/command-get.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,13 @@ const {
innerText: string | null
} = await instance.command.getControlValue(payload: IGetControlValueOption)
```

## getContainer

Feature: Get editor container

Usage:

```javascript
const container = await instance.command.getContainer()
```
10 changes: 10 additions & 0 deletions docs/guide/command-get.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,13 @@ const {
innerText: string | null
} = await instance.command.getControlValue(payload: IGetControlValueOption)
```

## getContainer

功能:获取编辑器容器

用法:

```javascript
const container = await instance.command.getContainer()
```
2 changes: 2 additions & 0 deletions src/editor/core/command/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class Command {
public getLocale: CommandAdapt['getLocale']
public getGroupIds: CommandAdapt['getGroupIds']
public getControlValue: CommandAdapt['getControlValue']
public getContainer: CommandAdapt['getContainer']

constructor(adapt: CommandAdapt) {
// 全局命令
Expand Down Expand Up @@ -205,6 +206,7 @@ export class Command {
this.getSearchNavigateInfo = adapt.getSearchNavigateInfo.bind(adapt)
this.getLocale = adapt.getLocale.bind(adapt)
this.getGroupIds = adapt.getGroupIds.bind(adapt)
this.getContainer = adapt.getContainer.bind(adapt)
// 控件
this.executeSetControlValue = adapt.setControlValue.bind(adapt)
this.getControlValue = adapt.getControlValue.bind(adapt)
Expand Down
4 changes: 4 additions & 0 deletions src/editor/core/command/CommandAdapt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2082,4 +2082,8 @@ export class CommandAdapt {
if (isReadonly) return
this.draw.getControl().setValueByConceptId(payload)
}

public getContainer(): HTMLDivElement {
return this.draw.getContainer()
}
}

0 comments on commit c944872

Please sign in to comment.