Add default values

This commit is contained in:
Daniel Lautzenheiser 2022-10-26 17:17:51 -04:00
parent e603d8b518
commit 1de3d52d57

View File

@ -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;
}
}