mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add cssClass arg to /echo
This commit is contained in:
@ -771,6 +771,11 @@ export function initDefaultSlashCommands() {
|
|||||||
new SlashCommandEnumValue('success', 'success', enumTypes.enum, '✅'),
|
new SlashCommandEnumValue('success', 'success', enumTypes.enum, '✅'),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
SlashCommandNamedArgument.fromProps({
|
||||||
|
name: 'cssClass',
|
||||||
|
description: 'additional css class to add to the toast message (e.g. for custom styling)',
|
||||||
|
typeList: [ARGUMENT_TYPE.STRING],
|
||||||
|
}),
|
||||||
SlashCommandNamedArgument.fromProps({
|
SlashCommandNamedArgument.fromProps({
|
||||||
name: 'timeout',
|
name: 'timeout',
|
||||||
description: 'time in milliseconds to display the toast message. Set this and \'extendedTimeout\' to 0 to show indefinitely until dismissed.',
|
description: 'time in milliseconds to display the toast message. Set this and \'extendedTimeout\' to 0 to show indefinitely until dismissed.',
|
||||||
@ -2181,7 +2186,7 @@ async function generateCallback(args, value) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {{title?: string, severity?: string, timeout?: string, extendedTimeout?: string, preventDuplicates?: string, awaitDismissal?: string}} args - named arguments from the slash command
|
* @param {{title?: string, severity?: string, cssClass?: string, timeout?: string, extendedTimeout?: string, preventDuplicates?: string, awaitDismissal?: string}} args - named arguments from the slash command
|
||||||
* @param {string} value - The string to echo (unnamed argument from the slash command)
|
* @param {string} value - The string to echo (unnamed argument from the slash command)
|
||||||
* @returns {Promise<string>} The text that was echoed
|
* @returns {Promise<string>} The text that was echoed
|
||||||
*/
|
*/
|
||||||
@ -2217,6 +2222,10 @@ async function echoCallback(args, value) {
|
|||||||
options.onHidden = () => resolveToastDismissal(value);
|
options.onHidden = () => resolveToastDismissal(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.cssClass) {
|
||||||
|
options.toastClass = args.cssClass;
|
||||||
|
}
|
||||||
|
|
||||||
switch (severity) {
|
switch (severity) {
|
||||||
case 'error':
|
case 'error':
|
||||||
toastr.error(value, title, options);
|
toastr.error(value, title, options);
|
||||||
|
Reference in New Issue
Block a user