Skip to content

Commit 53571d6

Browse files
committed
fix
1 parent e3e3260 commit 53571d6

File tree

28 files changed

+132
-107
lines changed

28 files changed

+132
-107
lines changed

modules/web/route.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"reflect"
1010
"strings"
1111

12+
"code.gitea.io/gitea/modules/htmlutil"
1213
"code.gitea.io/gitea/modules/setting"
1314
"code.gitea.io/gitea/modules/web/middleware"
1415

@@ -214,7 +215,9 @@ func (r *Router) normalizeRequestPath(resp http.ResponseWriter, req *http.Reques
214215
normalizedPath = "/"
215216
} else if !strings.HasPrefix(normalizedPath+"/", "/v2/") {
216217
// do not respond to other requests, to simulate a real sub-path environment
217-
http.Error(resp, "404 page not found, sub-path is: "+setting.AppSubURL, http.StatusNotFound)
218+
resp.Header().Add("Content-Type", "text/html; charset=utf-8")
219+
resp.WriteHeader(http.StatusNotFound)
220+
_, _ = resp.Write([]byte(htmlutil.HTMLFormat(`404 page not found, sub-path is: <a href="%s">%s</a>`, setting.AppSubURL, setting.AppSubURL)))
218221
return
219222
}
220223
normalized = true

options/locale/locale_en-US.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2588,7 +2588,6 @@ diff.generated = generated
25882588
diff.vendored = vendored
25892589
diff.comment.add_line_comment = Add line comment
25902590
diff.comment.placeholder = Leave a comment
2591-
diff.comment.markdown_info = Styling with markdown is supported.
25922591
diff.comment.add_single_comment = Add single comment
25932592
diff.comment.add_review_comment = Add comment
25942593
diff.comment.start_review = Start review

routers/web/web.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ func registerRoutes(m *web.Router) {
485485
m.Methods("GET, HEAD", "/*", public.FileHandlerFunc())
486486
}, optionsCorsHandler())
487487

488+
m.Post("/-/markup", reqSignIn, web.Bind(structs.MarkupOption{}), misc.Markup)
489+
488490
m.Group("/explore", func() {
489491
m.Get("", func(ctx *context.Context) {
490492
ctx.Redirect(setting.AppSubURL + "/explore/repos")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{{/* TODO: the devtest.js is isolated from index.js, so no module is shared and many index.js functions do not work in devtest.ts */}}
22
<script src="{{AssetUrlPrefix}}/js/devtest.js?v={{AssetVersion}}"></script>
3-
{{template "base/footer" dict}}
3+
{{template "base/footer" ctx.RootData}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{{template "base/head" dict}}
1+
{{template "base/head" ctx.RootData}}
22
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/devtest.css?v={{AssetVersion}}">

templates/devtest/gitea-ui.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@
183183

184184
<div>
185185
<h1>ComboMarkdownEditor</h1>
186-
<div>ps: no JS code attached, so just a layout</div>
187-
{{template "shared/combomarkdowneditor" .}}
186+
{{template "shared/combomarkdowneditor" dict "MarkdownPreviewContext" "/owner/path"}}
188187
</div>
189188

190189
<h1>Tailwind CSS Demo</h1>

templates/org/settings/options.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<input id="email" name="email" type="email" value="{{.Org.Email}}" maxlength="255">
2424
</div>
2525
<div class="field {{if .Err_Description}}error{{end}}">
26+
{{/* it is rendered as markdown, but the length is limited, so at the moment we do not use the markdown editor here */}}
2627
<label for="description">{{ctx.Locale.Tr "org.org_desc"}}</label>
2728
<textarea id="description" name="description" rows="2" maxlength="255">{{.Org.Description}}</textarea>
2829
</div>

templates/projects/new.tmpl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
</div>
1919
<div class="field">
2020
<label>{{ctx.Locale.Tr "repo.projects.description"}}</label>
21-
<textarea name="content" placeholder="{{ctx.Locale.Tr "repo.projects.description_placeholder"}}">{{.content}}</textarea>
21+
{{/* TODO: repo-level project and org-level project have different behaviros to render */}}
22+
{{/* the "Repository" is nil when the project is org-level */}}
23+
{{template "shared/combomarkdowneditor" (dict
24+
"MarkdownPreviewInRepo" $.Repository "MarkdownPreviewContext" (Iif $.Repository "" .HomeLink) "MarkdownPreviewMode" (Iif $.Repository "comment")
25+
"TextareaName" "content" "TextareaContent" .content "TextareaPlaceholder" (ctx.Locale.Tr "repo.projects.description_placeholder")
26+
)}}
2227
</div>
2328

2429
{{if not .PageIsEditProjects}}

templates/repo/diff/box.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@
240240
<template id="issue-comment-editor-template">
241241
<div class="ui form comment">
242242
{{template "shared/combomarkdowneditor" (dict
243-
"MarkdownPreviewUrl" (print $.Repository.Link "/markup")
244-
"MarkdownPreviewContext" $.RepoLink
243+
"CustomInit" true
244+
"MarkdownPreviewInRepo" $.Repository "MarkdownPreviewMode" "comment"
245245
"TextareaName" "content"
246246
"DropzoneParentContainer" ".ui.form"
247247
)}}

templates/repo/diff/comment_form.tmpl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
<input type="hidden" name="diff_base_cid">
1212

1313
{{template "shared/combomarkdowneditor" (dict
14-
"MarkdownPreviewUrl" (print $.root.Repository.Link "/markup")
15-
"MarkdownPreviewContext" $.root.RepoLink
16-
"TextareaName" "content"
17-
"TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.comment.placeholder")
14+
"CustomInit" true
15+
"MarkdownPreviewInRepo" $.root.Repository "MarkdownPreviewMode" "comment"
16+
"TextareaName" "content" "TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.comment.placeholder")
1817
"DropzoneParentContainer" "form"
1918
"DisableAutosize" "true"
2019
)}}
@@ -26,7 +25,6 @@
2625
{{end}}
2726

2827
<div class="field footer tw-mx-2">
29-
<span class="markup-info">{{svg "octicon-markdown"}} {{ctx.Locale.Tr "repo.diff.comment.markdown_info"}}</span>
3028
<div class="tw-text-right">
3129
{{if $.reply}}
3230
<button class="ui submit primary tiny button btn-reply" type="submit">{{ctx.Locale.Tr "repo.diff.comment.reply"}}</button>

0 commit comments

Comments
 (0)