From 1de3d52d577de7bde3da4aaf08e15e0378163c04 Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Wed, 26 Oct 2022 17:17:51 -0400 Subject: [PATCH] Add default values --- core/src/widgets/markdown/config/widgetRules.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/widgets/markdown/config/widgetRules.ts b/core/src/widgets/markdown/config/widgetRules.ts index 3649ac99..13964b16 100644 --- a/core/src/widgets/markdown/config/widgetRules.ts +++ b/core/src/widgets/markdown/config/widgetRules.ts @@ -13,16 +13,16 @@ const defaultWidgetRules: WidgetRulesFactory = ({ getAsset, field }) => [ if (matched?.length === 4) { // Image const img = document.createElement('img'); - img.setAttribute('src', getAsset(matched[3], field).url); + img.setAttribute('src', getAsset(matched[3] ?? '', field).url); img.setAttribute('style', 'width: 100%;'); - img.innerHTML = 'test'; + img.innerHTML = matched[2] ?? ''; return img; } else { // File const a = document.createElement('a'); a.setAttribute('target', '_blank'); - a.setAttribute('href', matched[2]); - a.innerHTML = matched[1]; + a.setAttribute('href', matched[2] ?? ''); + a.innerHTML = matched[1] ?? ''; return a; } }