From fa64f9dca96cd6d98698a388214eb5097bcad1c2 Mon Sep 17 00:00:00 2001 From: Il Harper Date: Wed, 17 Apr 2024 02:11:48 +0800 Subject: [PATCH] fix(event): fix `CR` in text --- packages/engine-chronocat-event/src/parser/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/engine-chronocat-event/src/parser/index.ts b/packages/engine-chronocat-event/src/parser/index.ts index 6fad786..4b31f30 100644 --- a/packages/engine-chronocat-event/src/parser/index.ts +++ b/packages/engine-chronocat-event/src/parser/index.ts @@ -375,7 +375,13 @@ async function parseElements( switch (m.textElement!.atType) { case AtType.None: { // 纯文本消息 - elements.push(ctx.chronocat.h.text(m.textElement?.content)) + elements.push( + ctx.chronocat.h.text( + m + .textElement!.content.replaceAll('\r\n', '\n') + .replaceAll('\r', '\n'), + ), + ) break }