From 65acd580d6813bd15b8ee079b16ae8d5f9e77767 Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Thu, 6 Jun 2024 20:51:46 +0800 Subject: [PATCH] feat: add options to the getValue api --- docs/en/guide/command-get.md | 10 +++------- docs/guide/command-get.md | 10 +++------- src/editor/core/draw/Draw.ts | 10 ++-------- src/editor/interface/Editor.ts | 5 +---- 4 files changed, 9 insertions(+), 26 deletions(-) diff --git a/docs/en/guide/command-get.md b/docs/en/guide/command-get.md index f758a34..3fb6387 100644 --- a/docs/en/guide/command-get.md +++ b/docs/en/guide/command-get.md @@ -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) ``` diff --git a/docs/guide/command-get.md b/docs/guide/command-get.md index da99397..c7541eb 100644 --- a/docs/guide/command-get.md +++ b/docs/guide/command-get.md @@ -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) ``` diff --git a/src/editor/core/draw/Draw.ts b/src/editor/core/draw/Draw.ts index 6e5bfdd..a5f83eb 100644 --- a/src/editor/core/draw/Draw.ts +++ b/src/editor/core/draw/Draw.ts @@ -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 ( @@ -1019,11 +1016,8 @@ export class Draw { } return { version, - width, - height, - margins, - watermark: watermark.data ? watermark : undefined, - data + data, + options: deepClone(this.options) } } diff --git a/src/editor/interface/Editor.ts b/src/editor/interface/Editor.ts index 2c08bb3..e05f7c2 100644 --- a/src/editor/interface/Editor.ts +++ b/src/editor/interface/Editor.ts @@ -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 {