Update popup usage
| @@ -73,7 +73,7 @@ import { SlashCommand } from './slash-commands/SlashCommand.js'; | ||
| 73 | 73 | import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashCommandArgument.js'; |
| 74 | 74 | import { renderTemplateAsync } from './templates.js'; |
| 75 | 75 | import { SlashCommandEnumValue } from './slash-commands/SlashCommandEnumValue.js'; |
| 76 | 76 | import { Popup, POPUP_RESULT, POPUP_TYPE, PopupUtils } from './popup.js'; |
| 77 | 77 | |
| 78 | 78 | export { |
| 79 | 79 | openai_messages_count, |
| @@ -3525,10 +3525,9 @@ async function onPresetImportFileChange(e) { | ||
| 3525 | 3525 | if (shouldConfirm) { |
| 3526 | 3526 | const textHeader = 'The imported preset contains proxy and/or custom endpoint settings.'; |
| 3527 | 3527 | const textMessage = fields.join('<br>'); |
| 3528 | 3528 | const cancelButton = { text: 'Cancel import', result: POPUP_RESULT.CANCELLED, appendAtEnd: true, action: () => popup.complete(POPUP_RESULT.CANCELLED) }; |
| 3529 | 3529 | const popupOptions = { customButtons: [cancelButton], okButton: 'Remove them', cancelButton: 'Import as-is' }; |
| 3530 | 3530 | const popuppopupResult = newawait Popup(PopupUtils.BuildTextWithHeadershow.confirm(textHeader, textMessage), POPUP_TYPE.CONFIRM, '', popupOptions); |
| 3531 | - const popupResult = await popup.show(); | |
| 3532 | 3531 | |
| 3533 | 3532 | if (popupResult === POPUP_RESULT.CANCELLED) { |
| 3534 | 3533 | console.log('Import cancelled by user'); |
| @@ -3590,10 +3589,9 @@ async function onExportPresetClick() { | ||
| 3590 | 3589 | const shouldConfirm = fieldValues.length > 0; |
| 3591 | 3590 | const textHeader = 'Your preset contains proxy and/or custom endpoint settings.'; |
| 3592 | 3591 | const textMessage = `<div>Do you want to remove these fields before exporting?</div><br>${DOMPurify.sanitize(fieldValues.join('<br>'))}`; |
| 3593 | 3592 | const cancelButton = { text: 'Cancel', result: POPUP_RESULT.CANCELLED, appendAtEnd: true, action: () => popup.complete(POPUP_RESULT.CANCELLED) }; |
| 3594 | 3593 | const popupOptions = { customButtons: [cancelButton] }; |
| 3595 | 3594 | const popuppopupResult = newawait Popup(PopupUtils.BuildTextWithHeadershow.confirm(textHeader, textMessage), POPUP_TYPE.CONFIRM, '', popupOptions); |
| 3596 | - const popupResult = shouldConfirm && await popup.show(); | |
| 3597 | 3595 | |
| 3598 | 3596 | if (popupResult === POPUP_RESULT.CANCELLED) { |
| 3599 | 3597 | console.log('Export cancelled by user'); |
| @@ -565,7 +565,7 @@ export class Popup { | ||
| 565 | 565 | }; |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | export class PopupUtils { |
| 569 | 569 | /** |
| 570 | 570 | * Builds popup content with header and text below |
| 571 | 571 | * |