mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Change popup cancel result in command to empty str
This commit is contained in:
@ -92,7 +92,7 @@ const showPopupHelper = {
|
|||||||
* @param {string?} header - The header text for the popup.
|
* @param {string?} header - The header text for the popup.
|
||||||
* @param {string?} text - The main text for the popup.
|
* @param {string?} text - The main text for the popup.
|
||||||
* @param {PopupOptions} [popupOptions={}] - Options for the popup.
|
* @param {PopupOptions} [popupOptions={}] - Options for the popup.
|
||||||
* @return {Promise<POPUP_RESULT>} A Promise that resolves with the result of the user's interaction.
|
* @return {Promise<POPUP_RESULT?>} A Promise that resolves with the result of the user's interaction.
|
||||||
*/
|
*/
|
||||||
confirm: async (header, text, popupOptions = {}) => {
|
confirm: async (header, text, popupOptions = {}) => {
|
||||||
const content = PopupUtils.BuildTextWithHeader(header, text);
|
const content = PopupUtils.BuildTextWithHeader(header, text);
|
||||||
@ -107,7 +107,7 @@ const showPopupHelper = {
|
|||||||
* @param {string?} header - The header text for the popup.
|
* @param {string?} header - The header text for the popup.
|
||||||
* @param {string?} text - The main text for the popup.
|
* @param {string?} text - The main text for the popup.
|
||||||
* @param {PopupOptions} [popupOptions={}] - Options for the popup.
|
* @param {PopupOptions} [popupOptions={}] - Options for the popup.
|
||||||
* @return {Promise<POPUP_RESULT>} A Promise that resolves with the result of the user's interaction.
|
* @return {Promise<POPUP_RESULT?>} A Promise that resolves with the result of the user's interaction.
|
||||||
*/
|
*/
|
||||||
text: async (header, text, popupOptions = {}) => {
|
text: async (header, text, popupOptions = {}) => {
|
||||||
const content = PopupUtils.BuildTextWithHeader(header, text);
|
const content = PopupUtils.BuildTextWithHeader(header, text);
|
||||||
|
@ -1308,7 +1308,7 @@ export function initDefaultSlashCommands() {
|
|||||||
}),
|
}),
|
||||||
SlashCommandNamedArgument.fromProps({
|
SlashCommandNamedArgument.fromProps({
|
||||||
name: 'result',
|
name: 'result',
|
||||||
description: 'if enabled, returns the popup result (as an integer) instead of the popup text. Resolves to 1 for OK and 0/null for cancel or exiting out.',
|
description: 'if enabled, returns the popup result (as an integer) instead of the popup text. Resolves to 1 for OK and 0 cancel button, empty string for exiting out.',
|
||||||
typeList: [ARGUMENT_TYPE.BOOLEAN],
|
typeList: [ARGUMENT_TYPE.BOOLEAN],
|
||||||
enumList: commonEnumProviders.boolean('trueFalse')(),
|
enumList: commonEnumProviders.boolean('trueFalse')(),
|
||||||
defaultValue: 'false',
|
defaultValue: 'false',
|
||||||
@ -1938,7 +1938,7 @@ async function popupCallback(args, value) {
|
|||||||
cancelButton: args?.cancelButton !== undefined && typeof args?.cancelButton === 'string' ? args.cancelButton : null,
|
cancelButton: args?.cancelButton !== undefined && typeof args?.cancelButton === 'string' ? args.cancelButton : null,
|
||||||
};
|
};
|
||||||
const result = await Popup.show.text(safeHeader, safeBody, popupOptions);
|
const result = await Popup.show.text(safeHeader, safeBody, popupOptions);
|
||||||
return String(requestedResult ? result : value);
|
return String(requestedResult ? result ?? '' : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getMessagesCallback(args, value) {
|
async function getMessagesCallback(args, value) {
|
||||||
|
Reference in New Issue
Block a user