Fix old name prepopulate, run formatter

This commit is contained in:
Cohee
2024-10-09 01:29:23 +03:00
parent 4b0d342e8b
commit 7061753d84

View File

@@ -739,7 +739,8 @@ async function waitForConnection() {
export async function initPresetManager() {
eventSource.on(event_types.CHAT_CHANGED, autoSelectPreset);
registerPresetManagers();
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'preset',
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'preset',
callback: presetCommandCallback,
returns: 'current preset',
unnamedArgumentList: [
@@ -802,9 +803,9 @@ export async function initPresetManager() {
}
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);
if (oldName === newName || !newName) {
if (!newName || oldName === newName) {
console.debug(!presetManager.isAdvancedFormatting() ? 'Preset rename cancelled' : 'Template rename cancelled');
return;
}