From 428960d031614f70ec9ed7bcbb914f553e2201b9 Mon Sep 17 00:00:00 2001 From: Harshit Bansal Date: Sat, 29 Dec 2018 18:04:10 +0530 Subject: [PATCH 1/2] 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. --- public/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/index.js b/public/js/index.js index 918918ef4663..1377e9f36adc 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()); From 10482fa4a4f046beb159be79558c4c4e21ecd037 Mon Sep 17 00:00:00 2001 From: Harshit Bansal Date: Sat, 29 Dec 2018 18:14:08 +0530 Subject: [PATCH 2/2] 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. --- templates/repo/diff/box.tmpl | 2 +- templates/repo/issue/view_content.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 729e37c8b940..35f6ae36be58 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 54531cf4d8a1..ce2699af3577 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"}}