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.
This commit is contained in:
		
							parent
							
								
									945804f800
								
							
						
					
					
						commit
						2c7661a524
					
				
					 3 changed files with 3 additions and 3 deletions
				
			
		|  | @ -690,7 +690,7 @@ function initRepository() { | ||||||
|             // Setup new form
 |             // Setup new form
 | ||||||
|             if ($editContentZone.html().length == 0) { |             if ($editContentZone.html().length == 0) { | ||||||
|                 $editContentZone.html($('#edit-content-form').html()); |                 $editContentZone.html($('#edit-content-form').html()); | ||||||
|                 $textarea = $('#content'); |                 $textarea = $editContentZone.find('textarea'); | ||||||
|                 issuesTribute.attach($textarea.get()); |                 issuesTribute.attach($textarea.get()); | ||||||
|                 emojiTribute.attach($textarea.get()); |                 emojiTribute.attach($textarea.get()); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -204,7 +204,7 @@ | ||||||
| 				<a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a> | 				<a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a> | ||||||
| 			</div> | 			</div> | ||||||
| 			<div class="ui bottom attached active write tab segment"> | 			<div class="ui bottom attached active write tab segment"> | ||||||
| 				<textarea tabindex="1" id="content" name="content"></textarea> | 				<textarea tabindex="1" name="content"></textarea> | ||||||
| 			</div> | 			</div> | ||||||
| 			<div class="ui bottom attached tab preview segment markdown"> | 			<div class="ui bottom attached tab preview segment markdown"> | ||||||
| 			{{$.i18n.Tr "loading"}} | 			{{$.i18n.Tr "loading"}} | ||||||
|  |  | ||||||
|  | @ -115,7 +115,7 @@ | ||||||
| 			<a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a> | 			<a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a> | ||||||
| 		</div> | 		</div> | ||||||
| 		<div class="ui bottom attached active write tab segment"> | 		<div class="ui bottom attached active write tab segment"> | ||||||
| 			<textarea tabindex="1" id="content" name="content"></textarea> | 			<textarea tabindex="1" name="content"></textarea> | ||||||
| 		</div> | 		</div> | ||||||
| 		<div class="ui bottom attached tab preview segment markdown"> | 		<div class="ui bottom attached tab preview segment markdown"> | ||||||
| 			{{$.i18n.Tr "loading"}} | 			{{$.i18n.Tr "loading"}} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue