default context preset cannot be deleted
This commit is contained in:
parent
7e506db105
commit
3509e6b1d4
|
@ -2093,12 +2093,12 @@
|
|||
<div class="preset_buttons">
|
||||
<select id="context_presets" data-preset-manager-for="context" class="flex1"></select>
|
||||
<input type="file" hidden data-preset-manager-file="context" accept=".json, .settings">
|
||||
<i id="context_set_default" class="menu_button fa-solid fa-heart" title="Auto-select this preset on API connection."></i>
|
||||
<i id="context_set_default" class="menu_button fa-solid fa-heart" title="Auto-select this preset for Instruct Mode."></i>
|
||||
<i data-preset-manager-update="context" class="menu_button fa-solid fa-save" title="Update current preset" data-i18n="[title]Update current preset"></i>
|
||||
<i data-preset-manager-new="context" class="menu_button fa-solid fa-plus" title="Create new preset" data-i18n="[title]Create new preset"></i>
|
||||
<i data-preset-manager-import="context" class="menu_button fa-solid fa-file-import" title="Import preset" data-i18n="[title]Import preset"></i>
|
||||
<i data-preset-manager-export="context" class="menu_button fa-solid fa-file-export" title="Export preset" data-i18n="[title]Export preset"></i>
|
||||
<i data-preset-manager-delete="context" class="menu_button fa-solid fa-trash-can" title="Delete the preset" data-i18n="[title]Delete the preset"></i>
|
||||
<i id="context_delete_preset" data-preset-manager-delete="context" class="menu_button fa-solid fa-trash-can" title="Delete the preset" data-i18n="[title]Delete the preset"></i>
|
||||
</div>
|
||||
<div>
|
||||
<label for="context_story_string">
|
||||
|
|
|
@ -975,6 +975,8 @@ function loadContextSettings() {
|
|||
|
||||
function highlightDefaultContext() {
|
||||
$('#context_set_default').toggleClass('default', power_user.default_context === power_user.context.preset);
|
||||
$('#context_set_default').toggleClass('disabled', power_user.default_context === power_user.context.preset);
|
||||
$('#context_delete_preset').toggleClass('disabled', power_user.default_context === power_user.context.preset);
|
||||
}
|
||||
|
||||
export function fuzzySearchCharacters(searchValue) {
|
||||
|
|
|
@ -399,6 +399,11 @@ jQuery(async () => {
|
|||
return;
|
||||
}
|
||||
|
||||
// default context preset cannot be deleted
|
||||
if (apiId == "context" && power_user.default_context === power_user.context.preset) {
|
||||
return;
|
||||
}
|
||||
|
||||
const confirm = await callPopup('Delete the preset? This action is irreversible and your current settings will be overwritten.', 'confirm');
|
||||
|
||||
if (!confirm) {
|
||||
|
|
Loading…
Reference in New Issue