diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-09-25 16:27:58 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-09-30 16:58:35 -0400 |
commit | 7c20f30f05d06fe2571bceed2b1aa3c5d38e9daa (patch) | |
tree | b3b9affa3308b4e96d5c9fe6effdcc7dc0002911 | |
parent | 9ade9a64519395d77b6ef143ad063103d6ff3d10 (diff) | |
download | gitlab-ce-7c20f30f05d06fe2571bceed2b1aa3c5d38e9daa.tar.gz |
Ensure notes are highlighted properly when they're updated
-rw-r--r-- | app/assets/javascripts/notes.js.coffee | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index ce638c2641b..4b9f0d68912 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -277,13 +277,15 @@ class @Notes Updates the current note field. ### - updateNote: (xhr, note, status) => - note_li = $(".note-row-" + note.id) - note_li.replaceWith(note.html) - note_li.find('.note-edit-form').hide() - note_li.find('.note-body > .note-text').show() - note_li.find('js-task-list-container').taskList('enable') - @enableTaskList() + updateNote: (_xhr, note, _status) => + # Convert returned HTML to a jQuery object so we can modify it further + $html = $(note.html) + $html.syntaxHighlight() + $html.find('.js-task-list-container').taskList('enable') + + # Find the note's `li` element by ID and replace it with the updated HTML + $note_li = $("#note_#{note.id}") + $note_li.replaceWith($html) ### Called in response to clicking the edit note link |