@tellescope/chat 1.221.0 → 1.223.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/chat",
3
- "version": "1.221.0",
3
+ "version": "1.223.0",
4
4
  "description": "",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -34,13 +34,13 @@
34
34
  "@fontsource/roboto": "^4.5.1",
35
35
  "@mui/icons-material": "^5.0.1",
36
36
  "@mui/material": "^5.0.2",
37
- "@tellescope/constants": "^1.221.0",
38
- "@tellescope/react-components": "^1.221.0",
39
- "@tellescope/sdk": "^1.221.0",
40
- "@tellescope/types-client": "^1.221.0",
41
- "@tellescope/types-models": "^1.221.0",
42
- "@tellescope/types-utilities": "^1.221.0",
43
- "@tellescope/utilities": "^1.221.0",
37
+ "@tellescope/constants": "^1.223.0",
38
+ "@tellescope/react-components": "^1.223.0",
39
+ "@tellescope/sdk": "^1.223.0",
40
+ "@tellescope/types-client": "^1.223.0",
41
+ "@tellescope/types-models": "^1.223.0",
42
+ "@tellescope/types-utilities": "^1.223.0",
43
+ "@tellescope/utilities": "^1.223.0",
44
44
  "@typescript-eslint/eslint-plugin": "^4.33.0",
45
45
  "@typescript-eslint/parser": "^4.33.0",
46
46
  "eslint": "^7.32.0",
@@ -51,7 +51,7 @@
51
51
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
52
52
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
53
53
  },
54
- "gitHead": "9f865339ecf82005e299c61fdc6fb6dacc0a7486",
54
+ "gitHead": "c4041968a142a3ab45430b3f2dccfa0bbc36e3d9",
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  }
package/src/chat.tsx CHANGED
@@ -169,7 +169,12 @@ export const Message = ({
169
169
  const quote = message?.quote?.join(' \n')
170
170
 
171
171
  if (!message.message) {
172
- textBGStyle.backgroundColor = undefined
172
+ // Only remove background if HTML has inline styles (for customization)
173
+ // Keep background for plain HTML without styling for better visibility
174
+ const hasInlineStyles = message.html && message.html.includes('style=')
175
+ if (hasInlineStyles) {
176
+ textBGStyle.backgroundColor = undefined
177
+ }
173
178
  } else {
174
179
  if (message.senderId === chatUserId) {
175
180
  if (sentBgColor) {
@@ -8,6 +8,14 @@ import {
8
8
  useChats,
9
9
  } from "@tellescope/react-components"
10
10
  import { remove_script_tags, user_display_name } from "@tellescope/utilities";
11
+
12
+ const stripOuterParagraphTags = (html: string): string => {
13
+ let result = html.trim()
14
+ while (result.startsWith('<p>') && result.endsWith('</p>')) {
15
+ result = result.slice(3, -4).trim()
16
+ }
17
+ return result
18
+ }
11
19
  import { Checkbox, TextField, FormControlLabel, Grid } from "@mui/material";
12
20
  import { ChatAttachment } from "@tellescope/types-models";
13
21
 
@@ -20,7 +28,7 @@ export const HTMLMessage = ({ html } : HTMLMessageProps) => (
20
28
  <div style={{ padding: 2 }}
21
29
  dangerouslySetInnerHTML={{
22
30
  __html: remove_script_tags(
23
- html.replace(/<a/g, '<a style="color: white;"')
31
+ stripOuterParagraphTags(html).replace(/<a/g, '<a style="color: white;"')
24
32
  ),
25
33
  }}
26
34
  />