From 2094a4d4b835efdac886682d1b3399092d3a6ec3 Mon Sep 17 00:00:00 2001 From: Jose Garay Date: Sat, 11 May 2019 23:47:24 -0700 Subject: [PATCH 1/3] Task notes now disappear when they are deleted from the main task. --- website/client/components/tasks/task.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/client/components/tasks/task.vue b/website/client/components/tasks/task.vue index fbdc7a2d2e..b3d9cb9517 100644 --- a/website/client/components/tasks/task.vue +++ b/website/client/components/tasks/task.vue @@ -43,7 +43,7 @@ span.text {{ $t('delete') }} .task-notes.small-text( - v-markdown="task.notes", + v-html="task.notes", :class="{'has-checklist': task.notes && hasChecklist}", ) .checklist(v-if="canViewchecklist", :class="{isOpen: !task.collapseChecklist}") From feb98a5ac7476cfef5ab65965eed2994254c2e10 Mon Sep 17 00:00:00 2001 From: Jose Garay Date: Tue, 14 May 2019 19:06:22 -0700 Subject: [PATCH 2/3] Html component changed back to Markdown. Markdown logic now accounts for if the value is an empty string. --- website/client/components/tasks/task.vue | 2 +- website/client/directives/markdown.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/website/client/components/tasks/task.vue b/website/client/components/tasks/task.vue index b3d9cb9517..fbdc7a2d2e 100644 --- a/website/client/components/tasks/task.vue +++ b/website/client/components/tasks/task.vue @@ -43,7 +43,7 @@ span.text {{ $t('delete') }} .task-notes.small-text( - v-html="task.notes", + v-markdown="task.notes", :class="{'has-checklist': task.notes && hasChecklist}", ) .checklist(v-if="canViewchecklist", :class="{isOpen: !task.collapseChecklist}") diff --git a/website/client/directives/markdown.js b/website/client/directives/markdown.js index 98c174f431..2f892675af 100644 --- a/website/client/directives/markdown.js +++ b/website/client/directives/markdown.js @@ -3,7 +3,7 @@ import habiticaMarkdown from 'habitica-markdown'; export default function markdown (el, {value, oldValue}) { if (value === oldValue) return; - if (value) { + if (value || value === '') { el.innerHTML = habiticaMarkdown.render(String(value)); } el.classList.add('markdown'); From bda3fb5f4d15fc1009fab409dbf0a235baafb0e2 Mon Sep 17 00:00:00 2001 From: Jose Garay Date: Wed, 15 May 2019 08:10:44 -0700 Subject: [PATCH 3/3] if-else statement to be sure that the markdown library doesn't create issues with empty strings. --- website/client/directives/markdown.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/website/client/directives/markdown.js b/website/client/directives/markdown.js index 2f892675af..bc2cd0a458 100644 --- a/website/client/directives/markdown.js +++ b/website/client/directives/markdown.js @@ -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'); } \ No newline at end of file