From 40b4ed0fdb461aa3e08701809e83842fb21c6cb7 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Wed, 21 Sep 2022 13:45:49 +0200 Subject: [PATCH] Make ImageAnchors downloadable --- src/page/basics/image-anchor/image-anchor.html.ts | 3 +++ src/page/basics/image-anchor/image-anchor.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/page/basics/image-anchor/image-anchor.html.ts b/src/page/basics/image-anchor/image-anchor.html.ts index 5898193..1a58ef3 100644 --- a/src/page/basics/image-anchor/image-anchor.html.ts +++ b/src/page/basics/image-anchor/image-anchor.html.ts @@ -6,15 +6,18 @@ export const generate = ({ href, svg, title, + shouldDownload, }: { href: url; svg: url; title: string; + shouldDownload: boolean; }): html => `
${svg} diff --git a/src/page/basics/image-anchor/image-anchor.ts b/src/page/basics/image-anchor/image-anchor.ts index 84a9499..b0c3034 100644 --- a/src/page/basics/image-anchor/image-anchor.ts +++ b/src/page/basics/image-anchor/image-anchor.ts @@ -3,9 +3,13 @@ import { createElement } from '../../../helper/create-element'; import { url } from '../../../types/url'; import { generate } from './image-anchor.html'; -export const ImageAnchorFactory = (svg: string, title: string) => +export const ImageAnchorFactory = ( + svg: string, + title: string, + { shouldDownload = false }: { shouldDownload?: boolean } = {} +) => class ImageAnchor extends PageElement { public constructor(href: url) { - super(createElement(generate({ href, svg, title }))); + super(createElement(generate({ href, svg, title, shouldDownload }))); } };