Compare commits
No commits in common. "38e468dc4fd939b078b67e85a55aa04c1dfe8b6c" and "acdfd10752a6eb065eb2281a50c9df4898fabd99" have entirely different histories.
38e468dc4f
...
acdfd10752
|
@ -2067,7 +2067,7 @@ export async function setSlashCommandAutoComplete(textarea, isFloating = false)
|
||||||
else {
|
else {
|
||||||
let matchingOptions = parserResult.optionList
|
let matchingOptions = parserResult.optionList
|
||||||
.filter(it => isReplacable || it.name == '' ? matchers[matchType](it.name) : it.name.toLowerCase() == slashCommand) // Filter by the input
|
.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
|
result = matchingOptions
|
||||||
.filter((it,idx) => matchingOptions.indexOf(it) == idx)
|
.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.selectionStart = parserResult.start - 2 + selectedItem.replacer.length;
|
||||||
textarea.selectionEnd = textarea.selectionStart;
|
textarea.selectionEnd = textarea.selectionStart;
|
||||||
show();
|
show();
|
||||||
} else {
|
|
||||||
const selectionStart = textarea.selectionStart;
|
|
||||||
const selectionEnd = textarea.selectionDirection;
|
|
||||||
await pointerup;
|
|
||||||
textarea.focus();
|
|
||||||
textarea.selectionStart = selectionStart;
|
|
||||||
textarea.selectionDirection = selectionEnd;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const showAutoCompleteDebounced = show;
|
const showAutoCompleteDebounced = show;
|
||||||
|
@ -2388,7 +2381,7 @@ export async function setSlashCommandAutoComplete(textarea, isFloating = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
textarea.addEventListener('blur', ()=>hide());
|
// textarea.addEventListener('blur', ()=>hide());
|
||||||
if (isFloating) {
|
if (isFloating) {
|
||||||
textarea.addEventListener('scroll', debounce(updateFloatingPosition, 100));
|
textarea.addEventListener('scroll', debounce(updateFloatingPosition, 100));
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,14 +178,12 @@ export class SlashCommandParser {
|
||||||
* @param {*} index Index to check for names (cursor position).
|
* @param {*} index Index to check for names (cursor position).
|
||||||
*/
|
*/
|
||||||
getNameAt(text, index) {
|
getNameAt(text, index) {
|
||||||
if (this.text != `{:${text}:}`) {
|
|
||||||
try {
|
try {
|
||||||
this.parse(text, false);
|
this.parse(text, false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// do nothing
|
// do nothing
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
index += 2;
|
index += 2;
|
||||||
const executor = this.commandIndex
|
const executor = this.commandIndex
|
||||||
.filter(it=>it.start <= index && (it.end >= index || it.end == null))
|
.filter(it=>it.start <= index && (it.end >= index || it.end == null))
|
||||||
|
|
Loading…
Reference in New Issue