Add cssClass arg to /echo

c9ed91099f218c0973b08de58f71917162808fb2

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +10 -1Ignore whitespace
public/scripts/slash-commands.js+10 -1
@@ -772,6 +772,11 @@ export function initDefaultSlashCommands() {
772 ],772 ],
773 }),773 }),
774 SlashCommandNamedArgument.fromProps({774 SlashCommandNamedArgument.fromProps({
775 name: 'cssClass',
776 description: 'additional css class to add to the toast message (e.g. for custom styling)',
777 typeList: [ARGUMENT_TYPE.STRING],
778 }),
779 SlashCommandNamedArgument.fromProps({
775 name: 'timeout',780 name: 'timeout',
776 description: 'time in milliseconds to display the toast message. Set this and \'extendedTimeout\' to 0 to show indefinitely until dismissed.',781 description: 'time in milliseconds to display the toast message. Set this and \'extendedTimeout\' to 0 to show indefinitely until dismissed.',
777 typeList: [ARGUMENT_TYPE.NUMBER],782 typeList: [ARGUMENT_TYPE.NUMBER],
@@ -2181,7 +2186,7 @@ async function generateCallback(args, value) {
21812186
2182/**2187/**
2183 *2188 *
2184 * @param {{title?: string, severity?: string, timeout?: string, extendedTimeout?: string, preventDuplicates?: string, awaitDismissal?: string}} args - named arguments from the slash command2189 * @param {{title?: string, severity?: string, cssClass?: string, timeout?: string, extendedTimeout?: string, preventDuplicates?: string, awaitDismissal?: string}} args - named arguments from the slash command
2185 * @param {string} value - The string to echo (unnamed argument from the slash command)2190 * @param {string} value - The string to echo (unnamed argument from the slash command)
2186 * @returns {Promise<string>} The text that was echoed2191 * @returns {Promise<string>} The text that was echoed
2187 */2192 */
@@ -2217,6 +2222,10 @@ async function echoCallback(args, value) {
2217 options.onHidden = () => resolveToastDismissal(value);2222 options.onHidden = () => resolveToastDismissal(value);
2218 }2223 }
22192224
2225 if (args.cssClass) {
2226 options.toastClass = args.cssClass;
2227 }
2228
2220 switch (severity) {2229 switch (severity) {
2221 case 'error':2230 case 'error':
2222 toastr.error(value, title, options);2231 toastr.error(value, title, options);