feat: sound autocomplete matches anywhere in name using includes()
This commit is contained in:
parent
ed182d4b3f
commit
cd659ac2a1
1 changed files with 1 additions and 1 deletions
|
|
@ -155,7 +155,7 @@ function soundHandler(context) {
|
||||||
const fragment = fragMatch ? fragMatch[1] : inside;
|
const fragment = fragMatch ? fragMatch[1] : inside;
|
||||||
if (!fragment || fragment.length === 0) return null;
|
if (!fragment || fragment.length === 0) return null;
|
||||||
const soundNames = Object.keys(soundMap.get()).sort();
|
const soundNames = Object.keys(soundMap.get()).sort();
|
||||||
const filteredSounds = soundNames.filter((name) => name.startsWith(fragment));
|
const filteredSounds = soundNames.filter((name) => name.includes(fragment));
|
||||||
let options = filteredSounds.map((name) => ({ label: name, type: 'sound' }));
|
let options = filteredSounds.map((name) => ({ label: name, type: 'sound' }));
|
||||||
const from = soundContext.to - fragment.length;
|
const from = soundContext.to - fragment.length;
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue