Skip to content

Commit e5e61ee

Browse files
committed
fix: remove deleted images from RAS document prior to exporting
1 parent f24e36e commit e5e61ee

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/studio-web/src/app/shared/download/download.service.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ Please host all assets on your server, include the font and package imports defi
129129
const images = await readalong.getImages();
130130
const page_nodes = doc.querySelectorAll("div[type=page]");
131131
const imageBlobs: Image[] = [];
132+
133+
// Remove all images that are there from before
134+
doc.querySelectorAll("graphic").forEach((e) => e.remove());
135+
132136
for (const [i, img] of Object.entries(images)) {
133137
let currentPage = page_nodes[parseInt(i)];
134138
// Add Image
135139
if (currentPage && img) {
136-
// Remove any images that are there from before
137-
currentPage.querySelectorAll("graphic").forEach((e) => e.remove());
138140
let graphic = doc.createElementNS(null, "graphic");
139141
let blob = await fetch(img)
140142
.then((r) => r.blob())
@@ -151,9 +153,6 @@ Please host all assets on your server, include the font and package imports defi
151153
graphic.setAttribute("url", `${path}`);
152154
}
153155
currentPage.appendChild(graphic);
154-
// Remove Images
155-
} else if (img === null) {
156-
currentPage.querySelectorAll("graphic").forEach((e) => e.remove());
157156
}
158157
}
159158
if (b64Embed) {

0 commit comments

Comments
 (0)