mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix old name prepopulate, run formatter
This commit is contained in:
@@ -739,7 +739,8 @@ async function waitForConnection() {
|
|||||||
export async function initPresetManager() {
|
export async function initPresetManager() {
|
||||||
eventSource.on(event_types.CHAT_CHANGED, autoSelectPreset);
|
eventSource.on(event_types.CHAT_CHANGED, autoSelectPreset);
|
||||||
registerPresetManagers();
|
registerPresetManagers();
|
||||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'preset',
|
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||||
|
name: 'preset',
|
||||||
callback: presetCommandCallback,
|
callback: presetCommandCallback,
|
||||||
returns: 'current preset',
|
returns: 'current preset',
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
@@ -802,9 +803,9 @@ export async function initPresetManager() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const popupHeader = !presetManager.isAdvancedFormatting() ? t`Rename preset` : t`Rename template`;
|
const popupHeader = !presetManager.isAdvancedFormatting() ? t`Rename preset` : t`Rename template`;
|
||||||
const oldName = name;
|
const oldName = presetManager.getSelectedPresetName();
|
||||||
const newName = await Popup.show.input(popupHeader, t`Enter a new name:`, oldName);
|
const newName = await Popup.show.input(popupHeader, t`Enter a new name:`, oldName);
|
||||||
if (oldName === newName || !newName) {
|
if (!newName || oldName === newName) {
|
||||||
console.debug(!presetManager.isAdvancedFormatting() ? 'Preset rename cancelled' : 'Template rename cancelled');
|
console.debug(!presetManager.isAdvancedFormatting() ? 'Preset rename cancelled' : 'Template rename cancelled');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user