Skip to content

[Feature] File preview #23579

@TimerWolf

Description

@TimerWolf

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

Activity

added
type/featureCompletely new functionality. Can only be merged if feature freeze is not active.
type/proposalThe new feature has not been accepted yet but needs to be discussed first.
on Mar 19, 2023
silverwind

silverwind commented on Mar 19, 2023

@silverwind
Member

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

brechtvl commented on Mar 19, 2023

@brechtvl
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

silverwind commented on Mar 20, 2023

@silverwind
Member

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

added a commit that references this issue on Mar 26, 2023
ac64c82
locked and limited conversation to collaborators on May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/featureCompletely new functionality. Can only be merged if feature freeze is not active.type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @silverwind@brechtvl@TimerWolf

      Issue actions

        [Feature] File preview · Issue #23579 · go-gitea/gitea