Prevent prefix continuation if currently a text expander popup is open

This fixes that mentions and emoji autocompletion was broken in e.g. a
list, because the list handling take presidency over the text expansion.

(cherry picked from commit 276ef10dd5)
This commit is contained in:
Beowulf 2025-01-17 18:22:43 +01:00 committed by forgejo-backport-action
parent 28db11f2e7
commit 627634a76e
2 changed files with 28 additions and 0 deletions

View file

@ -99,6 +99,8 @@ class ComboMarkdownEditor {
e.target._shiftDown = true;
}
if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.altKey) {
// 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.
this.options?.onContentChanged?.(this, e);
e.preventDefault();