Преглед на файлове

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

bubble
Kyle Shockey преди 7 години
родител
ревизия
21100a0a8b
No known key found for this signature in database GPG ключ ID: DC20D559FFBC0D36
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. +6
    -0
      src/core/components/providers/markdown.jsx

+ 6
- 0
src/core/components/providers/markdown.jsx Целия файл

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


Зареждане…
Отказ
Запис