mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-02 17:32:50 +08:00
feat: render BBCode in chat messages
Server, channel and private chat now render [b] [i] [u] [s] [color] [url] (and [img] as a plain link), and bare http(s) URLs become links - the welcome message's [URL]...[/URL] showed up as raw text before. Built as React elements, so message text can't inject markup; only http(s) links are allowed and [color] only takes a name or hex value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
9b836d5830
commit
e37e090ab2
3 files changed
+110
-3
No files matched your search
+4
-3
@@ -143,6 +143,7 @@ import {
|
||||
GreenteaSpeakChrome,
|
||||
isGreenteaSpeakTheme,
|
||||
} from "./themes/greenteaspeak";
|
||||
import { renderBbcode } from "./lib/bbcode";
|
||||
import { parseChannelName, spacerDisplayName } from "./lib/spacer";
|
||||
import {
|
||||
applyParkedGatewayEvent,
|
||||
@@ -11646,7 +11647,7 @@ function AppInner() {
|
||||
className={`ts-chat-line${entry.from === ownClient?.name ? " ts-chat-line-self" : ""}`}
|
||||
>
|
||||
<span className="ts-chat-from">{entry.from}:</span>{" "}
|
||||
<span className="ts-chat-bubble">{entry.message}</span>
|
||||
<span className="ts-chat-bubble">{renderBbcode(entry.message)}</span>
|
||||
</div>
|
||||
))
|
||||
: activeTab === "server"
|
||||
@@ -11661,7 +11662,7 @@ function AppInner() {
|
||||
className={`ts-chat-line${entry.from === ownClient?.name ? " ts-chat-line-self" : ""}`}
|
||||
>
|
||||
<span className="ts-chat-from">{entry.from}:</span>{" "}
|
||||
<span className="ts-chat-bubble">{entry.message}</span>
|
||||
<span className="ts-chat-bubble">{renderBbcode(entry.message)}</span>
|
||||
</div>
|
||||
)
|
||||
)
|
||||
@@ -11670,7 +11671,7 @@ function AppInner() {
|
||||
<span className="ts-chat-from">
|
||||
{entry.fromSelf ? t("chat.you") : pmThreads[activeTab].partnerName}:
|
||||
</span>{" "}
|
||||
<span className="ts-chat-bubble">{entry.message}</span>
|
||||
<span className="ts-chat-bubble">{renderBbcode(entry.message)}</span>
|
||||
</div>
|
||||
))}
|
||||
<div ref={chatEndRef} />
|
||||
|
||||
Reference in new issue
Block a user