Compare commits

..

No commits in common. "38e468dc4fd939b078b67e85a55aa04c1dfe8b6c" and "acdfd10752a6eb065eb2281a50c9df4898fabd99" have entirely different histories.

2 changed files with 7 additions and 16 deletions

View File

@ -2067,7 +2067,7 @@ export async function setSlashCommandAutoComplete(textarea, isFloating = false)
else {
let matchingOptions = parserResult.optionList
.filter(it => isReplacable || it.name == '' ? matchers[matchType](it.name) : it.name.toLowerCase() == slashCommand) // Filter by the input
.filter((it,idx,list) => list.findIndex(opt=>opt.value == it.value) == idx)
.filter((it,idx,list) => list.indexOf(it) == idx)
;
result = matchingOptions
.filter((it,idx) => matchingOptions.indexOf(it) == idx)
@ -2266,13 +2266,6 @@ export async function setSlashCommandAutoComplete(textarea, isFloating = false)
textarea.selectionStart = parserResult.start - 2 + selectedItem.replacer.length;
textarea.selectionEnd = textarea.selectionStart;
show();
} else {
const selectionStart = textarea.selectionStart;
const selectionEnd = textarea.selectionDirection;
await pointerup;
textarea.focus();
textarea.selectionStart = selectionStart;
textarea.selectionDirection = selectionEnd;
}
};
const showAutoCompleteDebounced = show;
@ -2388,7 +2381,7 @@ export async function setSlashCommandAutoComplete(textarea, isFloating = false)
}
}
});
textarea.addEventListener('blur', ()=>hide());
// textarea.addEventListener('blur', ()=>hide());
if (isFloating) {
textarea.addEventListener('scroll', debounce(updateFloatingPosition, 100));
}

View File

@ -178,13 +178,11 @@ export class SlashCommandParser {
* @param {*} index Index to check for names (cursor position).
*/
getNameAt(text, index) {
if (this.text != `{:${text}:}`) {
try {
this.parse(text, false);
} catch (e) {
// do nothing
console.warn(e);
}
try {
this.parse(text, false);
} catch (e) {
// do nothing
console.warn(e);
}
index += 2;
const executor = this.commandIndex