Skip to content

Commit

Permalink
fix: ffix load marked lib
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliaghisini committed Sep 18, 2023
1 parent 8acd7ba commit 42b1c51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/components/ReleaseLog/ReleaseLog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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('');
Expand All @@ -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.');
Expand All @@ -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.');
Expand All @@ -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.');
Expand Down Expand Up @@ -145,4 +144,4 @@ const ReleaseLog = ({ marked }) => {
);
};

export default injectLazyLibs(['marked'])(ReleaseLog);
export default ReleaseLog;
2 changes: 1 addition & 1 deletion src/config/italiaConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
];
Expand Down

0 comments on commit 42b1c51

Please sign in to comment.