mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
add delete hack :(
This commit is contained in:
@ -15,7 +15,6 @@ import { SettingsUi } from './src/ui/SettingsUi.js';
|
||||
//TODO context menus
|
||||
//TODO move advanced QR options into own UI class
|
||||
//TODO slash commands
|
||||
//TODO delete QR set
|
||||
//TODO handle replacing QR set (create->overwrite): update configs that use this set
|
||||
//TODO easy way to CRUD QRs and sets
|
||||
//TODO easy way to set global and chat sets
|
||||
|
@ -211,6 +211,20 @@ export class SettingsUi {
|
||||
const confirmed = await callPopup(`Are you sure you want to delete the Quick Reply Set "${this.currentQrSet.name}"? This cannot be undone.`, 'confirm');
|
||||
if (confirmed) {
|
||||
await this.currentQrSet.delete();
|
||||
//HACK should just bubble up from QuickReplySet.delete() but that would require proper or at least more comples onDelete listeners
|
||||
for (let i = this.settings.config.setList.length - 1; i >= 0; i--) {
|
||||
if (this.settings.config.setList[i].set == this.currentQrSet) {
|
||||
this.settings.config.setList.splice(i, 1);
|
||||
}
|
||||
}
|
||||
if (this.settings.chatConfig) {
|
||||
for (let i = this.settings.chatConfig.setList.length - 1; i >= 0; i--) {
|
||||
if (this.settings.config.setList[i].set == this.currentQrSet) {
|
||||
this.settings.config.setList.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.settings.save();
|
||||
this.rerender();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user