Skip to content

Commit adbf25c

Browse files
authored
Fixed user comparison in the fetch function, and sorted the names (#3511)
1 parent 4ee1ed8 commit adbf25c

File tree

1 file changed

+2
-1
lines changed
  • modules/ROOT/examples/live-demos/mentions

1 file changed

+2
-1
lines changed

modules/ROOT/examples/live-demos/mentions/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ tinymce.ScriptLoader.loadScripts(['https://cdn.jsdelivr.net/npm/faker@5/dist/fak
2121
for (let i = 0; i < 200; i++) {
2222
userNames.push(faker.name.findName());
2323
}
24+
userNames.sort((a, b) => a.localeCompare(b));
2425

2526
/* This represents a database of users on the server */
2627
const userDb = {};
@@ -79,7 +80,7 @@ tinymce.ScriptLoader.loadScripts(['https://cdn.jsdelivr.net/npm/faker@5/dist/fak
7980
}
8081
usersRequest.then((users) => {
8182
/* `query.term` is the text the user typed after the '@' */
82-
users = users.filter((user) => user.name.indexOf(query.term.toLowerCase()) !== -1);
83+
users = users.filter((user) => user.name.toLowerCase().includes(query.term.toLowerCase()))
8384

8485
users = users.slice(0, 10);
8586

0 commit comments

Comments
 (0)