Fix old name prepopulate, run formatter
| @@ -739,7 +739,8 @@ async function waitForConnection() { | |||
| 739 | export async function initPresetManager() { | 739 | export 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 | } |
| 803 | 804 | ||
| 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 | } |