diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php index 05a099420..0cbb4769f 100644 --- a/app/Models/WebSocketDialogMsg.php +++ b/app/Models/WebSocketDialogMsg.php @@ -502,11 +502,11 @@ class WebSocketDialogMsg extends AbstractModel $text = preg_replace("/]*?alt=\"(\S+)\"[^>]*?>/", "[$1]", $text); $text = preg_replace("/]*?>/", "[表情]", $text); $text = preg_replace("/]*?>/", "[图片]", $text); - if ($preserveHtml) { - return $text; - } else { - return strip_tags($text); + if (!$preserveHtml) { + $text = strip_tags($text); + $text = str_replace(" ", " ", $text); } + return $text; } /** diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index 9f784c484..25eaf4ab3 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -368,6 +368,7 @@ text = text.replace(/]*?alt="(\S+)"[^>]*?>/g, "[$1]") text = text.replace(/]*?>/g, `[${$A.L('表情')}]`) text = text.replace(/]*?>/g, `[${$A.L('图片')}]`) + text = text.replace(/ /g," ") return text.replace(/<[^>]+>/g,"") },