#2482 Fix embedded content confirmation

6dbbf89d659db34375e094e7b67b825a982af9b2

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

2 files changed, +8 -8Ignore whitespace
public/scripts/extensions/regex/index.js+6 -6
@@ -1,13 +1,13 @@
1import { callPopup, characters, eventSource, event_types, getCurrentChatId, reloadCurrentChat, saveSettingsDebounced, this_chid } from '../../../script.js';1import { callPopup, characters, eventSource, event_types, getCurrentChatId, reloadCurrentChat, saveSettingsDebounced, this_chid } from '../../../script.js';
2import { extension_settings, renderExtensionTemplateAsync, writeExtensionField } from '../../extensions.js';2import { extension_settings, renderExtensionTemplateAsync, writeExtensionField } from '../../extensions.js';
3import { selected_group } from '../../group-chats.js';3import { selected_group } from '../../group-chats.js';
4import { callGenericPopup, POPUP_TYPE } from '../../popup.js';
4import { SlashCommand } from '../../slash-commands/SlashCommand.js';5import { SlashCommand } from '../../slash-commands/SlashCommand.js';
5import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';6import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
6import { enumIcons } from '../../slash-commands/SlashCommandCommonEnumsProvider.js';7import { enumIcons } from '../../slash-commands/SlashCommandCommonEnumsProvider.js';
7import { SlashCommandEnumValue, enumTypes } from '../../slash-commands/SlashCommandEnumValue.js';8import { SlashCommandEnumValue, enumTypes } from '../../slash-commands/SlashCommandEnumValue.js';
8import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js';9import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js';
9import { download, getFileText, getSortableDelay, uuidv4 } from '../../utils.js';10import { download, getFileText, getSortableDelay, uuidv4 } from '../../utils.js';
10import { resolveVariable } from '../../variables.js';
11import { regex_placement, runRegexScript } from './engine.js';11import { regex_placement, runRegexScript } from './engine.js';
1212
13/**13/**
@@ -141,7 +141,7 @@ async function loadRegexScripts() {
141 await onRegexEditorOpenClick(scriptHtml.attr('id'), isScoped);141 await onRegexEditorOpenClick(scriptHtml.attr('id'), isScoped);
142 });142 });
143 scriptHtml.find('.move_to_global').on('click', async function () {143 scriptHtml.find('.move_to_global').on('click', async function () {
144 const confirm = await callPopup('Are you sure you want to move this regex script to global?', 'confirm');144 const confirm = await callGenericPopup('Are you sure you want to move this regex script to global?', POPUP_TYPE.CONFIRM);
145145
146 if (!confirm) {146 if (!confirm) {
147 return;147 return;
@@ -161,7 +161,7 @@ async function loadRegexScripts() {
161 return;161 return;
162 }162 }
163163
164 const confirm = await callPopup('Are you sure you want to move this regex script to scoped?', 'confirm');164 const confirm = await callGenericPopup('Are you sure you want to move this regex script to scoped?', POPUP_TYPE.CONFIRM);
165165
166 if (!confirm) {166 if (!confirm) {
167 return;167 return;
@@ -176,7 +176,7 @@ async function loadRegexScripts() {
176 download(fileData, fileName, 'application/json');176 download(fileData, fileName, 'application/json');
177 });177 });
178 scriptHtml.find('.delete_regex').on('click', async function () {178 scriptHtml.find('.delete_regex').on('click', async function () {
179 const confirm = await callPopup('Are you sure you want to delete this regex script?', 'confirm');179 const confirm = await callGenericPopup('Are you sure you want to delete this regex script?', POPUP_TYPE.CONFIRM);
180180
181 if (!confirm) {181 if (!confirm) {
182 return;182 return;
@@ -442,7 +442,7 @@ async function checkEmbeddedRegexScripts() {
442 if (!localStorage.getItem(checkKey)) {442 if (!localStorage.getItem(checkKey)) {
443 localStorage.setItem(checkKey, 'true');443 localStorage.setItem(checkKey, 'true');
444 const template = await renderExtensionTemplateAsync('regex', 'embeddedScripts', {});444 const template = await renderExtensionTemplateAsync('regex', 'embeddedScripts', {});
445 const result = await callPopup(template, 'confirm', '', { okButton: 'Yes' });445 const result = await callGenericPopup(template, POPUP_TYPE.CONFIRM, '', { okButton: 'Yes' });
446446
447 if (result) {447 if (result) {
448 extension_settings.character_allowed_regex.push(avatar);448 extension_settings.character_allowed_regex.push(avatar);
@@ -493,7 +493,7 @@ jQuery(async () => {
493 template.find('#regex_import_target_global').on('input', () => target = 'global');493 template.find('#regex_import_target_global').on('input', () => target = 'global');
494 template.find('#regex_import_target_scoped').on('input', () => target = 'scoped');494 template.find('#regex_import_target_scoped').on('input', () => target = 'scoped');
495495
496 await callPopup(template, 'text');496 await callGenericPopup(template, POPUP_TYPE.TEXT);
497497
498 const inputElement = this instanceof HTMLInputElement && this;498 const inputElement = this instanceof HTMLInputElement && this;
499 for (const file of inputElement.files) {499 for (const file of inputElement.files) {
public/scripts/world-info.js+2 -2
@@ -16,7 +16,7 @@ import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandE
16import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';16import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
17import { SlashCommandExecutor } from './slash-commands/SlashCommandExecutor.js';17import { SlashCommandExecutor } from './slash-commands/SlashCommandExecutor.js';
18import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js';18import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js';
19import { Popup } from './popup.js';19import { callGenericPopup, Popup, POPUP_TYPE } from './popup.js';
2020
21export {21export {
22 world_info,22 world_info,
@@ -4224,7 +4224,7 @@ export function checkEmbeddedWorld(chid) {
4224 importEmbeddedWorldInfo(true);4224 importEmbeddedWorldInfo(true);
4225 }4225 }
4226 };4226 };
4227 callPopup(html, 'confirm', '', { okButton: 'Yes' }).then(checkResult);4227 callGenericPopup(html, POPUP_TYPE.CONFIRM, '', { okButton: 'Yes' }).then(checkResult);
4228 }4228 }
4229 else {4229 else {
4230 toastr.info(4230 toastr.info(