From 3c1348e0784a99cac66554426d5bf0f92eddfcce Mon Sep 17 00:00:00 2001 From: dbauszus-glx Date: Thu, 12 Oct 2023 11:32:03 +0100 Subject: [PATCH] ammend type:image method from plugin --- lib/ui/locations/entries/_entries.mjs | 12 +- lib/ui/locations/entries/cloudinary.mjs | 368 ++++++++++++++---------- lib/ui/locations/entries/geometry.mjs | 26 +- 3 files changed, 231 insertions(+), 175 deletions(-) diff --git a/lib/ui/locations/entries/_entries.mjs b/lib/ui/locations/entries/_entries.mjs index 8403489cd..2af0ae6be 100644 --- a/lib/ui/locations/entries/_entries.mjs +++ b/lib/ui/locations/entries/_entries.mjs @@ -39,6 +39,7 @@ export default { documents: cloudinary, geometry, html: textarea, + image: cloudinary, images: cloudinary, integer: numeric, json, @@ -67,13 +68,16 @@ function key(entry) { } function title(entry) { + + const tooltipSpan = entry.tooltip ? mapp.utils.html` + ${entry.tooltip}` : ''; + return mapp.utils.html.node`
${entry.title} - ${entry.tooltip ? mapp.utils.html` - ${entry.tooltip}`: ''}` + ${tooltipSpan}` } \ No newline at end of file diff --git a/lib/ui/locations/entries/cloudinary.mjs b/lib/ui/locations/entries/cloudinary.mjs index 1a7e093a4..882450692 100644 --- a/lib/ui/locations/entries/cloudinary.mjs +++ b/lib/ui/locations/entries/cloudinary.mjs @@ -1,233 +1,283 @@ const types = { - images, - documents + image, + images, + documents } const onload = { - images: imageLoad, - documents: docLoad + image: imageLoad, + images: imageLoad, + documents: docLoad } export default entry => types[entry.type](entry) +function image(entry) { + + // Create a new target if not provided with the entry. + //entry.target ??= mapp.utils.html.node`
` + + if (entry.value) { + + // Render image with src from cloudinary reference as value. + return mapp.utils.html.node` +
+ + ${entry.edit && mapp.utils.html` +