Skip to content

Commit 7298059

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Remove fomantic input module (go-gitea#30194) Remove most jQuery function calls from the repository topic box (go-gitea#30191) Prevent flash of dropdown menu on labels list (go-gitea#30215) Remove jQuery class from the `repo-issue.js` file (go-gitea#30192) Ignore fomantic folder in linters (go-gitea#30200) Remove `modifies/frontend` from labeler (go-gitea#30198) Make a distinction between `active` and `selected` in the issue author dropdown (go-gitea#30207) Move and simplify tab-size helpers (go-gitea#30196) Fix markdown color code detection (go-gitea#30208)
2 parents 6ac2c5e + ff33474 commit 7298059

File tree

26 files changed

+401
-1049
lines changed

26 files changed

+401
-1049
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ reportUnusedDisableDirectives: true
33

44
ignorePatterns:
55
- /web_src/js/vendor
6+
- /web_src/fomantic
67

78
parserOptions:
89
sourceType: module

.github/labeler.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@ modifies/docs:
44
- "**/*.md"
55
- "docs/**"
66

7-
modifies/frontend:
8-
- changed-files:
9-
- any-glob-to-any-file:
10-
- "web_src/**"
11-
- "tailwind.config.js"
12-
- "webpack.config.js"
13-
147
modifies/templates:
158
- changed-files:
169
- all-globs-to-any-file:

modules/markup/markdown/markdown_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,10 @@ func TestColorPreview(t *testing.T) {
436436
testcase string
437437
expected string
438438
}{
439+
{ // do not render color names
440+
"The CSS class `red` is there",
441+
"<p>The CSS class <code>red</code> is there</p>\n",
442+
},
439443
{ // hex
440444
"`#FF0000`",
441445
`<p><code>#FF0000<span class="color-preview" style="background-color: #FF0000"></span></code></p>` + nl,
@@ -445,8 +449,8 @@ func TestColorPreview(t *testing.T) {
445449
`<p><code>rgb(16, 32, 64)<span class="color-preview" style="background-color: rgb(16, 32, 64)"></span></code></p>` + nl,
446450
},
447451
{ // short hex
448-
"This is the color white `#000`",
449-
`<p>This is the color white <code>#000<span class="color-preview" style="background-color: #000"></span></code></p>` + nl,
452+
"This is the color white `#0a0`",
453+
`<p>This is the color white <code>#0a0<span class="color-preview" style="background-color: #0a0"></span></code></p>` + nl,
450454
},
451455
{ // hsl
452456
"HSL stands for hue, saturation, and lightness. An example: `hsl(0, 100%, 50%)`.",

modules/markup/markdown/transform_codespan.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,28 @@ func (r *HTMLRenderer) renderCodeSpan(w util.BufWriter, source []byte, n ast.Nod
4949
return ast.WalkContinue, nil
5050
}
5151

52+
// cssColorHandler checks if a string is a render-able CSS color value.
53+
// The code is from "github.com/microcosm-cc/bluemonday/css.ColorHandler", except that it doesn't handle color words like "red".
54+
func cssColorHandler(value string) bool {
55+
value = strings.ToLower(value)
56+
if css.HexRGB.MatchString(value) {
57+
return true
58+
}
59+
if css.RGB.MatchString(value) {
60+
return true
61+
}
62+
if css.RGBA.MatchString(value) {
63+
return true
64+
}
65+
if css.HSL.MatchString(value) {
66+
return true
67+
}
68+
return css.HSLA.MatchString(value)
69+
}
70+
5271
func (g *ASTTransformer) transformCodeSpan(ctx *markup.RenderContext, v *ast.CodeSpan, reader text.Reader) {
5372
colorContent := v.Text(reader.Source())
54-
if css.ColorHandler(strings.ToLower(string(colorContent))) {
73+
if cssColorHandler(string(colorContent)) {
5574
v.AppendChild(v, NewColorPreview(colorContent))
5675
}
5776
}

stylelint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default {
1616
],
1717
ignoreFiles: [
1818
'**/*.go',
19+
'/web_src/fomantic',
1920
],
2021
overrides: [
2122
{

templates/devtest/gitea-ui.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102

103103
<div>
104104
<h1>Loading</h1>
105-
<div class="is-loading small-loading-icon tw-border tw-border-secondary tw-py-1"><span>loading ...</span></div>
105+
<div class="is-loading loading-icon-2px tw-border tw-border-secondary tw-py-1"><span>loading ...</span></div>
106106
<div class="is-loading tw-border tw-border-secondary tw-py-4">
107107
<p>loading ...</p>
108108
<p>loading ...</p>

templates/repo/home.tmpl

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,21 @@
1818
</div>
1919
</form>
2020
</div>
21-
<div class="tw-flex tw-items-center tw-flex-wrap tw-gap-1" id="repo-topics">
22-
{{range .Topics}}<a class="ui repo-topic large label topic tw-m-0" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
21+
<div class="tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-my-2" id="repo-topics">
22+
{{/* it should match the code in issue-home.js */}}
23+
{{range .Topics}}<a class="repo-topic ui large label" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
2324
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<button id="manage_topic" class="btn interact-fg tw-text-12">{{ctx.Locale.Tr "repo.topic.manage_topics"}}</button>{{end}}
2425
</div>
2526
{{end}}
2627
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
27-
<div class="ui form tw-hidden tw-flex tw-flex-col tw-mt-4" id="topic_edit">
28-
<div class="field tw-flex-1 tw-mb-1">
29-
<div class="ui fluid multiple search selection dropdown tw-flex-wrap" data-text-count-prompt="{{ctx.Locale.Tr "repo.topic.count_prompt"}}" data-text-format-prompt="{{ctx.Locale.Tr "repo.topic.format_prompt"}}">
30-
<input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if Eval $i "+" 1 "<" (len $.Topics)}},{{end}}{{end}}">
31-
{{range .Topics}}
32-
{{/* keey the same layout as Fomantic UI generated labels */}}
33-
<a class="ui label transition visible tw-cursor-default tw-inline-block" data-value="{{.Name}}">{{.Name}}{{svg "octicon-x" 16 "delete icon"}}</a>
34-
{{end}}
35-
<div class="text"></div>
36-
</div>
28+
<div class="ui form tw-hidden tw-flex tw-gap-2 tw-my-2" id="topic_edit">
29+
<div class="ui fluid multiple search selection dropdown tw-flex-wrap tw-flex-1">
30+
<input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if Eval $i "+" 1 "<" (len $.Topics)}},{{end}}{{end}}">
31+
{{range .Topics}}
32+
{{/* keep the same layout as Fomantic UI generated labels */}}
33+
<a class="ui label transition visible tw-cursor-default tw-inline-block" data-value="{{.Name}}">{{.Name}}{{svg "octicon-x" 16 "delete icon"}}</a>
34+
{{end}}
35+
<div class="text"></div>
3736
</div>
3837
<div>
3938
<button class="ui basic button" id="cancel_topic_edit">{{ctx.Locale.Tr "cancel"}}</button>

templates/repo/issue/labels/label_list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{{ctx.Locale.Tr "repo.issues.filter_sort"}}
99
</span>
1010
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
11-
<div class="left menu">
11+
<div class="menu">
1212
<a class="{{if or (eq .SortType "alphabetically") (not .SortType)}}active {{end}}item" href="?sort=alphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a>
1313
<a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="?sort=reversealphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
1414
<a class="{{if eq .SortType "leastissues"}}active {{end}}item" href="?sort=leastissues&state={{$.State}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}}</a>

templates/repo/issue/view_content/sidebar.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@
677677
{{if and (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) .CanWriteToHeadRepo}}
678678
<div class="divider"></div>
679679
<div class="inline field">
680-
<div class="ui checkbox small-loading-icon" id="allow-edits-from-maintainers"
680+
<div class="ui checkbox loading-icon-2px" id="allow-edits-from-maintainers"
681681
data-url="{{.Issue.Link}}"
682682
data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_desc"}}"
683683
data-prompt-error="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_err"}}"

web_src/css/base.css

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,6 @@ a.label,
305305
background-color: var(--color-label-bg);
306306
}
307307

308-
/* fix Fomantic's line-height cutting off "g" on Windows Chrome with Segoe UI */
309-
.ui.input > input {
310-
line-height: var(--line-height-default);
311-
text-align: start; /* Override fomantic's `text-align: left` to make RTL work via HTML `dir="auto"` */
312-
}
313-
314308
/* fix Fomantic's line-height causing vertical scrollbars to appear */
315309
ul.ui.list li,
316310
ol.ui.list li,
@@ -319,47 +313,6 @@ ol.ui.list li,
319313
line-height: var(--line-height-default);
320314
}
321315

322-
.ui.input.focus > input,
323-
.ui.input > input:focus {
324-
border-color: var(--color-primary);
325-
}
326-
327-
.ui.action.input .ui.ui.button {
328-
border-color: var(--color-input-border);
329-
padding-top: 0; /* the ".action.input" is "flex + stretch", so let the buttons layout themselves */
330-
padding-bottom: 0;
331-
}
332-
333-
/* currently used for search bar dropdowns in repo search and explore code */
334-
.ui.action.input:not([class*="left action"]) > .ui.dropdown.selection {
335-
min-width: 10em;
336-
}
337-
.ui.action.input:not([class*="left action"]) > .ui.dropdown.selection:not(:focus) {
338-
border-right: none;
339-
}
340-
.ui.action.input:not([class*="left action"]) > .ui.dropdown.selection:not(.active):hover {
341-
border-color: var(--color-input-border);
342-
}
343-
.ui.action.input:not([class*="left action"]) .ui.dropdown.selection.upward.visible {
344-
border-bottom-left-radius: 0 !important;
345-
border-bottom-right-radius: 0 !important;
346-
}
347-
.ui.action.input:not([class*="left action"]) > input,
348-
.ui.action.input:not([class*="left action"]) > input:hover {
349-
border-right: none;
350-
}
351-
.ui.action.input:not([class*="left action"]) > input:focus + .ui.dropdown.selection,
352-
.ui.action.input:not([class*="left action"]) > input:focus + .ui.dropdown.selection:hover,
353-
.ui.action.input:not([class*="left action"]) > input:focus + .button,
354-
.ui.action.input:not([class*="left action"]) > input:focus + .button:hover,
355-
.ui.action.input:not([class*="left action"]) > input:focus + .icon + .button,
356-
.ui.action.input:not([class*="left action"]) > input:focus + .icon + .button:hover {
357-
border-left-color: var(--color-primary);
358-
}
359-
.ui.action.input:not([class*="left action"]) > input:focus {
360-
border-right-color: var(--color-primary);
361-
}
362-
363316
.ui.menu {
364317
display: flex;
365318
}
@@ -1599,16 +1552,6 @@ table th[data-sortt-desc] .svg {
15991552
align-items: stretch;
16001553
}
16011554

1602-
.ui.ui.icon.input .icon {
1603-
display: flex;
1604-
align-items: center;
1605-
justify-content: center;
1606-
}
1607-
1608-
.ui.icon.input > i.icon {
1609-
transition: none;
1610-
}
1611-
16121555
.flex-items-block > .item,
16131556
.flex-text-block {
16141557
display: flex;

0 commit comments

Comments
 (0)