Fix old name prepopulate, run formatter

7061753d84ce2a7f428f3e92792f0a13f535423a

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -3Showing whitespace changes
public/scripts/preset-manager.js+4 -3
@@ -739,7 +739,8 @@ async function waitForConnection() {
739export async function initPresetManager() {739export async function initPresetManager() {
740 eventSource.on(event_types.CHAT_CHANGED, autoSelectPreset);740 eventSource.on(event_types.CHAT_CHANGED, autoSelectPreset);
741 registerPresetManagers();741 registerPresetManagers();
742 SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'preset',742 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
743 name: 'preset',
743 callback: presetCommandCallback,744 callback: presetCommandCallback,
744 returns: 'current preset',745 returns: 'current preset',
745 unnamedArgumentList: [746 unnamedArgumentList: [
@@ -802,9 +803,9 @@ export async function initPresetManager() {
802 }803 }
803804
804 const popupHeader = !presetManager.isAdvancedFormatting() ? t`Rename preset` : t`Rename template`;805 const popupHeader = !presetManager.isAdvancedFormatting() ? t`Rename preset` : t`Rename template`;
805 const oldName = name;806 const oldName = presetManager.getSelectedPresetName();
806 const newName = await Popup.show.input(popupHeader, t`Enter a new name:`, oldName);807 const newName = await Popup.show.input(popupHeader, t`Enter a new name:`, oldName);
807 if (oldName === newName || !newName) {808 if (!newName || oldName === newName) {
808 console.debug(!presetManager.isAdvancedFormatting() ? 'Preset rename cancelled' : 'Template rename cancelled');809 console.debug(!presetManager.isAdvancedFormatting() ? 'Preset rename cancelled' : 'Template rename cancelled');
809 return;810 return;
810 }811 }