mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
fix alphabetical order of QR Sets
This commit is contained in:
@ -827,7 +827,7 @@ export class QuickReply {
|
|||||||
const tpl = dom.querySelector('#qr--ctxItem');
|
const tpl = dom.querySelector('#qr--ctxItem');
|
||||||
const linkList = dom.querySelector('#qr--ctxEditor');
|
const linkList = dom.querySelector('#qr--ctxEditor');
|
||||||
const fillQrSetSelect = (/**@type {HTMLSelectElement}*/select, /**@type {QuickReplyContextLink}*/ link) => {
|
const fillQrSetSelect = (/**@type {HTMLSelectElement}*/select, /**@type {QuickReplyContextLink}*/ link) => {
|
||||||
[{ name: 'Select a QR set' }, ...QuickReplySet.list].forEach(qrs => {
|
[{ name: 'Select a QR set' }, ...QuickReplySet.list.toSorted((a,b)=>a.name.toLowerCase().localeCompare(b.name.toLowerCase()))].forEach(qrs => {
|
||||||
const opt = document.createElement('option'); {
|
const opt = document.createElement('option'); {
|
||||||
opt.value = qrs.name;
|
opt.value = qrs.name;
|
||||||
opt.textContent = qrs.name;
|
opt.textContent = qrs.name;
|
||||||
|
@ -45,7 +45,7 @@ export class QuickReplySetLink {
|
|||||||
this.set = QuickReplySet.get(set.value);
|
this.set = QuickReplySet.get(set.value);
|
||||||
this.update();
|
this.update();
|
||||||
});
|
});
|
||||||
QuickReplySet.list.forEach(qrs=>{
|
QuickReplySet.list.toSorted((a,b)=>a.name.toLowerCase().localeCompare(b.name.toLowerCase())).forEach(qrs=>{
|
||||||
const opt = document.createElement('option'); {
|
const opt = document.createElement('option'); {
|
||||||
opt.value = qrs.name;
|
opt.value = qrs.name;
|
||||||
opt.textContent = qrs.name;
|
opt.textContent = qrs.name;
|
||||||
|
@ -141,7 +141,7 @@ export class SettingsUi {
|
|||||||
this.qrList = this.dom.querySelector('#qr--set-qrList');
|
this.qrList = this.dom.querySelector('#qr--set-qrList');
|
||||||
this.currentSet = this.dom.querySelector('#qr--set');
|
this.currentSet = this.dom.querySelector('#qr--set');
|
||||||
this.currentSet.addEventListener('change', ()=>this.onQrSetChange());
|
this.currentSet.addEventListener('change', ()=>this.onQrSetChange());
|
||||||
QuickReplySet.list.forEach(qrs=>{
|
QuickReplySet.list.toSorted((a,b)=>a.name.toLowerCase().localeCompare(b.name.toLowerCase())).forEach(qrs=>{
|
||||||
const opt = document.createElement('option'); {
|
const opt = document.createElement('option'); {
|
||||||
opt.value = qrs.name;
|
opt.value = qrs.name;
|
||||||
opt.textContent = qrs.name;
|
opt.textContent = qrs.name;
|
||||||
@ -315,7 +315,7 @@ export class SettingsUi {
|
|||||||
const qrs = new QuickReplySet();
|
const qrs = new QuickReplySet();
|
||||||
qrs.name = name;
|
qrs.name = name;
|
||||||
qrs.addQuickReply();
|
qrs.addQuickReply();
|
||||||
const idx = QuickReplySet.list.findIndex(it=>it.name.localeCompare(name) == 1);
|
const idx = QuickReplySet.list.findIndex(it=>it.name.toLowerCase().localeCompare(name.toLowerCase()) == 1);
|
||||||
if (idx > -1) {
|
if (idx > -1) {
|
||||||
QuickReplySet.list.splice(idx, 0, qrs);
|
QuickReplySet.list.splice(idx, 0, qrs);
|
||||||
} else {
|
} else {
|
||||||
@ -371,7 +371,7 @@ export class SettingsUi {
|
|||||||
this.prepareChatSetList();
|
this.prepareChatSetList();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const idx = QuickReplySet.list.findIndex(it=>it.name.localeCompare(qrs.name) == 1);
|
const idx = QuickReplySet.list.findIndex(it=>it.name.toLowerCase().localeCompare(qrs.name.toLowerCase()) == 1);
|
||||||
if (idx > -1) {
|
if (idx > -1) {
|
||||||
QuickReplySet.list.splice(idx, 0, qrs);
|
QuickReplySet.list.splice(idx, 0, qrs);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user