fix(markdown): make sure to only render strings, fix #11080

This commit is contained in:
Matteo Pagliazzi
2019-03-31 19:38:34 +02:00
parent 0b65ac6c4f
commit 01281b6414
3 changed files with 6 additions and 3 deletions

View File

@@ -269,7 +269,8 @@ export default {
return highlightUsers(text, this.user.auth.local.username, this.user.profile.name); return highlightUsers(text, this.user.auth.local.username, this.user.profile.name);
}, },
parseMarkdown (text) { parseMarkdown (text) {
return habiticaMarkdown.render(text); if (!text) return;
return habiticaMarkdown.render(String(text));
}, },
}, },
}; };

View File

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

View File

@@ -46,7 +46,7 @@ export default {
}, },
markdown (val) { markdown (val) {
if (!val) return; if (!val) return;
let parsedMarkdown = habiticaMarkdown.render(val); let parsedMarkdown = habiticaMarkdown.render(String(val));
this.notify(parsedMarkdown, 'info'); this.notify(parsedMarkdown, 'info');
}, },
mp (val) { mp (val) {