From 2c7661a5241f201aef6e63e767e547cc0a5cd877 Mon Sep 17 00:00:00 2001 From: Harshit Bansal Date: Mon, 31 Dec 2018 17:31:20 +0530 Subject: [PATCH] Fix wrong text getting saved on editing second comment on an issue. (#5608) * 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 918918ef46..1377e9f36a 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -690,7 +690,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 729e37c8b9..35f6ae36be 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 54531cf4d8..ce2699af35 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"}}