Skip to content

Commit 7834260

Browse files
parnicsilverwind6543lunny
authored andcommitted
Fix Pull Request comment filename word breaks (go-gitea#19535)
* Fix word breaks in Chrome This fixes word wrapping on the filename for a comment on a PR. A previous commit fixed this problem in Firefox, but not Chrome. Fixes go-gitea#16248 * Don't break Outdated badge This prevents the Outdated badge on a PR from wrapping in the middle of the word for a comment on a long filename. * Move word break to recommended element * Add overflow-wrap per PR review * Update web_src/less/helpers.less Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
1 parent 920b683 commit 7834260

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

templates/repo/issue/view_content/comments.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,13 +508,13 @@
508508
{{ range $filename, $lines := .Review.CodeComments}}
509509
{{range $line, $comms := $lines}}
510510
<div class="ui segments">
511-
<div class="ui segment py-3 df ac sb word-break">
511+
<div class="ui segment py-3 df ac sb">
512512
{{$invalid := (index $comms 0).Invalidated}}
513513
{{$resolved := (index $comms 0).IsResolved}}
514514
{{$resolveDoer := (index $comms 0).ResolveDoer}}
515515
{{$isNotPending := (not (eq (index $comms 0).Review.Type 0))}}
516516
<div class="df ac">
517-
<a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment ml-3">{{$filename}}</a>
517+
<a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment ml-3 word-break">{{$filename}}</a>
518518
{{if $invalid }}
519519
<span class="ui label basic small ml-3">
520520
{{$.i18n.Tr "repo.issues.review.outdated"}}

web_src/less/helpers.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
.word-break {
2929
word-wrap: break-word !important;
30+
word-break: break-word; /* compat: Safari */
31+
overflow-wrap: anywhere;
3032
}
3133

3234
.ellipsis {

0 commit comments

Comments
 (0)