updates
This commit is contained in:
@@ -253,6 +253,7 @@ function parseColorTokens(message: string, renderColor: boolean): ColorToken[] {
|
||||
let inColorStart = false;
|
||||
let inColorEnd = false;
|
||||
let chars: string[] = [];
|
||||
let startedColors: string[] = [];
|
||||
const messageLength = message.length;
|
||||
for (let i = 0; i < messageLength; i++) {
|
||||
const c = message.charAt(i);
|
||||
@@ -294,7 +295,21 @@ function parseColorTokens(message: string, renderColor: boolean): ColorToken[] {
|
||||
colorStart: inColorStart,
|
||||
color: chars.join(""),
|
||||
});
|
||||
if (inColorStart) {
|
||||
startedColors.push(chars.join(""));
|
||||
} else {
|
||||
startedColors.pop();
|
||||
}
|
||||
chars = [];
|
||||
} else if (chars.length === 0 && inColorEnd) {
|
||||
const poppedColor = startedColors.pop();
|
||||
if (poppedColor) {
|
||||
tokens.push({
|
||||
type: "color",
|
||||
colorStart: false,
|
||||
color: poppedColor,
|
||||
});
|
||||
}
|
||||
}
|
||||
inColorStart = false;
|
||||
inColorEnd = false;
|
||||
|
||||
Reference in New Issue
Block a user