mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fallback for old safari
This commit is contained in:
@ -50,6 +50,14 @@ export class SlashCommandAutoCompleteNameResult extends AutoCompleteNameResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getNamedArgumentAt(text, index, isSelect) {
|
getNamedArgumentAt(text, index, isSelect) {
|
||||||
|
function getSplitRegex() {
|
||||||
|
try {
|
||||||
|
return new RegExp('(?<==)');
|
||||||
|
} catch {
|
||||||
|
// For browsers that don't support lookbehind
|
||||||
|
return new RegExp('=(.*)');
|
||||||
|
}
|
||||||
|
}
|
||||||
const notProvidedNamedArguments = this.executor.command.namedArgumentList.filter(arg=>!this.executor.namedArgumentList.find(it=>it.name == arg.name));
|
const notProvidedNamedArguments = this.executor.command.namedArgumentList.filter(arg=>!this.executor.namedArgumentList.find(it=>it.name == arg.name));
|
||||||
let name;
|
let name;
|
||||||
let value;
|
let value;
|
||||||
@ -62,7 +70,7 @@ export class SlashCommandAutoCompleteNameResult extends AutoCompleteNameResult {
|
|||||||
// cursor is somewhere within the named arguments (including final space)
|
// cursor is somewhere within the named arguments (including final space)
|
||||||
argAssign = this.executor.namedArgumentList.find(it=>it.start <= index && it.end >= index);
|
argAssign = this.executor.namedArgumentList.find(it=>it.start <= index && it.end >= index);
|
||||||
if (argAssign) {
|
if (argAssign) {
|
||||||
const [argName, ...v] = text.slice(argAssign.start, index).split(/(?<==)/);
|
const [argName, ...v] = text.slice(argAssign.start, index).split(getSplitRegex());
|
||||||
name = argName;
|
name = argName;
|
||||||
value = v.join('');
|
value = v.join('');
|
||||||
start = argAssign.start;
|
start = argAssign.start;
|
||||||
|
Reference in New Issue
Block a user