From ca07340093c1077bc342ea5527e54c20d5a63942 Mon Sep 17 00:00:00 2001 From: Beowulf Date: Mon, 23 Jun 2025 21:55:22 +0200 Subject: [PATCH] [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 39e6785da00ddd3f1f01f846aab8bf0a5c31f96b) Co-authored-by: Danko Aleksejevs Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8262 Reviewed-by: Danko Aleksejevs --- web_src/js/features/comp/ComboMarkdownEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/comp/ComboMarkdownEditor.js b/web_src/js/features/comp/ComboMarkdownEditor.js index efd068f354..b8d1934a49 100644 --- a/web_src/js/features/comp/ComboMarkdownEditor.js +++ b/web_src/js/features/comp/ComboMarkdownEditor.js @@ -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.