Skip to content

Commit 28cc3bd

Browse files
HarshitOnGitHubtechknowlogick
authored andcommitted
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.
1 parent 2631f7f commit 28cc3bd

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

public/js/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ function initRepository() {
608608
// Setup new form
609609
if ($editContentZone.html().length == 0) {
610610
$editContentZone.html($('#edit-content-form').html());
611-
$textarea = $('#content');
611+
$textarea = $editContentZone.find('textarea');
612612
issuesTribute.attach($textarea.get());
613613
emojiTribute.attach($textarea.get());
614614

templates/repo/diff/box.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
<a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a>
205205
</div>
206206
<div class="ui bottom attached active write tab segment">
207-
<textarea tabindex="1" id="content" name="content"></textarea>
207+
<textarea tabindex="1" name="content"></textarea>
208208
</div>
209209
<div class="ui bottom attached tab preview segment markdown">
210210
{{$.i18n.Tr "loading"}}

templates/repo/issue/view_content.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
<a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a>
116116
</div>
117117
<div class="ui bottom attached active write tab segment">
118-
<textarea tabindex="1" id="content" name="content"></textarea>
118+
<textarea tabindex="1" name="content"></textarea>
119119
</div>
120120
<div class="ui bottom attached tab preview segment markdown">
121121
{{$.i18n.Tr "loading"}}

0 commit comments

Comments
 (0)