diff options
author | Brecht Van Lommel <brecht@blender.org> | 2023-04-18 19:25:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-18 13:25:11 -0400 |
commit | e541a8c654e05365f41b127ff04e6aef2bdbbf9e (patch) | |
tree | 22488963546e9f2929a40fee921ad31fd788fb46 /web_src/js/features/comp | |
parent | 7ca7590c39dd63b2f812ce3a85ef82c2f4797aea (diff) | |
download | gitea-e541a8c654e05365f41b127ff04e6aef2bdbbf9e.tar.gz gitea-e541a8c654e05365f41b127ff04e6aef2bdbbf9e.zip |
Make mention autocomplete case insensitive in new markdown editor (#24190)
This matches EasyMDE, and makes it easier to find the right user without
having to remember the exact name.
---------
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'web_src/js/features/comp')
-rw-r--r-- | web_src/js/features/comp/ComboMarkdownEditor.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/web_src/js/features/comp/ComboMarkdownEditor.js b/web_src/js/features/comp/ComboMarkdownEditor.js index 3eb8bf7076..eb73b0914d 100644 --- a/web_src/js/features/comp/ComboMarkdownEditor.js +++ b/web_src/js/features/comp/ComboMarkdownEditor.js @@ -107,8 +107,9 @@ class ComboMarkdownEditor { expander?.addEventListener('text-expander-change', ({detail: {key, provide, text}}) => { if (key === ':') { const matches = []; + const textLowerCase = text.toLowerCase(); for (const name of emojiKeys) { - if (name.includes(text)) { + if (name.toLowerCase().includes(textLowerCase)) { matches.push(name); if (matches.length >= maxExpanderMatches) break; } @@ -129,8 +130,9 @@ class ComboMarkdownEditor { provide({matched: true, fragment: ul}); } else if (key === '@') { const matches = []; + const textLowerCase = text.toLowerCase(); for (const obj of window.config.tributeValues) { - if (obj.key.includes(text)) { + if (obj.key.toLowerCase().includes(textLowerCase)) { matches.push(obj); if (matches.length >= maxExpanderMatches) break; } |