mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 20:36:07 +01:00 
			
		
		
		
	Change ID pattern of raw content container for issue (#21966)
Implement differentiation to html id for issue raw content container. Fixes #21965
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							2779d47ad3
						
					
				
				
					commit
					097d4e30b1
				
			@@ -54,7 +54,7 @@
 | 
				
			|||||||
				<span class="no-content">{{$.root.locale.Tr "repo.issues.no_content"}}</span>
 | 
									<span class="no-content">{{$.root.locale.Tr "repo.issues.no_content"}}</span>
 | 
				
			||||||
			{{end}}
 | 
								{{end}}
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
			<div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div>
 | 
								<div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div>
 | 
				
			||||||
			<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.root.RepoLink}}/comments/{{.ID}}" data-context="{{$.root.RepoLink}}"></div>
 | 
								<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.root.RepoLink}}/comments/{{.ID}}" data-context="{{$.root.RepoLink}}"></div>
 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
		{{$reactions := .Reactions.GroupByType}}
 | 
							{{$reactions := .Reactions.GroupByType}}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,7 +77,7 @@
 | 
				
			|||||||
								<span class="no-content">{{.locale.Tr "repo.issues.no_content"}}</span>
 | 
													<span class="no-content">{{.locale.Tr "repo.issues.no_content"}}</span>
 | 
				
			||||||
							{{end}}
 | 
												{{end}}
 | 
				
			||||||
						</div>
 | 
											</div>
 | 
				
			||||||
						<div id="comment-{{.Issue.ID}}" class="raw-content hide">{{.Issue.Content}}</div>
 | 
											<div id="issue-{{.Issue.ID}}-raw" class="raw-content hide">{{.Issue.Content}}</div>
 | 
				
			||||||
						<div class="edit-content-zone hide" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div>
 | 
											<div class="edit-content-zone hide" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div>
 | 
				
			||||||
						{{if .Issue.Attachments}}
 | 
											{{if .Issue.Attachments}}
 | 
				
			||||||
							{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}}
 | 
												{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,7 +77,7 @@
 | 
				
			|||||||
								<span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span>
 | 
													<span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span>
 | 
				
			||||||
							{{end}}
 | 
												{{end}}
 | 
				
			||||||
						</div>
 | 
											</div>
 | 
				
			||||||
						<div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div>
 | 
											<div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div>
 | 
				
			||||||
						<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
 | 
											<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
 | 
				
			||||||
						{{if .Attachments}}
 | 
											{{if .Attachments}}
 | 
				
			||||||
							{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}}
 | 
												{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}}
 | 
				
			||||||
@@ -449,7 +449,7 @@
 | 
				
			|||||||
									<span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span>
 | 
														<span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span>
 | 
				
			||||||
								{{end}}
 | 
													{{end}}
 | 
				
			||||||
							</div>
 | 
												</div>
 | 
				
			||||||
							<div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div>
 | 
												<div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div>
 | 
				
			||||||
							<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
 | 
												<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
 | 
				
			||||||
							{{if .Attachments}}
 | 
												{{if .Attachments}}
 | 
				
			||||||
								{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}}
 | 
													{{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}}
 | 
				
			||||||
@@ -576,7 +576,7 @@
 | 
				
			|||||||
																<span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span>
 | 
																					<span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span>
 | 
				
			||||||
															{{end}}
 | 
																				{{end}}
 | 
				
			||||||
															</div>
 | 
																				</div>
 | 
				
			||||||
															<div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div>
 | 
																				<div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div>
 | 
				
			||||||
															<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
 | 
																				<div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
 | 
				
			||||||
														</div>
 | 
																			</div>
 | 
				
			||||||
														{{$reactions := .Reactions.GroupByType}}
 | 
																			{{$reactions := .Reactions.GroupByType}}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,9 +11,9 @@
 | 
				
			|||||||
			{{$referenceUrl = Printf "%s/files#%s" .ctx.Issue.HTMLURL .item.HashTag}}
 | 
								{{$referenceUrl = Printf "%s/files#%s" .ctx.Issue.HTMLURL .item.HashTag}}
 | 
				
			||||||
		{{end}}
 | 
							{{end}}
 | 
				
			||||||
		<div class="item context" data-clipboard-text="{{$referenceUrl}}">{{.ctx.locale.Tr "repo.issues.context.copy_link"}}</div>
 | 
							<div class="item context" data-clipboard-text="{{$referenceUrl}}">{{.ctx.locale.Tr "repo.issues.context.copy_link"}}</div>
 | 
				
			||||||
		<div class="item context quote-reply {{if .diff}}quote-reply-diff{{end}}" data-target="{{.item.ID}}">{{.ctx.locale.Tr "repo.issues.context.quote_reply"}}</div>
 | 
							<div class="item context quote-reply {{if .diff}}quote-reply-diff{{end}}" data-target="{{.item.HashTag}}-raw">{{.ctx.locale.Tr "repo.issues.context.quote_reply"}}</div>
 | 
				
			||||||
		{{if not .ctx.UnitIssuesGlobalDisabled}}
 | 
							{{if not .ctx.UnitIssuesGlobalDisabled}}
 | 
				
			||||||
			<div class="item context reference-issue" data-target="{{.item.ID}}" data-modal="#reference-issue-modal" data-poster="{{.item.Poster.GetDisplayName}}" data-poster-username="{{.item.Poster.Name}}" data-reference="{{$referenceUrl}}">{{.ctx.locale.Tr "repo.issues.context.reference_issue"}}</div>
 | 
								<div class="item context reference-issue" data-target="{{.item.HashTag}}-raw" data-modal="#reference-issue-modal" data-poster="{{.item.Poster.GetDisplayName}}" data-poster-username="{{.item.Poster.Name}}" data-reference="{{$referenceUrl}}">{{.ctx.locale.Tr "repo.issues.context.reference_issue"}}</div>
 | 
				
			||||||
		{{end}}
 | 
							{{end}}
 | 
				
			||||||
		{{if or .ctx.Permission.IsAdmin .IsCommentPoster .ctx.HasIssuesOrPullsWritePermission}}
 | 
							{{if or .ctx.Permission.IsAdmin .IsCommentPoster .ctx.HasIssuesOrPullsWritePermission}}
 | 
				
			||||||
			<div class="divider"></div>
 | 
								<div class="divider"></div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -553,7 +553,7 @@ export function initRepoIssueReferenceIssue() {
 | 
				
			|||||||
    const $this = $(this);
 | 
					    const $this = $(this);
 | 
				
			||||||
    $this.closest('.dropdown').find('.menu').toggle('visible');
 | 
					    $this.closest('.dropdown').find('.menu').toggle('visible');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const content = $(`#comment-${$this.data('target')}`).text();
 | 
					    const content = $(`#${$this.data('target')}`).text();
 | 
				
			||||||
    const poster = $this.data('poster-username');
 | 
					    const poster = $this.data('poster-username');
 | 
				
			||||||
    const reference = $this.data('reference');
 | 
					    const reference = $this.data('reference');
 | 
				
			||||||
    const $modal = $($this.data('modal'));
 | 
					    const $modal = $($this.data('modal'));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -566,7 +566,7 @@ function initRepoIssueCommentEdit() {
 | 
				
			|||||||
  $(document).on('click', '.quote-reply', function (event) {
 | 
					  $(document).on('click', '.quote-reply', function (event) {
 | 
				
			||||||
    $(this).closest('.dropdown').find('.menu').toggle('visible');
 | 
					    $(this).closest('.dropdown').find('.menu').toggle('visible');
 | 
				
			||||||
    const target = $(this).data('target');
 | 
					    const target = $(this).data('target');
 | 
				
			||||||
    const quote = $(`#comment-${target}`).text().replace(/\n/g, '\n> ');
 | 
					    const quote = $(`#${target}`).text().replace(/\n/g, '\n> ');
 | 
				
			||||||
    const content = `> ${quote}\n\n`;
 | 
					    const content = `> ${quote}\n\n`;
 | 
				
			||||||
    let easyMDE;
 | 
					    let easyMDE;
 | 
				
			||||||
    if ($(this).hasClass('quote-reply-diff')) {
 | 
					    if ($(this).hasClass('quote-reply-diff')) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user