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

Use Markdowneditor in more places #27772

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

JakobDev
Copy link
Contributor

Inspired by #27759

There are places in Gitea which support rendering markdown, but instead of the Markdowneditor the normal Editor is used. This PR fixes this.

It includes the following things:

  • Project description
  • User description
  • Org description

Please tell me, if I missed something.

Screenshots

grafik
grafik
grafik

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 24, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 24, 2023
templates/repo/issue/fields/textarea.tmpl Outdated Show resolved Hide resolved
templates/shared/combomarkdowneditor.tmpl Outdated Show resolved Hide resolved
web_src/js/features/misc.js Show resolved Hide resolved
templates/shared/combomarkdowneditor.tmpl Outdated Show resolved Hide resolved
@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 25, 2023
@JakobDev
Copy link
Contributor Author

While working on this I found out, that the Markdown in Projects descriptions on the User/Org level is not rendered. I fixed this.

@delvh delvh added type/enhancement An improvement of existing functionality topic/ui Change the appearance of the Gitea UI labels Nov 8, 2023
@delvh delvh changed the title Use Markdowneditor on more places in Gitea Use Markdowneditor in more places Nov 10, 2023
Copy link
Member

@delvh delvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from below LGTM

templates/shared/combomarkdowneditor.tmpl Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 10, 2023
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 3, 2024
@delvh delvh added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 9, 2024
@GiteaBot
Copy link
Contributor

GiteaBot commented Apr 9, 2024

@JakobDev please fix the merge conflicts. 🍵

@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 9, 2024
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/js labels Apr 9, 2024
routers/web/org/projects.go Outdated Show resolved Hide resolved
Copy link
Member

@lunny lunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary. Since user/org supports .profile, we don't need to support markdown on their descriptions. And for project description, they will be displayed on the list of projects, I think formating with markdown on a project list page will disturb many people.

@GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. labels Apr 9, 2024
@delvh
Copy link
Member

delvh commented Apr 10, 2024

@lunny these places already support Markdown, only their editor indicates otherwise as far as I understood

@delvh
Copy link
Member

delvh commented Jun 21, 2024

@lunny so, what do we do about this PR?

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jun 22, 2024

Actually usually I also tried to help & push some PRs to move on. The problem is that many PRs are inactive and not that responsive, for example, 25049 since Jun, 2023. (not a native speaker, I would like to mean "have responses after getting review comments" by responsive).

So usually I would like to spend time on PRs that are more active.

ps: there are still some problems in this PR I guess .......


Update: I merged main into this PR and resolved the conflicts. But there are still some problems in code, I am not sure whether the author is still interested in this PR.

@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 22, 2024
@wxiaoguang wxiaoguang marked this pull request as draft June 22, 2024 02:02
@delvh
Copy link
Member

delvh commented Jun 22, 2024

But there are still some problems in code

Could you give an example what we need to fix?

@@ -137,6 +137,10 @@ func RenderNewProject(ctx *context.Context) {
ctx.Data["CardTypes"] = project_model.GetCardConfig()
ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(unit.TypeProjects)
ctx.Data["CancelLink"] = ctx.Repo.Repository.Link() + "/projects"
ctx.Data["ProjectMarkdownPreviewURL"] = fmt.Sprintf("%s/markup", ctx.Repo.Repository.Link())
ctx.Data["ProjectMarkdownPreviewContext"] = ctx.Repo.Repository.Link()
ctx.Data["ProjectMarkdownPreviewMode"] = "comment"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and other places: the mode shouldn't be "comment" because the description is rendered in original markdown format

@@ -974,6 +974,8 @@ func registerRoutes(m *web.Router) {
// end "/repo": create, migrate, search

m.Group("/{username}/-", func() {
m.Post("/markup", web.Bind(structs.MarkupOption{}), misc.Markup)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be placed under /-/markup because it doesn't really belong to "user"


if (markdownEditor.length > 0) {
initComboMarkdownEditor(markdownEditor[0]);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are more than one editors, only the first one gets initialized.

@wxiaoguang
Copy link
Contributor

But there are still some problems in code

Could you give an example what we need to fix?

Added some quick reviews (haven't reviewed it carefully yet, maybe I could checkout and edit directly if this PR gets enough interests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged modifies/go Pull requests that update Go code modifies/js modifies/templates This PR modifies the template files modifies/translation size/M Denotes a PR that changes 30-99 lines, ignoring generated files. topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants