if-else statement to be sure that the markdown library doesn't create issues with empty strings.

This commit is contained in:
Jose Garay 2019-05-15 08:10:44 -07:00
parent feb98a5ac7
commit bda3fb5f4d

View file

@ -3,8 +3,11 @@ import habiticaMarkdown from 'habitica-markdown';
export default function markdown (el, {value, oldValue}) {
if (value === oldValue) return;
if (value || value === '') {
if (value) {
el.innerHTML = habiticaMarkdown.render(String(value));
} else {
el.innerHTML = '';
}
el.classList.add('markdown');
}