mirror of
https://github.com/go-gitea/gitea
synced 2024-12-24 17:44:27 +00:00
84daddc2fa
Remove `[repository.editor] PREVIEWABLE_FILE_MODES` setting that seemed like it was intended to support this but did not work. Instead, whenever viewing a file shows a preview, also have a Preview tab in the file editor. Add new `/markup` web and API endpoints with `comment`, `gfm`, `markdown` and new `file` mode that uses a file path to determine the renderer. Remove `/markdown` web endpoint but keep the API for backwards and GitHub compatibility. ## ⚠️ BREAKING ⚠️ The `[repository.editor] PREVIEWABLE_FILE_MODES` setting was removed. This setting served no practical purpose and was not working correctly. Instead a preview tab is always shown in the file editor when supported. --------- Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
45 lines
2.5 KiB
Handlebars
45 lines
2.5 KiB
Handlebars
{{if and $.root.SignedUserID (not $.Repository.IsArchived)}}
|
|
<form class="ui form {{if $.hidden}}gt-hidden comment-form{{end}}" action="{{$.root.Issue.Link}}/files/reviews/comments" method="post">
|
|
{{$.root.CsrfTokenHtml}}
|
|
<input type="hidden" name="origin" value="{{if $.root.PageIsPullFiles}}diff{{else}}timeline{{end}}">
|
|
<input type="hidden" name="latest_commit_id" value="{{$.root.AfterCommitID}}"/>
|
|
<input type="hidden" name="side" value="{{if $.Side}}{{$.Side}}{{end}}">
|
|
<input type="hidden" name="line" value="{{if $.Line}}{{$.Line}}{{end}}">
|
|
<input type="hidden" name="path" value="{{if $.File}}{{$.File}}{{end}}">
|
|
<input type="hidden" name="diff_start_cid">
|
|
<input type="hidden" name="diff_end_cid">
|
|
<input type="hidden" name="diff_base_cid">
|
|
<div class="ui top tabular menu" data-write="write" data-preview="preview">
|
|
<a class="active item" data-tab="write">{{$.root.locale.Tr "write"}}</a>
|
|
<a class="item" data-tab="preview" data-url="{{$.root.Repository.Link}}/markup" data-context="{{$.root.RepoLink}}">{{$.root.locale.Tr "preview"}}</a>
|
|
</div>
|
|
<div class="field">
|
|
<div class="ui active tab" data-tab="write">
|
|
<textarea name="content" placeholder="{{$.root.locale.Tr "repo.diff.comment.placeholder"}}"></textarea>
|
|
</div>
|
|
<div class="ui tab markup" data-tab="preview">
|
|
{{.locale.Tr "loading"}}
|
|
</div>
|
|
</div>
|
|
<div class="field footer gt-mx-3">
|
|
<span class="markup-info">{{svg "octicon-markup"}} {{$.root.locale.Tr "repo.diff.comment.markdown_info"}}</span>
|
|
<div class="ui right">
|
|
{{if $.reply}}
|
|
<button class="ui submit green tiny button btn-reply" type="submit">{{$.root.locale.Tr "repo.diff.comment.reply"}}</button>
|
|
<input type="hidden" name="reply" value="{{$.reply}}">
|
|
{{else}}
|
|
{{if $.root.CurrentReview}}
|
|
<button name="pending_review" type="submit" class="ui submit green tiny button btn-add-comment">{{$.root.locale.Tr "repo.diff.comment.add_review_comment"}}</button>
|
|
{{else}}
|
|
<button name="pending_review" type="submit" class="ui submit green tiny button btn-start-review">{{$.root.locale.Tr "repo.diff.comment.start_review"}}</button>
|
|
<button name="single_review" value="true" type="submit" class="ui submit tiny basic button btn-add-single">{{$.root.locale.Tr "repo.diff.comment.add_single_comment"}}</button>
|
|
{{end}}
|
|
{{end}}
|
|
{{if or (not $.HasComments) $.hidden}}
|
|
<button type="button" class="ui submit tiny basic button btn-cancel cancel-code-comment">{{$.root.locale.Tr "cancel"}}</button>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</form>
|
|
{{end}}
|