From a423c0e195406abfdf1e4cffa5ac2d190ad047c9 Mon Sep 17 00:00:00 2001 From: Chris Lawton <chris.lawton@torchbox.com> Date: Fri, 10 May 2019 12:37:26 +0100 Subject: [PATCH] update data-comment with markdown, not the markup --- opentech/static_src/src/javascript/apply/edit-comment.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opentech/static_src/src/javascript/apply/edit-comment.js b/opentech/static_src/src/javascript/apply/edit-comment.js index 54012df29..d38492f25 100644 --- a/opentech/static_src/src/javascript/apply/edit-comment.js +++ b/opentech/static_src/src/javascript/apply/edit-comment.js @@ -57,6 +57,8 @@ const commentContainer = $(this).closest(editBlock).siblings(comment); const id = $(commentContainer).attr('data-id'); const editedComment = $(this).closest(pageDown).find('.wmd-preview').html(); + const commentMD = $(this).closest(editBlock).find('textarea').val(); + $(commentContainer).attr('data-comment', commentMD); // TODO - get correct URL const url = `${window.location.origin}/apply/api/comments/${id}/edit/`; @@ -105,7 +107,8 @@ }; const updateComment = (el, id, newComment) => { - $(el).html(newComment).data('comment', newComment).data('id', id); + $(el).attr('data-id', id); + $(el).html(newComment); }; const closeAllEditors = () => { -- GitLab