diff --git a/src/components/OrchInfoViewer.js b/src/components/OrchInfoViewer.js index 0dc3dd0..5ab5490 100644 --- a/src/components/OrchInfoViewer.js +++ b/src/components/OrchInfoViewer.js @@ -27,6 +27,17 @@ function copyLink(addr) { }); } +function nl2br(str) { + if (typeof str === "undefined" || str === null) { + return ""; + } + var breakTag = "
"; // "
" + return (str + "").replace( + /([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, + "$1" + breakTag + "$2" + ); +} + const OrchInfoViewer = (obj) => { const [opened, setOpened] = useState(false); const livepeer = useSelector((state) => state.livepeerstate); @@ -122,26 +133,32 @@ const OrchInfoViewer = (obj) => { if (ensDescription) { if (ensDescription.length < 200) { descriptionObj = -

- {ensDescription} -

+
} else { descriptionObj = setOpened(false)} target={ -

setOpened((o) => !o)}> - {ensDescription.substring(0, 200)}... -

+
setOpened((o) => !o)} + dangerouslySetInnerHTML={{ + __html: nl2br(ensDescription.substring(0, 200) + "..."), + }} + /> } width={260} position="right" withArrow > -

- {ensDescription} -

+
} }