mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
order wildcard macros by index of wildcard for substitute
This commit is contained in:
@ -65,6 +65,7 @@ export class SlashCommandClosure {
|
|||||||
const macroList = scope.macroList.toSorted((a,b)=>{
|
const macroList = scope.macroList.toSorted((a,b)=>{
|
||||||
if (a.key.includes('*') && !b.key.includes('*')) return 1;
|
if (a.key.includes('*') && !b.key.includes('*')) return 1;
|
||||||
if (!a.key.includes('*') && b.key.includes('*')) return -1;
|
if (!a.key.includes('*') && b.key.includes('*')) return -1;
|
||||||
|
if (a.key.includes('*') && b.key.includes('*')) return b.key.indexOf('*') - a.key.indexOf('*');
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
const macros = macroList.map(it=>escapeMacro(it)).join('|');
|
const macros = macroList.map(it=>escapeMacro(it)).join('|');
|
||||||
|
Reference in New Issue
Block a user