Change popup cancel result in command to empty str

2385c5a59a4b729224678b1cfe8f8a2eb642974a

Wolfsblvt <wolfsblvt@gmail.com>

2 files changed, +4 -4Ignore whitespace
public/scripts/popup.js+2 -2
@@ -92,7 +92,7 @@ const showPopupHelper = {
92 * @param {string?} header - The header text for the popup.92 * @param {string?} header - The header text for the popup.
93 * @param {string?} text - The main text for the popup.93 * @param {string?} text - The main text for the popup.
94 * @param {PopupOptions} [popupOptions={}] - Options for the popup.94 * @param {PopupOptions} [popupOptions={}] - Options for the popup.
95 * @return {Promise<POPUP_RESULT>} A Promise that resolves with the result of the user's interaction.95 * @return {Promise<POPUP_RESULT?>} A Promise that resolves with the result of the user's interaction.
96 */96 */
97 confirm: async (header, text, popupOptions = {}) => {97 confirm: async (header, text, popupOptions = {}) => {
98 const content = PopupUtils.BuildTextWithHeader(header, text);98 const content = PopupUtils.BuildTextWithHeader(header, text);
@@ -107,7 +107,7 @@ const showPopupHelper = {
107 * @param {string?} header - The header text for the popup.107 * @param {string?} header - The header text for the popup.
108 * @param {string?} text - The main text for the popup.108 * @param {string?} text - The main text for the popup.
109 * @param {PopupOptions} [popupOptions={}] - Options for the popup.109 * @param {PopupOptions} [popupOptions={}] - Options for the popup.
110 * @return {Promise<POPUP_RESULT>} A Promise that resolves with the result of the user's interaction.110 * @return {Promise<POPUP_RESULT?>} A Promise that resolves with the result of the user's interaction.
111 */111 */
112 text: async (header, text, popupOptions = {}) => {112 text: async (header, text, popupOptions = {}) => {
113 const content = PopupUtils.BuildTextWithHeader(header, text);113 const content = PopupUtils.BuildTextWithHeader(header, text);
public/scripts/slash-commands.js+2 -2
@@ -1308,7 +1308,7 @@ export function initDefaultSlashCommands() {
1308 }),1308 }),
1309 SlashCommandNamedArgument.fromProps({1309 SlashCommandNamedArgument.fromProps({
1310 name: 'result',1310 name: 'result',
1311 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.',1311 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.',
1312 typeList: [ARGUMENT_TYPE.BOOLEAN],1312 typeList: [ARGUMENT_TYPE.BOOLEAN],
1313 enumList: commonEnumProviders.boolean('trueFalse')(),1313 enumList: commonEnumProviders.boolean('trueFalse')(),
1314 defaultValue: 'false',1314 defaultValue: 'false',
@@ -1938,7 +1938,7 @@ async function popupCallback(args, value) {
1938 cancelButton: args?.cancelButton !== undefined && typeof args?.cancelButton === 'string' ? args.cancelButton : null,1938 cancelButton: args?.cancelButton !== undefined && typeof args?.cancelButton === 'string' ? args.cancelButton : null,
1939 };1939 };
1940 const result = await Popup.show.text(safeHeader, safeBody, popupOptions);1940 const result = await Popup.show.text(safeHeader, safeBody, popupOptions);
1941 return String(requestedResult ? result : value);1941 return String(requestedResult ? result ?? '' : value);
1942}1942}
19431943
1944async function getMessagesCallback(args, value) {1944async function getMessagesCallback(args, value) {