mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui: create new AnsiUp instance for every render
This commit is contained in:
1 parent
86d2a36731
commit
e137e1940f
2 files changed
+2
-6
No files matched your search
@@ -3,10 +3,8 @@ import { AnsiUp } from 'ansi_up';
|
||||
|
||||
export { formatSeconds, size } from 'hydrooj';
|
||||
|
||||
const AU = new AnsiUp();
|
||||
|
||||
export function ansiToHtml(str: string, whiteToBlack = true) {
|
||||
const res = AU.ansi_to_html(str);
|
||||
const res = new AnsiUp().ansi_to_html(str);
|
||||
return whiteToBlack ? res.replace(/style="color:rgb\(255,255,255\)"/g, 'style="color:black"') : res;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user