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

Markdown editor doesn't increment points in numbered lists on enter #33184

Closed
TheFox0x7 opened this issue Jan 9, 2025 · 2 comments · Fixed by #33187
Closed

Markdown editor doesn't increment points in numbered lists on enter #33184

TheFox0x7 opened this issue Jan 9, 2025 · 2 comments · Fixed by #33187
Labels
topic/ui Change the appearance of the Gitea UI type/bug

Comments

@TheFox0x7
Copy link
Contributor

Description

When making a numbered list the editor always inserts 1. as next item.

Reproduction steps:

  1. Make an issue
  2. Make a numbered list with more than one point
  3. Next point is always 1.

This has no impact on later rendering of the list, numbers are correct there.
https://demo.gitea.com/TheFox0x7/runs-on_bug/issues/1

Screenshots

image

Gitea Version

2298ff2

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

Linux

Browser Version

Firefox 133.0.3

@TheFox0x7 TheFox0x7 added topic/ui Change the appearance of the Gitea UI type/bug labels Jan 9, 2025
@harryvince
Copy link
Contributor

I could be wrong but just looking at the MarkdownEditor.ts file, can see that 1. is hardcoded in the newPrefix https://github.com/go-gitea/gitea/blob/main/web_src/js/features/comp/EditorMarkdown.ts#L100

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jan 10, 2025

The more background details are here:

I didn't do that because there will be many edge cases to make the "increment" right. While keep using 1. still make the render work right.


If there could be a (nearly) complete improvement and test, then we can use it.

Update: made some changes in #33187, it should be able to handle most edge cases now.

@lunny lunny closed this as completed in d7ec23f Jan 10, 2025
wxiaoguang added a commit to wxiaoguang/gitea that referenced this issue Jan 10, 2025
Amended the logic for newPrefix in the MarkdownEditor to resolve
incorrect number ordering.

Fixes go-gitea#33184

Attached screenshot of fixed input similar to issue 
<img width="175" alt="Screenshot 2025-01-09 at 23 59 24"
src="https://github.com/user-attachments/assets/dfa23cf1-f3db-4b5e-99d2-a71bbcb289a8"
/>

---------

Co-authored-by: wxiaoguang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants