From 394346810ad025ed3bd056b5d8f089d875912d8c Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Date: Wed, 7 Sep 2022 04:29:25 +0000 Subject: [PATCH] Merged in export-fix (pull request #60) Export fix * fix image export * fix export unit tests --- packages/mindplot/src/components/export/SVGExporter.ts | 2 +- packages/mindplot/test/unit/export/expected/bug2.svg | 2 +- packages/mindplot/test/unit/export/expected/bug3.svg | 2 +- packages/mindplot/test/unit/export/expected/cdata-support.svg | 2 +- packages/mindplot/test/unit/export/expected/complex.svg | 2 +- packages/mindplot/test/unit/export/expected/emptyNodes.svg | 2 +- packages/mindplot/test/unit/export/expected/enc.svg | 2 +- packages/mindplot/test/unit/export/expected/i18n.svg | 2 +- packages/mindplot/test/unit/export/expected/i18n2.svg | 2 +- packages/mindplot/test/unit/export/expected/issue.svg | 2 +- packages/mindplot/test/unit/export/expected/npe.svg | 2 +- packages/mindplot/test/unit/export/expected/process.svg | 2 +- packages/mindplot/test/unit/export/expected/welcome.svg | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/mindplot/src/components/export/SVGExporter.ts b/packages/mindplot/src/components/export/SVGExporter.ts index caf575a5..f72de06c 100644 --- a/packages/mindplot/src/components/export/SVGExporter.ts +++ b/packages/mindplot/src/components/export/SVGExporter.ts @@ -65,7 +65,7 @@ class SVGExporter extends Exporter { private _calcualteDimensions(): { minX: number; maxX: number; minY: number; maxY: number } { // Collect all group elements ... - const rectElems = Array.from(document.querySelectorAll('g>rect')); + const rectElems = Array.from(this.svgElement.querySelectorAll('g>rect')); const translates: SizeType[] = rectElems.map((rect: Element) => { const g = rect.parentElement; const transformStr = g.getAttribute('transform'); diff --git a/packages/mindplot/test/unit/export/expected/bug2.svg b/packages/mindplot/test/unit/export/expected/bug2.svg index 2091190d..e6f04a01 100644 --- a/packages/mindplot/test/unit/export/expected/bug2.svg +++ b/packages/mindplot/test/unit/export/expected/bug2.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/mindplot/test/unit/export/expected/bug3.svg b/packages/mindplot/test/unit/export/expected/bug3.svg index f2f5ff45..7817f10f 100644 --- a/packages/mindplot/test/unit/export/expected/bug3.svg +++ b/packages/mindplot/test/unit/export/expected/bug3.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/mindplot/test/unit/export/expected/cdata-support.svg b/packages/mindplot/test/unit/export/expected/cdata-support.svg index 98152aa4..59b26f9f 100644 --- a/packages/mindplot/test/unit/export/expected/cdata-support.svg +++ b/packages/mindplot/test/unit/export/expected/cdata-support.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/mindplot/test/unit/export/expected/complex.svg b/packages/mindplot/test/unit/export/expected/complex.svg index 343f1cef..e03ebd1a 100644 --- a/packages/mindplot/test/unit/export/expected/complex.svg +++ b/packages/mindplot/test/unit/export/expected/complex.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/mindplot/test/unit/export/expected/emptyNodes.svg b/packages/mindplot/test/unit/export/expected/emptyNodes.svg index 9f9e20c6..2a03e5f5 100644 --- a/packages/mindplot/test/unit/export/expected/emptyNodes.svg +++ b/packages/mindplot/test/unit/export/expected/emptyNodes.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/mindplot/test/unit/export/expected/enc.svg b/packages/mindplot/test/unit/export/expected/enc.svg index 74481d31..3267f83b 100644 --- a/packages/mindplot/test/unit/export/expected/enc.svg +++ b/packages/mindplot/test/unit/export/expected/enc.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/mindplot/test/unit/export/expected/i18n.svg b/packages/mindplot/test/unit/export/expected/i18n.svg index 351707ef..be67c73c 100644 --- a/packages/mindplot/test/unit/export/expected/i18n.svg +++ b/packages/mindplot/test/unit/export/expected/i18n.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/mindplot/test/unit/export/expected/i18n2.svg b/packages/mindplot/test/unit/export/expected/i18n2.svg index d79c9227..b74f0550 100644 --- a/packages/mindplot/test/unit/export/expected/i18n2.svg +++ b/packages/mindplot/test/unit/export/expected/i18n2.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/mindplot/test/unit/export/expected/issue.svg b/packages/mindplot/test/unit/export/expected/issue.svg index 7a2a354b..c9112616 100644 --- a/packages/mindplot/test/unit/export/expected/issue.svg +++ b/packages/mindplot/test/unit/export/expected/issue.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/mindplot/test/unit/export/expected/npe.svg b/packages/mindplot/test/unit/export/expected/npe.svg index 12c7461d..7ea0641b 100644 --- a/packages/mindplot/test/unit/export/expected/npe.svg +++ b/packages/mindplot/test/unit/export/expected/npe.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/mindplot/test/unit/export/expected/process.svg b/packages/mindplot/test/unit/export/expected/process.svg index 5198b29b..1175e072 100644 --- a/packages/mindplot/test/unit/export/expected/process.svg +++ b/packages/mindplot/test/unit/export/expected/process.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/mindplot/test/unit/export/expected/welcome.svg b/packages/mindplot/test/unit/export/expected/welcome.svg index e0b2c360..5a2fce63 100644 --- a/packages/mindplot/test/unit/export/expected/welcome.svg +++ b/packages/mindplot/test/unit/export/expected/welcome.svg @@ -1,4 +1,4 @@ - +