Add default values
This commit is contained in:
parent
e603d8b518
commit
1de3d52d57
@ -13,16 +13,16 @@ const defaultWidgetRules: WidgetRulesFactory = ({ getAsset, field }) => [
|
|||||||
if (matched?.length === 4) {
|
if (matched?.length === 4) {
|
||||||
// Image
|
// Image
|
||||||
const img = document.createElement('img');
|
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.setAttribute('style', 'width: 100%;');
|
||||||
img.innerHTML = 'test';
|
img.innerHTML = matched[2] ?? '';
|
||||||
return img;
|
return img;
|
||||||
} else {
|
} else {
|
||||||
// File
|
// File
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.setAttribute('target', '_blank');
|
a.setAttribute('target', '_blank');
|
||||||
a.setAttribute('href', matched[2]);
|
a.setAttribute('href', matched[2] ?? '');
|
||||||
a.innerHTML = matched[1];
|
a.innerHTML = matched[1] ?? '';
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user