Skip to content

Commit

Permalink
feat: add options to the getValue api
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Jun 6, 2024
1 parent 53701fc commit 65acd58
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 26 deletions.
10 changes: 3 additions & 7 deletions docs/en/guide/command-get.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ Usage:

```javascript
const {
version: string;
width: number;
height: number;
margins: IMargin;
header?: IHeader;
watermark?: IWatermark;
data: IEditorData;
version: string
data: IEditorData
options: IEditorOption
} = instance.command.getValue(options?: IGetValueOption)
```

Expand Down
10 changes: 3 additions & 7 deletions docs/guide/command-get.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ const value = instance.command.commandName()

```javascript
const {
version: string;
width: number;
height: number;
margins: IMargin;
header?: IHeader;
watermark?: IWatermark;
data: IEditorData;
version: string
data: IEditorData
options: IEditorOption
} = instance.command.getValue(options?: IGetValueOption)
```

Expand Down
10 changes: 2 additions & 8 deletions src/editor/core/draw/Draw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,9 +998,6 @@ export class Draw {
}

public getValue(options: IGetValueOption = {}): IEditorResult {
// 配置
const { width, height, margins, watermark } = this.options
// 数据
const { pageNo } = options
let mainElementList = this.elementList
if (
Expand All @@ -1019,11 +1016,8 @@ export class Draw {
}
return {
version,
width,
height,
margins,
watermark: watermark.data ? watermark : undefined,
data
data,
options: deepClone(this.options)
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/editor/interface/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,8 @@ export interface IEditorOption {

export interface IEditorResult {
version: string
width: number
height: number
margins: IMargin
watermark?: IWatermark
data: IEditorData
options: IEditorOption
}

export interface IEditorHTML {
Expand Down

0 comments on commit 65acd58

Please sign in to comment.