From 28cc3bd6623ad365306c42e4f726eaa2d06cb4c8 Mon Sep 17 00:00:00 2001 From: Harshit Bansal Date: Mon, 31 Dec 2018 22:22:06 +0530 Subject: [PATCH] Fix wrong text getting saved on editing second comment on an issue. (#5608) (#5615) * comments: Fix an incorrent DOM element selection. This commit fixes a bug that was causing text from previously edited comment to get saved when two comments were edited one after other. Text area with id of `#content` isn't unique on the page but it was being treated as unique by the event handling code. Fixes: #5581. * templates: Remove `id` from textarea in commit edit form. An element is assigned an `id` only if it is unique for the whole page but in this case there can be multiple textarea so it should have one. --- public/js/index.js | 2 +- templates/repo/diff/box.tmpl | 2 +- templates/repo/issue/view_content.tmpl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index 8d22deaa6..79e612349 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -608,7 +608,7 @@ function initRepository() { // Setup new form if ($editContentZone.html().length == 0) { $editContentZone.html($('#edit-content-form').html()); - $textarea = $('#content'); + $textarea = $editContentZone.find('textarea'); issuesTribute.attach($textarea.get()); emojiTribute.attach($textarea.get()); diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 729e37c8b..35f6ae36b 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -204,7 +204,7 @@ {{$.i18n.Tr "preview"}}
- +
{{$.i18n.Tr "loading"}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index e133ee9dc..9510cf5c7 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -115,7 +115,7 @@ {{$.i18n.Tr "preview"}}
- +
{{$.i18n.Tr "loading"}}