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