mirror of
https://github.com/go-gitea/gitea
synced 2025-07-09 03:57:19 +00:00
Backport #34755 by wxiaoguang Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@ -150,7 +150,7 @@ func prepareToRenderReadmeFile(ctx *context.Context, subfolder string, readmeFil
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["RawFileLink"] = ""
|
ctx.Data["RawFileLink"] = ""
|
||||||
ctx.Data["ReadmeInList"] = true
|
ctx.Data["ReadmeInList"] = path.Join(subfolder, readmeFile.Name()) // the relative path to the readme file to the current tree path
|
||||||
ctx.Data["ReadmeExist"] = true
|
ctx.Data["ReadmeExist"] = true
|
||||||
ctx.Data["FileIsSymlink"] = readmeFile.IsLink()
|
ctx.Data["FileIsSymlink"] = readmeFile.IsLink()
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ func prepareToRenderReadmeFile(ctx *context.Context, subfolder string, readmeFil
|
|||||||
defer dataRc.Close()
|
defer dataRc.Close()
|
||||||
|
|
||||||
ctx.Data["FileIsText"] = fInfo.isTextFile
|
ctx.Data["FileIsText"] = fInfo.isTextFile
|
||||||
ctx.Data["FileTreePath"] = path.Join(subfolder, readmeFile.Name())
|
ctx.Data["FileTreePath"] = path.Join(ctx.Repo.TreePath, subfolder, readmeFile.Name())
|
||||||
ctx.Data["FileSize"] = fInfo.fileSize
|
ctx.Data["FileSize"] = fInfo.fileSize
|
||||||
ctx.Data["IsLFSFile"] = fInfo.isLFSFile
|
ctx.Data["IsLFSFile"] = fInfo.isLFSFile
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<div class="file-header-left tw-flex tw-items-center tw-py-2 tw-pr-4">
|
<div class="file-header-left tw-flex tw-items-center tw-py-2 tw-pr-4">
|
||||||
{{if .ReadmeInList}}
|
{{if .ReadmeInList}}
|
||||||
{{svg "octicon-book" 16 "tw-mr-2"}}
|
{{svg "octicon-book" 16 "tw-mr-2"}}
|
||||||
<strong><a class="muted" href="#readme">{{.FileTreePath}}</a></strong>
|
<strong><a class="muted" href="#readme">{{.ReadmeInList}}</a></strong>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{template "repo/file_info" .}}
|
{{template "repo/file_info" .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -135,7 +135,7 @@ function handleClipboardText(textarea: HTMLTextAreaElement, e: ClipboardEvent, p
|
|||||||
|
|
||||||
// when pasting links over selected text, turn it into [text](link)
|
// when pasting links over selected text, turn it into [text](link)
|
||||||
const pastedAsMarkdown = pasteAsMarkdownLink(textarea, pastedText);
|
const pastedAsMarkdown = pasteAsMarkdownLink(textarea, pastedText);
|
||||||
if (pastedText) {
|
if (pastedAsMarkdown) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
replaceTextareaSelection(textarea, pastedAsMarkdown);
|
replaceTextareaSelection(textarea, pastedAsMarkdown);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user