Skip to content

Commit e541a8c

Browse files
brechtvlsilverwind
andauthored
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>
1 parent 7ca7590 commit e541a8c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

web_src/js/features/comp/ComboMarkdownEditor.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ class ComboMarkdownEditor {
107107
expander?.addEventListener('text-expander-change', ({detail: {key, provide, text}}) => {
108108
if (key === ':') {
109109
const matches = [];
110+
const textLowerCase = text.toLowerCase();
110111
for (const name of emojiKeys) {
111-
if (name.includes(text)) {
112+
if (name.toLowerCase().includes(textLowerCase)) {
112113
matches.push(name);
113114
if (matches.length >= maxExpanderMatches) break;
114115
}
@@ -129,8 +130,9 @@ class ComboMarkdownEditor {
129130
provide({matched: true, fragment: ul});
130131
} else if (key === '@') {
131132
const matches = [];
133+
const textLowerCase = text.toLowerCase();
132134
for (const obj of window.config.tributeValues) {
133-
if (obj.key.includes(text)) {
135+
if (obj.key.toLowerCase().includes(textLowerCase)) {
134136
matches.push(obj);
135137
if (matches.length >= maxExpanderMatches) break;
136138
}

0 commit comments

Comments
 (0)