Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] File preview #23579

Closed
TimerWolf opened this issue Mar 19, 2023 · 3 comments · Fixed by #23624
Closed

[Feature] File preview #23579

TimerWolf opened this issue Mar 19, 2023 · 3 comments · Fixed by #23624
Labels
type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@TimerWolf
Copy link

TimerWolf commented Mar 19, 2023

Feature Description

When you use the web interface, why is it not possible to have preview of a new file that is created in the repository?

You can do it with already created files that you edit but not with new files and i find this very strange, it would be very useful for lets say is you create a new "markdown" file.

Repository -> Add File -> New File

But the preview tab is missing

@TimerWolf TimerWolf added type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Mar 19, 2023
@silverwind
Copy link
Member

silverwind commented Mar 19, 2023

Preview Tab should be there for at least markdown, but I do agree we could show it for other file types as well, if there is a benefit.

Also see #23333 which touches these parts.

@brechtvl
Copy link
Contributor

The Preview tab is not there for New File at all, only for Edit File. Editing a .txt file and renaming it to .md also does not make a Preview tab appear.

I had a quick look, and there seem to be two things to fix:

  • Make the preview tab visible for IsNewFile in templates/repo/editor/edit.tmpl
  • Run the previewable file extensions detection in createCodeEditor after editing the file name, not only on page load.

I won't have time to submit a proper fix in the next few days, anyone feel free to take over. Otherwise I'll get to it later.

@silverwind
Copy link
Member

I agree, we should try to handle new file similar to edit file.

lunny pushed a commit that referenced this issue Mar 26, 2023
…3624)

Close #23579 
Inspired by
[idea](#23579 (comment))
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>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants