diff --git a/public/css/promptmanager.css b/public/css/promptmanager.css index 84b86a63e..f79d1a22a 100644 --- a/public/css/promptmanager.css +++ b/public/css/promptmanager.css @@ -250,6 +250,31 @@ background-color: #000; } +#prompt-manager-export-format-popup { + display:none; +} + +.prompt-manager-export-format-popup-flex { + display: flex; + flex-direction: column; +} + +.prompt-manager-export-format-popup-flex .row { + display: flex; + justify-content: space-between; +} + +.prompt-manager-export-format-popup-flex a, +.prompt-manager-export-format-popup-flex span { + display: flex; + margin: auto 0; + justify-content: space-between; +} + +#prompt-manager-export-format-popup span { + font-size: 16px; +} + @media screen and (max-width: 412px) { #completion_prompt_manager #completion_prompt_manager_list { font-size: 1.25em !important; diff --git a/public/scripts/PromptManager.js b/public/scripts/PromptManager.js index db1e40dad..61df4dc95 100644 --- a/public/scripts/PromptManager.js +++ b/public/scripts/PromptManager.js @@ -316,8 +316,7 @@ PromptManagerModule.prototype.init = function (moduleConfiguration, serviceSetti } this.handleImport = () => { - - callPopup('Your prompts will be merged with the import. Imported prompts with the same ID will override existing prompts.', 'confirm',) + callPopup('Existing prompts with the same ID will be overridden. Do you want to proceed?', 'confirm',) .then(userChoice => { if (false === userChoice) return; @@ -338,8 +337,9 @@ PromptManagerModule.prototype.init = function (moduleConfiguration, serviceSetti const data = JSON.parse(fileContent); this.import(data); } catch (err) { - this.log('An error occurred while importing prompts'); - this.log(err.toString()); + toastr.error('An error occurred while importing prompts. More info available in console.') + console.log('An error occurred while importing prompts'); + console.log(err.toString()); } }; @@ -951,17 +951,26 @@ PromptManagerModule.prototype.renderPromptManager = function () { - - + ${ this.serviceSettings.prompt_manager_settings.showAdvancedSettings + ? ` + ` : '' } `; const exportPopup = `
- Export all - Export for character -
+
+
+ Export all + +
+
+ Export for character + +
+
+ `; const rangeBlockDiv = promptManagerDiv.querySelector('.range-block'); @@ -971,7 +980,7 @@ PromptManagerModule.prototype.renderPromptManager = function () { let exportPopper = Popper.createPopper( document.getElementById('prompt-manager-export'), document.getElementById('prompt-manager-export-format-popup'), - { placement: 'bottom'} + {placement: 'bottom'} ); const showExportSelection = () => { @@ -984,15 +993,17 @@ PromptManagerModule.prototype.renderPromptManager = function () { exportPopper.update(); } - rangeBlockDiv.querySelector('.export-promptmanager-prompts-full').addEventListener('click', this.handleFullExport); - rangeBlockDiv.querySelector('.export-promptmanager-prompts-character').addEventListener('click', this.handleCharacterExport); - const footerDiv = rangeBlockDiv.querySelector(`.${this.configuration.prefix}prompt_manager_footer`); footerDiv.querySelector('.menu_button:nth-child(2)').addEventListener('click', this.handleAppendPrompt); footerDiv.querySelector('.caution').addEventListener('click', this.handleDeletePrompt); footerDiv.querySelector('.menu_button:last-child').addEventListener('click', this.handleNewPrompt); - footerDiv.querySelector('#prompt-manager-export').addEventListener('click', showExportSelection); - footerDiv.querySelector('#prompt-manager-import').addEventListener('click', this.handleImport); + + if (true === this.serviceSettings.prompt_manager_settings.showAdvancedSettings) { + footerDiv.querySelector('#prompt-manager-import').addEventListener('click', this.handleImport); + footerDiv.querySelector('#prompt-manager-export').addEventListener('click', showExportSelection); + rangeBlockDiv.querySelector('.export-promptmanager-prompts-full').addEventListener('click', this.handleFullExport); + rangeBlockDiv.querySelector('.export-promptmanager-prompts-character').addEventListener('click', this.handleCharacterExport); + } } };