diff --git a/web/themes/custom/caravane/assets/js/stores/content.js b/web/themes/custom/caravane/assets/js/stores/content.js index 25861cb..63ad6c4 100644 --- a/web/themes/custom/caravane/assets/js/stores/content.js +++ b/web/themes/custom/caravane/assets/js/stores/content.js @@ -147,7 +147,31 @@ export const useContentStore = defineStore('content', { break; case 'titre_texte': partieContent.titre = partie.attributes.field_titre; - partieContent.texte = partie.attributes.field_texte.value; + partieContent.texte = partie.attributes.field_texte.value; + + // get the resized images from the text + const imgRegex = /]+>/g; + const uuidRegex = /data-entity-uuid="([^"]+)"/; + + const imgTags = partieContent.texte.match(imgRegex); + + if (imgTags) { + for (const imgTag of imgTags) { + const uuidMatch = imgTag.match(uuidRegex); + if (uuidMatch && uuidMatch[1]) { + const uuid = uuidMatch[1]; + + const response = await REST.get(`/jsonapi/file/file/${uuid}`); + const imagesFetch = response.data.data; + + const newImgTag = imgTag + .replace(/src="[^"]+"/,`src="${imagesFetch.attributes.image_style_uri.content_medium}"`) + .replace('>',' data-large-src="' + imagesFetch.attributes.image_style_uri.content_large + '">'); + partieContent.texte = partieContent.texte.replace(imgTag, newImgTag); + } + } + } + break; case 'chiffres_cles': const chiffresClesFetch = await this.fetchFromRelationships('field_chiffres_clefs', partie.relationships); diff --git a/web/themes/custom/caravane/assets/js/vuejs/components/ImageModale.vue b/web/themes/custom/caravane/assets/js/vuejs/components/ImageModale.vue index 075eddc..42136c2 100644 --- a/web/themes/custom/caravane/assets/js/vuejs/components/ImageModale.vue +++ b/web/themes/custom/caravane/assets/js/vuejs/components/ImageModale.vue @@ -2,51 +2,50 @@
-
- -
{{ image.alt }}
-
-
-
-
- - - - - -
-
- +
+ +
{{ image.alt }}
+
-
+
+
+ + + + + +
+
+ + + @@ -131,6 +144,7 @@ const handleImageClick = (event) => { .partie-content { img { + box-sizing: border-box; margin-top: 2rem; cursor: pointer; transition: transform 0.3s ease-out;