mirror of
https://github.com/go-gitea/gitea
synced 2024-11-30 05:08:56 +01:00
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>
This commit is contained in:
parent
7ca7590c39
commit
e541a8c654
1 changed files with 4 additions and 2 deletions
|
@ -107,8 +107,9 @@ class ComboMarkdownEditor {
|
||||||
expander?.addEventListener('text-expander-change', ({detail: {key, provide, text}}) => {
|
expander?.addEventListener('text-expander-change', ({detail: {key, provide, text}}) => {
|
||||||
if (key === ':') {
|
if (key === ':') {
|
||||||
const matches = [];
|
const matches = [];
|
||||||
|
const textLowerCase = text.toLowerCase();
|
||||||
for (const name of emojiKeys) {
|
for (const name of emojiKeys) {
|
||||||
if (name.includes(text)) {
|
if (name.toLowerCase().includes(textLowerCase)) {
|
||||||
matches.push(name);
|
matches.push(name);
|
||||||
if (matches.length >= maxExpanderMatches) break;
|
if (matches.length >= maxExpanderMatches) break;
|
||||||
}
|
}
|
||||||
|
@ -129,8 +130,9 @@ class ComboMarkdownEditor {
|
||||||
provide({matched: true, fragment: ul});
|
provide({matched: true, fragment: ul});
|
||||||
} else if (key === '@') {
|
} else if (key === '@') {
|
||||||
const matches = [];
|
const matches = [];
|
||||||
|
const textLowerCase = text.toLowerCase();
|
||||||
for (const obj of window.config.tributeValues) {
|
for (const obj of window.config.tributeValues) {
|
||||||
if (obj.key.includes(text)) {
|
if (obj.key.toLowerCase().includes(textLowerCase)) {
|
||||||
matches.push(obj);
|
matches.push(obj);
|
||||||
if (matches.length >= maxExpanderMatches) break;
|
if (matches.length >= maxExpanderMatches) break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue