diff options
author | Hester Gong <hestergong@gmail.com> | 2023-03-26 13:25:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-26 13:25:41 +0800 |
commit | ac64c8297444ade63a2a364c4afb7e6c1de5a75f (patch) | |
tree | 1d5de1a378638660ebc6de9192955d5325c318a3 /templates | |
parent | 2d2b4bdf62104bf11b1cef1e460633378af5a1aa (diff) | |
download | gitea-ac64c8297444ade63a2a364c4afb7e6c1de5a75f.tar.gz gitea-ac64c8297444ade63a2a364c4afb7e6c1de5a75f.zip |
Allow new file and edit file preview if it has editable extension (#23624)
Close #23579
Inspired by
[idea](https://github.com/go-gitea/gitea/issues/23579#issuecomment-1475429247)
from @brechtvl
In this PR, the behavior is when extension switches from writatble to
not, preview will hide, and vice versa.
demo:
https://user-images.githubusercontent.com/17645053/226786119-d20063da-8763-41ce-9b00-ae34929120e1.mov
---------
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/editor/edit.tmpl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl index 2a3c404d1a..6ecc5e1460 100644 --- a/templates/repo/editor/edit.tmpl +++ b/templates/repo/editor/edit.tmpl @@ -30,8 +30,8 @@ <div class="field"> <div class="ui top attached tabular menu" data-write="write" data-preview="preview" data-diff="diff"> <a class="active item" data-tab="write">{{svg "octicon-code"}} {{if .IsNewFile}}{{.locale.Tr "repo.editor.new_file"}}{{else}}{{.locale.Tr "repo.editor.edit_file"}}{{end}}</a> - {{if not .IsNewFile}} <a class="item" data-tab="preview" data-url="{{.Repository.Link}}/markup" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL}}" data-markup-mode="file">{{svg "octicon-eye"}} {{.locale.Tr "preview"}}</a> + {{if not .IsNewFile}} <a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}" data-context="{{.BranchLink}}">{{svg "octicon-diff"}} {{.locale.Tr "repo.editor.preview_changes"}}</a> {{end}} </div> |