1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-01 16:05:19 +02:00

[v11.0/forgejo] fix(ui): erroneous list continuation on Cmd+Enter on macOS (#8262)

**Manual Backport:** https://codeberg.org/forgejo/forgejo/pulls/8170

The line continuation code in the Markdown editor ignored Enter presses if Ctrl, Alt or Shift were being held. This now also accounts for Cmd on macOS (which browsers represent as metaKey).

### Tests

- Use Safari (on macOS)
- create a new issue in a repository
- start writing a list (with - one[enter]- two)
- now press Cmd+Enter
- verify that while the form is being submitted, no new line got visually added

(cherry picked from commit 39e6785da0)

Co-authored-by: Danko Aleksejevs <danko@very.lv>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8262
Reviewed-by: Danko Aleksejevs <danko@very.lv>
This commit is contained in:
Beowulf 2025-06-23 21:55:22 +02:00
parent 178f31ac28
commit ca07340093

View file

@ -100,7 +100,7 @@ class ComboMarkdownEditor {
if (e.shiftKey) {
e.target._shiftDown = true;
}
if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.altKey) {
if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
// Prevent special line break handling if currently a text expander popup is open
if (this.textarea.hasAttribute('aria-expanded')) return;
if (!this.breakLine()) return; // Nothing changed, let the default handler work.