mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
add trim sentence feature
This commit is contained in:
@ -188,4 +188,13 @@ export function sortByCssOrder(a, b) {
|
||||
const _a = Number($(a).css('order'));
|
||||
const _b = Number($(b).css('order'));
|
||||
return _a - _b;
|
||||
}
|
||||
}
|
||||
|
||||
export function end_trim_to_sentence(input, keep_newlines = false) {
|
||||
if (!keep_newlines) {
|
||||
return input.trimEnd();
|
||||
} else {
|
||||
// trim all whitespace at the end of the string, except for newlines
|
||||
return input.replace(/([^\S\r\n])+(?=\n*$)/g, "");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user