Skip to content

Add matching pair insertion to markdown textarea#36121

Merged
techknowlogick merged 8 commits into
go-gitea:mainfrom
silverwind:textareapairs
Dec 10, 2025
Merged

Add matching pair insertion to markdown textarea#36121
techknowlogick merged 8 commits into
go-gitea:mainfrom
silverwind:textareapairs

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Dec 10, 2025

  1. Our textarea already has some editor-like feature like tab indentation, so I thought why not also add insertion of matching closing quotes/brackets over selected text. This does that.
  2. textareaInsertText is replaced with replaceTextareaSelection which does the same but create a new edit history entry in the textarea so CTRL-Z works. The button that inserts tables into the textarea can now also be reverted via CTRL-Z, which was not possible before.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 10, 2025
@silverwind silverwind added the type/enhancement An improvement of existing functionality label Dec 10, 2025
@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Dec 10, 2025

Backtick added as well. There is a catch with that key because it's a dead key on some keyboard and MDN specifies:

If the KeyboardEvent represents the press of a dead key, the key value must be "Dead".

So backtick will only work on keyboard layouts where it is not a dead key (e.g. NoDeadKeys layout).

@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 Dec 10, 2025
Comment thread web_src/js/features/comp/EditorMarkdown.ts
@wxiaoguang wxiaoguang marked this pull request as draft December 10, 2025 05:39
@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 Dec 10, 2025
@wxiaoguang wxiaoguang marked this pull request as ready for review December 10, 2025 06:25
@techknowlogick techknowlogick enabled auto-merge (squash) December 10, 2025 07:28
@techknowlogick techknowlogick added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Dec 10, 2025
@techknowlogick techknowlogick merged commit ed698d1 into go-gitea:main Dec 10, 2025
23 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Dec 10, 2025
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Dec 10, 2025
@silverwind silverwind deleted the textareapairs branch December 10, 2025 09:06
zjjhot added a commit to zjjhot/gitea that referenced this pull request Dec 12, 2025
* giteaofficial/main:
  Move some functions to gitrepo package to reduce RepoPath reference directly (go-gitea#36126)
  Make Golang correctly delete temp files during uploading (go-gitea#36128)
  [skip ci] Updated translations via Crowdin
  Support updating branch via API (go-gitea#35951)
  Use gitrepo's clone and push when possible (go-gitea#36093)
  Improve math rendering (go-gitea#36124)
  Add matching pair insertion to markdown textarea (go-gitea#36121)
  Changed a small typo in an error message and code comments. (go-gitea#36117)
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants