fix alphabetical order of QR Sets

This commit is contained in:
LenAnderson
2024-07-16 11:00:59 -04:00
parent 25c86b65ac
commit 2a9ba4aec4
3 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 {