Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

clipper: remove images from clip if images false Signed-off-by: 01zulfi <[email protected]>

01zulfifaaf1eeadfcb
diff --git a/packages/clipper/src/domtoimage.ts b/packages/clipper/src/domtoimage.ts
index bd41553ac..43d94d03c 100644
--- a/packages/clipper/src/domtoimage.ts
+++ b/packages/clipper/src/domtoimage.ts
@@ -36,7 +36,8 @@ const defaultOptions: Options = {
};
async function getInlinedNode(node: HTMLElement, options: Options) {
- const { fonts, stylesheets, inlineImages } = options.inlineOptions || {};
+ const { fonts, images, stylesheets, inlineImages } =
+ options.inlineOptions || {};
if (stylesheets) await inlineStylesheets(options.fetchOptions);
@@ -44,6 +45,11 @@ async function getInlinedNode(node: HTMLElement, options: Options) {
if (!clone || clone instanceof Text) return;
+ if (!images) {
+ const images = clone.querySelectorAll("img");
+ images.forEach((image) => image.remove());
+ }
+
if (fonts) clone = await embedFonts(clone, options.fetchOptions);
if (inlineImages) await inlineAllImages(clone, options.fetchOptions);