Skip to content

Commit

Permalink
fix(plugin:export): it should have default value 'true' through doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Sorryhx committed Dec 20, 2023
1 parent 1a27a2a commit bf5d472
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/x6-plugin-export/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ export class Export extends Basecoat<Export.EventArgs> 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
Expand Down

0 comments on commit bf5d472

Please sign in to comment.