Ver código fonte

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

bubble
Kyle Shockey 7 anos atrás
pai
commit
21100a0a8b
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados ID da chave GPG: DC20D559FFBC0D36
1 arquivos alterados com 6 adições e 0 exclusões
  1. +6
    -0
      src/core/components/providers/markdown.jsx

+ 6
- 0
src/core/components/providers/markdown.jsx Ver arquivo

@@ -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}


Carregando…
Cancelar
Salvar