Sfoglia il codice sorgente

Don't render Markdown if input or sanitized input is empty

bubble
Kyle Shockey 7 anni fa
parent
commit
21100a0a8b
Non sono state trovate chiavi note per questa firma nel database ID Chiave GPG: DC20D559FFBC0D36
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. +6
    -0
      src/core/components/providers/markdown.jsx

+ 6
- 0
src/core/components/providers/markdown.jsx Vedi File

@@ -11,6 +11,12 @@ const sanitizeOptions = {

function Markdown({ source }) {
const sanitized = sanitize(source, sanitizeOptions)

// sometimes the sanitizer returns "undefined" as a string
if(!source || !sanitized || sanitized === "undefined") {
return null
}

return <Remarkable
options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}}
source={sanitized}


Caricamento…
Annulla
Salva