From bf5d4727440da1673087209c6640a84f4169c34b Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 20 Dec 2023 14:40:36 +0800 Subject: [PATCH] fix(plugin:export): it should have default value 'true' through doc --- packages/x6-plugin-export/src/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/x6-plugin-export/src/index.ts b/packages/x6-plugin-export/src/index.ts index cb734bec7e4..fc80fd7fcc7 100644 --- a/packages/x6-plugin-export/src/index.ts +++ b/packages/x6-plugin-export/src/index.ts @@ -49,6 +49,16 @@ export class Export extends Basecoat implements Graph.Plugin { toSVG(callback: Export.ToSVGCallback, options: Export.ToSVGOptions = {}) { this.notify('before:export', options) + // to keep pace with it's doc description witch, the default value should be true. + // without Object.hasOwn method cause by ts config target. + // without instance.hasOwnProperty method cause by ts rule. + // the condition will be false if these properties have been set undefined in the target, + // but will be true if these properties are not in the target, cause the doc. + !Object.prototype.hasOwnProperty.call(options, 'copyStyle') && + (options.copyStyles = true) + !Object.prototype.hasOwnProperty.call(options, 'serializeImages') && + (options.serializeImages = true) + const rawSVG = this.view.svg const vSVG = Vector.create(rawSVG).clone() let clonedSVG = vSVG.node as SVGSVGElement