From 67c63f856f2c0e3e8c0644e39694357639c18d7e Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Thu, 18 Jul 2024 18:06:43 +0800 Subject: [PATCH] feat: add custom field to getValue api #699 --- src/editor/core/draw/Draw.ts | 14 ++++++++++---- src/editor/interface/Draw.ts | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/editor/core/draw/Draw.ts b/src/editor/core/draw/Draw.ts index 1a02e90..4c77789 100644 --- a/src/editor/core/draw/Draw.ts +++ b/src/editor/core/draw/Draw.ts @@ -1005,7 +1005,7 @@ export class Draw { } public getValue(options: IGetValueOption = {}): IEditorResult { - const { pageNo } = options + const { pageNo, extraPickAttrs } = options let mainElementList = this.elementList if ( Number.isInteger(pageNo) && @@ -1017,9 +1017,15 @@ export class Draw { ) } const data: IEditorData = { - header: zipElementList(this.getHeaderElementList()), - main: zipElementList(mainElementList), - footer: zipElementList(this.getFooterElementList()) + header: zipElementList(this.getHeaderElementList(), { + extraPickAttrs + }), + main: zipElementList(mainElementList, { + extraPickAttrs + }), + footer: zipElementList(this.getFooterElementList(), { + extraPickAttrs + }) } return { version, diff --git a/src/editor/interface/Draw.ts b/src/editor/interface/Draw.ts index da5bd9e..06483fb 100644 --- a/src/editor/interface/Draw.ts +++ b/src/editor/interface/Draw.ts @@ -54,6 +54,7 @@ export interface IPainterOption { export interface IGetValueOption { pageNo?: number + extraPickAttrs?: Array } export interface IAppendElementListOption {