From 42b1c510bbeb1152edaada9e85a91ee92ebc6d03 Mon Sep 17 00:00:00 2001 From: Giulia Ghisini Date: Mon, 18 Sep 2023 11:21:03 +0200 Subject: [PATCH] fix: ffix load marked lib --- src/components/ReleaseLog/ReleaseLog.jsx | 13 ++++++------- src/config/italiaConfig.js | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/ReleaseLog/ReleaseLog.jsx b/src/components/ReleaseLog/ReleaseLog.jsx index 43ce1131e..b372c90f5 100644 --- a/src/components/ReleaseLog/ReleaseLog.jsx +++ b/src/components/ReleaseLog/ReleaseLog.jsx @@ -14,11 +14,11 @@ import { TabPane, } from 'design-react-kit'; import { Helmet } from '@plone/volto/helpers'; -import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable'; +import { marked } from 'marked'; import './ReleaseLog.css'; -const ReleaseLog = ({ marked }) => { +const ReleaseLog = () => { let ReleaseDCPT = null; let ReleaseIoCittadino = null; let ReleaseIoPrenoto = null; @@ -47,7 +47,6 @@ const ReleaseLog = ({ marked }) => { { name: 'io-prenoto', file: ReleaseIoPrenoto }, ]; - const Markdown = marked.marked; const [activeTab, toggleTab] = useState(LOGS_TO_VIEW[0].name); const [logDCPT, setLogDCPT] = useState(''); const [logIoCittadino, setLogIoCittadino] = useState(''); @@ -59,7 +58,7 @@ const ReleaseLog = ({ marked }) => { fetch(ReleaseDCPT) .then((res) => res.text()) .then((text) => { - setLogDCPT(Markdown(text)); + setLogDCPT(marked(text)); }); } catch { console.log(ReleaseDCPT + ' not found.'); @@ -70,7 +69,7 @@ const ReleaseLog = ({ marked }) => { fetch(ReleaseIoCittadino) .then((res) => res.text()) .then((text) => { - setLogIoCittadino(Markdown(text)); + setLogIoCittadino(marked(text)); }); } catch { console.log(ReleaseIoCittadino + ' not found.'); @@ -81,7 +80,7 @@ const ReleaseLog = ({ marked }) => { fetch(ReleaseIoPrenoto) .then((res) => res.text()) .then((text) => { - setLogIoPrenoto(Markdown(text)); + setLogIoPrenoto(marked(text)); }); } catch { console.log(ReleaseIoPrenoto + ' not found.'); @@ -145,4 +144,4 @@ const ReleaseLog = ({ marked }) => { ); }; -export default injectLazyLibs(['marked'])(ReleaseLog); +export default ReleaseLog; diff --git a/src/config/italiaConfig.js b/src/config/italiaConfig.js index 9c4d6fba3..a3ebafa65 100644 --- a/src/config/italiaConfig.js +++ b/src/config/italiaConfig.js @@ -501,7 +501,7 @@ export default function applyConfig(voltoConfig) { component: LoginAgid, }, { - path: ['/controlpanel/release-log','/release-log'], + path: ['/controlpanel/release-log', '/release-log'], component: ReleaseLog, }, ];