From b8d50ecb46ef2a17a556deac0efe4d481675ce2c Mon Sep 17 00:00:00 2001 From: alicedraillard Date: Thu, 5 Dec 2024 18:17:46 +0100 Subject: [PATCH 01/12] chore: prepare next development iteration --- backend/deployment/magneto/conf.json.template | 2 +- backend/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/deployment/magneto/conf.json.template b/backend/deployment/magneto/conf.json.template index 61c45c6f..66ab13c5 100644 --- a/backend/deployment/magneto/conf.json.template +++ b/backend/deployment/magneto/conf.json.template @@ -1,5 +1,5 @@ { - "name": "fr.cgi~magneto~2.0.0", + "name": "fr.cgi~magneto~${magnetoVersion}", "config": { "main" : "fr.cgi.magneto.Magneto", "port" : 8205, diff --git a/backend/pom.xml b/backend/pom.xml index e6313b7e..ddcbfe77 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -9,7 +9,7 @@ fr.cgi magneto - 2.0.0 + 2.0-SNAPSHOT scm:git:https://github.com/OPEN-ENT-NG/magneto.git scm:git:https://github.com/OPEN-ENT-NG/magneto.git From 56620229d2b8811fa8f20818d76eb407170687de Mon Sep 17 00:00:00 2001 From: alicedraillard Date: Fri, 6 Dec 2024 16:49:20 +0100 Subject: [PATCH 02/12] chore: update edifice-ts-client version --- frontend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/package.json b/frontend/package.json index 5e345a84..c9c48d97 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -111,7 +111,7 @@ "concurrently": "8.2.1", "csstype": "3.1.2", "dotenv-cli": "^7.4.2", - "edifice-ts-client": "1.5.23", + "edifice-ts-client": "1.7.4", "eslint": "8.51.0", "eslint-config-prettier": "9.0.0", "eslint-plugin-import": "2.28.1", From b45887bdf285428b9a5133d44a041e658313017b Mon Sep 17 00:00:00 2001 From: Benjamin Perez Date: Mon, 9 Dec 2024 12:05:04 +0100 Subject: [PATCH 03/12] fix: remove useless property in pom.xml --- backend/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/pom.xml b/backend/pom.xml index ddcbfe77..b1d612a3 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -32,7 +32,6 @@ 2.0.0-final - 2.0.0 2.0.2 [2.0,3.0) 6.0-SNAPSHOT From 128eacd15bb2e9c8e7d6703c20919f755b8cdcf7 Mon Sep 17 00:00:00 2001 From: Florent Mariotti Date: Fri, 13 Dec 2024 17:09:39 +0100 Subject: [PATCH 04/12] WIP (trying to scale iframe) --- .../card-content-board/CardContentBoard.tsx | 127 ++++++++++++++++++ .../components/create-magnet/CreateMagnet.tsx | 2 + 2 files changed, 129 insertions(+) create mode 100644 frontend/src/components/card-content-board/CardContentBoard.tsx diff --git a/frontend/src/components/card-content-board/CardContentBoard.tsx b/frontend/src/components/card-content-board/CardContentBoard.tsx new file mode 100644 index 00000000..75d30dc1 --- /dev/null +++ b/frontend/src/components/card-content-board/CardContentBoard.tsx @@ -0,0 +1,127 @@ +import React, { useState, useEffect, useRef, useCallback } from 'react'; + +interface CustomIframeProps { + src: string; + width?: number; + height?: number; +} + +export const CustomIframe: React.FC = ({ + src, + width = 1500, + height = 800 +}) => { + const iframeRef = useRef(null); + const [isLoaded, setIsLoaded] = useState(false); + const [scale, setScale] = useState(1); + + const adjustIframeScale = useCallback(() => { + const iframe = iframeRef.current; + if (!iframe) return; + + try { + // Utiliser un délai pour s'assurer que le contenu est chargé + setTimeout(() => { + const iframeWindow = iframe.contentWindow; + const iframeDocument = iframe.contentDocument || iframeWindow?.document; + + if (!iframeDocument) return; + + // Essayer différentes méthodes pour obtenir les dimensions + const contentWidth = Math.max( + iframeDocument.body?.scrollWidth || 0, + iframeDocument.documentElement?.scrollWidth || 0, + iframeWindow?.innerWidth || 0 + ); + + const contentHeight = Math.max( + iframeDocument.body?.scrollHeight || 0, + iframeDocument.documentElement?.scrollHeight || 0, + iframeWindow?.innerHeight || 0 + ); + + // Calculer l'échelle + const scaleX = width / contentWidth; + const scaleY = height / contentHeight; + + // Prendre le zoom le plus petit, mais sans dépasser 1 + const newScale = Math.min(scaleX, scaleY, 1); + + // Mettre à jour le state pour déclencher un re-render + setScale(newScale); + + console.log('Iframe Scaling:', { + contentWidth, + contentHeight, + scaleX, + scaleY, + finalScale: newScale + }); + }, 1000); // Délai plus long pour charger le contenu + } catch (error) { + console.error('Erreur de scaling de l\'iframe:', error); + } + }, [width, height]); + + // Gérer le chargement et le scaling + const handleIframeLoad = useCallback(() => { + setIsLoaded(true); + adjustIframeScale(); + + // Ajouter un écouteur de redimensionnement + window.addEventListener('resize', adjustIframeScale); + + return () => { + window.removeEventListener('resize', adjustIframeScale); + }; + }, [adjustIframeScale]); + + // Effet pour gérer l'événement de chargement + useEffect(() => { + const iframe = iframeRef.current; + if (iframe) { + iframe.addEventListener('load', handleIframeLoad); + + return () => { + iframe.removeEventListener('load', handleIframeLoad); + }; + } + }, [handleIframeLoad]); + + return ( +
+