Skip to content

Commit

Permalink
Fixed user comparison in the fetch function, and sorted the names
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSpyder committed Nov 18, 2024
1 parent 180715f commit a9b4f90
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/ROOT/examples/live-demos/mentions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ tinymce.ScriptLoader.loadScripts(['https://cdn.jsdelivr.net/npm/faker@5/dist/fak
for (let i = 0; i < 200; i++) {
userNames.push(faker.name.findName());
}
userNames.sort((a, b) => a.localeCompare(b));

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

users = users.slice(0, 10);

Expand Down

0 comments on commit a9b4f90

Please sign in to comment.