@cometchat/chat-uikit-react-native 5.3.2 → 5.3.3
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/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +16 -10
- package/ios/RichTextEditorView.swift +49 -2
- package/package.json +1 -1
- package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +50 -30
- package/src/CometChatConversations/CometChatConversations.tsx +23 -42
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +2 -2
- package/src/CometChatMessageList/CometChatMessageList.tsx +41 -7
- package/src/shared/constants/UIKitConstants.ts +1 -1
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +6 -4
- package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +93 -27
- package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +8 -2
- package/src/shared/framework/MessageDataSource.tsx +10 -0
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +26 -23
- package/src/shared/utils/MarkdownUtils.ts +5 -1
- package/src/shared/utils/MessageUtils.tsx +66 -1
- package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +1 -0
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +26 -10
- package/src/theme/CometChatThemeHelper.ts +9 -0
- package/src/theme/default/color/dark.ts +13 -0
- package/src/theme/default/color/light.ts +13 -1
|
@@ -3590,23 +3590,29 @@ class RichTextEditorView(context: Context) : androidx.appcompat.widget.AppCompat
|
|
|
3590
3590
|
|
|
3591
3591
|
// ==================== Helper Methods ====================
|
|
3592
3592
|
|
|
3593
|
-
/// Returns sub-ranges of `start..<end` that do NOT overlap any MentionSpan.
|
|
3594
|
-
/// Used to skip mentions when applying inline formatting (Req 6.1).
|
|
3593
|
+
/// Returns sub-ranges of `start..<end` that do NOT overlap any MentionSpan or URLSpan.
|
|
3594
|
+
/// Used to skip mentions and links when applying inline formatting (Req 6.1).
|
|
3595
3595
|
private fun nonMentionRanges(start: Int, end: Int, spannable: Spanned): List<IntRange> {
|
|
3596
3596
|
val mentionSpans = spannable.getSpans(start, end, MentionSpan::class.java)
|
|
3597
|
-
|
|
3597
|
+
val urlSpans = spannable.getSpans(start, end, URLSpan::class.java)
|
|
3598
3598
|
|
|
3599
|
-
val
|
|
3600
|
-
|
|
3601
|
-
|
|
3599
|
+
val protectedRanges = mutableListOf<IntRange>()
|
|
3600
|
+
mentionSpans.forEach {
|
|
3601
|
+
protectedRanges.add(spannable.getSpanStart(it) until spannable.getSpanEnd(it))
|
|
3602
|
+
}
|
|
3603
|
+
urlSpans.forEach {
|
|
3604
|
+
protectedRanges.add(spannable.getSpanStart(it) until spannable.getSpanEnd(it))
|
|
3605
|
+
}
|
|
3606
|
+
if (protectedRanges.isEmpty()) return listOf(start until end)
|
|
3607
|
+
protectedRanges.sortBy { it.first }
|
|
3602
3608
|
|
|
3603
3609
|
val result = mutableListOf<IntRange>()
|
|
3604
3610
|
var cursor = start
|
|
3605
|
-
for (
|
|
3606
|
-
if (cursor <
|
|
3607
|
-
result.add(cursor until
|
|
3611
|
+
for (pr in protectedRanges) {
|
|
3612
|
+
if (cursor < pr.first) {
|
|
3613
|
+
result.add(cursor until pr.first)
|
|
3608
3614
|
}
|
|
3609
|
-
cursor =
|
|
3615
|
+
cursor = pr.last + 1 // IntRange.last is inclusive; advance past the protected range
|
|
3610
3616
|
}
|
|
3611
3617
|
if (cursor < end) {
|
|
3612
3618
|
result.add(cursor until end)
|
|
@@ -1329,6 +1329,7 @@ class RichTextEditorView: UIView, UITextViewDelegate, UIGestureRecognizerDelegat
|
|
|
1329
1329
|
|
|
1330
1330
|
updateToolbarPosition()
|
|
1331
1331
|
updateToolbarButtonStates()
|
|
1332
|
+
emitActiveStyles()
|
|
1332
1333
|
|
|
1333
1334
|
// Strip mention-specific attributes from typingAttributes when cursor
|
|
1334
1335
|
// lands adjacent to (or inherits from) a deleted mention.
|
|
@@ -3060,8 +3061,49 @@ class RichTextEditorView: UIView, UITextViewDelegate, UIGestureRecognizerDelegat
|
|
|
3060
3061
|
let regularFont = UIFont.systemFont(ofSize: 16)
|
|
3061
3062
|
|
|
3062
3063
|
mutableAttrString.enumerateAttribute(.font, in: range, options: []) { value, attrRange, _ in
|
|
3063
|
-
|
|
3064
|
-
|
|
3064
|
+
if hasMonospace {
|
|
3065
|
+
// Removing code: restore to system font but preserve bold/italic traits
|
|
3066
|
+
if let existingFont = value as? UIFont {
|
|
3067
|
+
let traits = existingFont.fontDescriptor.symbolicTraits
|
|
3068
|
+
var newFont = regularFont
|
|
3069
|
+
if traits.contains(.traitBold) && traits.contains(.traitItalic) {
|
|
3070
|
+
if let desc = regularFont.fontDescriptor.withSymbolicTraits([.traitBold, .traitItalic]) {
|
|
3071
|
+
newFont = UIFont(descriptor: desc, size: 16)
|
|
3072
|
+
}
|
|
3073
|
+
} else if traits.contains(.traitBold) {
|
|
3074
|
+
newFont = UIFont.boldSystemFont(ofSize: 16)
|
|
3075
|
+
} else if traits.contains(.traitItalic) {
|
|
3076
|
+
newFont = UIFont.italicSystemFont(ofSize: 16)
|
|
3077
|
+
}
|
|
3078
|
+
mutableAttrString.addAttribute(.font, value: newFont, range: attrRange)
|
|
3079
|
+
} else {
|
|
3080
|
+
mutableAttrString.addAttribute(.font, value: regularFont, range: attrRange)
|
|
3081
|
+
}
|
|
3082
|
+
} else {
|
|
3083
|
+
// Adding code: switch to monospace but preserve bold/italic traits
|
|
3084
|
+
if let existingFont = value as? UIFont {
|
|
3085
|
+
let traits = existingFont.fontDescriptor.symbolicTraits
|
|
3086
|
+
var newFont = monoFont
|
|
3087
|
+
if traits.contains(.traitBold) && traits.contains(.traitItalic) {
|
|
3088
|
+
// Monospace bold italic
|
|
3089
|
+
if let desc = monoFont.fontDescriptor.withSymbolicTraits([.traitBold, .traitItalic, .traitMonoSpace]) {
|
|
3090
|
+
newFont = UIFont(descriptor: desc, size: 15)
|
|
3091
|
+
} else {
|
|
3092
|
+
// Fallback: at least try bold monospace
|
|
3093
|
+
newFont = UIFont.monospacedSystemFont(ofSize: 15, weight: .bold)
|
|
3094
|
+
}
|
|
3095
|
+
} else if traits.contains(.traitBold) {
|
|
3096
|
+
newFont = UIFont.monospacedSystemFont(ofSize: 15, weight: .bold)
|
|
3097
|
+
} else if traits.contains(.traitItalic) {
|
|
3098
|
+
if let desc = monoFont.fontDescriptor.withSymbolicTraits([.traitItalic, .traitMonoSpace]) {
|
|
3099
|
+
newFont = UIFont(descriptor: desc, size: 15)
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3102
|
+
mutableAttrString.addAttribute(.font, value: newFont, range: attrRange)
|
|
3103
|
+
} else {
|
|
3104
|
+
mutableAttrString.addAttribute(.font, value: monoFont, range: attrRange)
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3065
3107
|
}
|
|
3066
3108
|
|
|
3067
3109
|
if !hasMonospace {
|
|
@@ -3079,6 +3121,7 @@ class RichTextEditorView: UIView, UITextViewDelegate, UIGestureRecognizerDelegat
|
|
|
3079
3121
|
saveToUndoStack()
|
|
3080
3122
|
sendContentChange()
|
|
3081
3123
|
emitActiveStyles()
|
|
3124
|
+
updateToolbarButtonStates()
|
|
3082
3125
|
}
|
|
3083
3126
|
|
|
3084
3127
|
func toggleHighlight(color: String?) {
|
|
@@ -3626,6 +3669,8 @@ class RichTextEditorView: UIView, UITextViewDelegate, UIGestureRecognizerDelegat
|
|
|
3626
3669
|
isInternalChange = false
|
|
3627
3670
|
saveToUndoStack()
|
|
3628
3671
|
sendContentChange()
|
|
3672
|
+
emitActiveStyles()
|
|
3673
|
+
updateToolbarButtonStates()
|
|
3629
3674
|
}
|
|
3630
3675
|
|
|
3631
3676
|
private func toggleAttribute(key: NSAttributedString.Key, value: Int) {
|
|
@@ -3701,6 +3746,8 @@ class RichTextEditorView: UIView, UITextViewDelegate, UIGestureRecognizerDelegat
|
|
|
3701
3746
|
isInternalChange = false
|
|
3702
3747
|
saveToUndoStack()
|
|
3703
3748
|
sendContentChange()
|
|
3749
|
+
emitActiveStyles()
|
|
3750
|
+
updateToolbarButtonStates()
|
|
3704
3751
|
}
|
|
3705
3752
|
|
|
3706
3753
|
/// Applies pending style toggles to typingAttributes so newly typed text inherits them.
|
package/package.json
CHANGED
|
@@ -202,6 +202,7 @@ const ActionSheetBoard = (props: any) => {
|
|
|
202
202
|
ref={sheetRef}
|
|
203
203
|
onClose={onClose}
|
|
204
204
|
isOpen={shouldShow}
|
|
205
|
+
doNotOccupyEntireHeight={true}
|
|
205
206
|
>
|
|
206
207
|
<CometChatActionSheet actions={options} style={style} />
|
|
207
208
|
</CometChatBottomSheet>
|
|
@@ -248,12 +249,12 @@ const RecordAudio = (props: any) => {
|
|
|
248
249
|
* MessagePreviewTray component for displaying edit/reply message preview (v5 pattern)
|
|
249
250
|
*/
|
|
250
251
|
const MessagePreviewTray = (props: any) => {
|
|
251
|
-
const { shouldShow = false,
|
|
252
|
+
const { shouldShow = false, message = null, onClose = () => {}, title = '' } = props;
|
|
252
253
|
if (!shouldShow) return null;
|
|
253
254
|
return (
|
|
254
255
|
<CometChatMessagePreview
|
|
255
256
|
messagePreviewTitle={title}
|
|
256
|
-
|
|
257
|
+
message={message}
|
|
257
258
|
onCloseClick={onClose}
|
|
258
259
|
/>
|
|
259
260
|
);
|
|
@@ -1200,6 +1201,8 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
1200
1201
|
// Mic/sticker animation: single Animated.Value drives mic slide + fade
|
|
1201
1202
|
// 0 = idle (mic visible), 1 = typing (mic hidden)
|
|
1202
1203
|
const micAnimValue = React.useRef(new Animated.Value(0)).current;
|
|
1204
|
+
// Separate Animated.Value for mic layout width collapse (JS driver, supports layout props)
|
|
1205
|
+
const micWidthAnim = React.useRef(new Animated.Value(1)).current;
|
|
1203
1206
|
const [messagePreview, setMessagePreview] = React.useState<{ message: any; mode: string } | null>(null);
|
|
1204
1207
|
const [showMentionList, setShowMentionList] = React.useState(false);
|
|
1205
1208
|
const [mentionsSearchData, setMentionsSearchData] = React.useState<Array<SuggestionItem>>([]);
|
|
@@ -2965,9 +2968,10 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
2965
2968
|
|
|
2966
2969
|
mentionMap.current = newMentionMap;
|
|
2967
2970
|
|
|
2968
|
-
// Set the message preview state with
|
|
2971
|
+
// Set the message preview state with original message object
|
|
2972
|
+
// (preserves SDK prototype chain for CometChatMessagePreview formatting)
|
|
2969
2973
|
setMessagePreview({
|
|
2970
|
-
message:
|
|
2974
|
+
message: message,
|
|
2971
2975
|
mode: ConversationOptionConstants.edit,
|
|
2972
2976
|
});
|
|
2973
2977
|
|
|
@@ -3923,11 +3927,21 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
3923
3927
|
useEffect(() => {
|
|
3924
3928
|
if (hideVoiceRecordingButton) return;
|
|
3925
3929
|
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3930
|
+
// Run visual animation (native driver) and layout collapse (JS driver) in parallel
|
|
3931
|
+
Animated.parallel([
|
|
3932
|
+
// Visual: slide + fade (native driver for 60fps)
|
|
3933
|
+
Animated.timing(micAnimValue, {
|
|
3934
|
+
toValue: hasContent ? 1 : 0,
|
|
3935
|
+
duration: MIC_ANIM_DURATION,
|
|
3936
|
+
useNativeDriver: true,
|
|
3937
|
+
}),
|
|
3938
|
+
// Layout: width collapse (JS driver, needed for layout props)
|
|
3939
|
+
Animated.timing(micWidthAnim, {
|
|
3940
|
+
toValue: hasContent ? 0 : 1,
|
|
3941
|
+
duration: MIC_ANIM_DURATION,
|
|
3942
|
+
useNativeDriver: false,
|
|
3943
|
+
}),
|
|
3944
|
+
]).start();
|
|
3931
3945
|
}, [hasContent, hideVoiceRecordingButton]);
|
|
3932
3946
|
|
|
3933
3947
|
/**
|
|
@@ -4167,26 +4181,36 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
4167
4181
|
if (showInlineRecorder) {
|
|
4168
4182
|
return null;
|
|
4169
4183
|
}
|
|
4170
|
-
//
|
|
4184
|
+
// Two nested Animated.Views to avoid native/JS driver conflict:
|
|
4185
|
+
// Outer: JS driver — animates width + margin for layout collapse (eats the gap)
|
|
4186
|
+
// Inner: native driver — animates opacity + translateX for smooth visuals
|
|
4171
4187
|
return (
|
|
4172
4188
|
<Animated.View
|
|
4173
|
-
pointerEvents={hasContent ? 'none' : 'auto'}
|
|
4174
4189
|
style={{
|
|
4175
|
-
|
|
4176
|
-
|
|
4190
|
+
width: micWidthAnim.interpolate({ inputRange: [0, 1], outputRange: [0, 24] }),
|
|
4191
|
+
marginLeft: micWidthAnim.interpolate({ inputRange: [0, 1], outputRange: [-16, 0] }),
|
|
4192
|
+
overflow: 'hidden' as const,
|
|
4177
4193
|
}}
|
|
4178
4194
|
>
|
|
4179
|
-
<
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
setTimeout(() => setShowInlineRecorder(true), 50);
|
|
4195
|
+
<Animated.View
|
|
4196
|
+
pointerEvents={hasContent ? 'none' : 'auto'}
|
|
4197
|
+
style={{
|
|
4198
|
+
opacity: micAnimValue.interpolate({ inputRange: [0, 1], outputRange: [1, 0] }),
|
|
4199
|
+
transform: [{ translateX: micAnimValue.interpolate({ inputRange: [0, 1], outputRange: [0, MIC_SLIDE_DISTANCE] }) }],
|
|
4185
4200
|
}}
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4201
|
+
>
|
|
4202
|
+
<IconButton
|
|
4203
|
+
name={voiceRecordingIconURL ? undefined : 'mic'}
|
|
4204
|
+
icon={voiceRecordingIconURL}
|
|
4205
|
+
onClick={() => {
|
|
4206
|
+
// Show inline recorder
|
|
4207
|
+
setTimeout(() => setShowInlineRecorder(true), 50);
|
|
4208
|
+
}}
|
|
4209
|
+
buttonStyle={Style.iconButton}
|
|
4210
|
+
iconStyle={Style.icon}
|
|
4211
|
+
tintColor={getAttachmentIconTint()}
|
|
4212
|
+
/>
|
|
4213
|
+
</Animated.View>
|
|
4190
4214
|
</Animated.View>
|
|
4191
4215
|
);
|
|
4192
4216
|
};
|
|
@@ -4296,7 +4320,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
4296
4320
|
{/* Message Preview Tray for Edit Mode */}
|
|
4297
4321
|
<MessagePreviewTray
|
|
4298
4322
|
shouldShow={messagePreview !== null}
|
|
4299
|
-
|
|
4323
|
+
message={messagePreview?.message}
|
|
4300
4324
|
title={t('EDIT_MESSAGE')}
|
|
4301
4325
|
onClose={() => {
|
|
4302
4326
|
setMessagePreview(null);
|
|
@@ -4449,13 +4473,9 @@ export const CometChatCompactMessageComposer = React.forwardRef(
|
|
|
4449
4473
|
Style.rightIconsContainer,
|
|
4450
4474
|
isExpanded && { alignItems: 'flex-end' as const }
|
|
4451
4475
|
]}>
|
|
4452
|
-
{/* Auxiliary button (stickers/emoji) on right — slides
|
|
4476
|
+
{/* Auxiliary button (stickers/emoji) on right — slides with mic width collapse */}
|
|
4453
4477
|
{resolvedAlignment === 'right' && !hideVoiceRecordingButton && (
|
|
4454
|
-
|
|
4455
|
-
transform: [{ translateX: micAnimValue.interpolate({ inputRange: [0, 1], outputRange: [0, MIC_SLIDE_DISTANCE] }) }],
|
|
4456
|
-
}}>
|
|
4457
|
-
{renderAuxiliaryButton()}
|
|
4458
|
-
</Animated.View>
|
|
4478
|
+
renderAuxiliaryButton()
|
|
4459
4479
|
)}
|
|
4460
4480
|
{resolvedAlignment === 'right' && hideVoiceRecordingButton && renderAuxiliaryButton()}
|
|
4461
4481
|
|
|
@@ -32,7 +32,6 @@ import { SelectionMode } from "../shared/base/Types";
|
|
|
32
32
|
import {
|
|
33
33
|
ConversationTypeConstants,
|
|
34
34
|
GroupTypeConstants,
|
|
35
|
-
MentionsTargetElement,
|
|
36
35
|
MessageCategoryConstants,
|
|
37
36
|
MessageReceipt,
|
|
38
37
|
MessageStatusConstants,
|
|
@@ -43,7 +42,7 @@ import { Icon } from "../shared/icons/Icon";
|
|
|
43
42
|
import { CommonUtils } from "../shared/utils/CommonUtils";
|
|
44
43
|
import { stripMarkdown, preparePreviewText } from "../shared/utils/MarkdownUtils";
|
|
45
44
|
import { CometChatRichTextFormatter } from "../shared/formatters/CometChatRichTextFormatter";
|
|
46
|
-
import { getMessagePreviewInternal } from "../shared/utils/MessageUtils";
|
|
45
|
+
import { getMessagePreviewInternal, applyMentionsFormatting } from "../shared/utils/MessageUtils";
|
|
47
46
|
import { CometChatBadge } from "../shared/views/CometChatBadge";
|
|
48
47
|
import { CometChatConfirmDialog } from "../shared/views/CometChatConfirmDialog";
|
|
49
48
|
import { CometChatDate } from "../shared/views/CometChatDate";
|
|
@@ -61,7 +60,6 @@ import { CometChatTheme } from "../theme/type";
|
|
|
61
60
|
import { MenuItemInterface } from "../shared/views/CometChatTooltipMenu/CometChatTooltipMenu";
|
|
62
61
|
import { JSX } from "react";
|
|
63
62
|
import { useCometChatTranslation } from "../shared/resources/CometChatLocalizeNew";
|
|
64
|
-
import { SuggestionItem } from "../shared/views/CometChatSuggestionList/SuggestionItem";
|
|
65
63
|
|
|
66
64
|
// Unique listener IDs for conversation, user, group, message and call events.
|
|
67
65
|
const conversationListenerId = "chatlist_" + new Date().getTime();
|
|
@@ -335,10 +333,12 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
335
333
|
color: theme.color.primary as string,
|
|
336
334
|
},
|
|
337
335
|
inlineCodeContainerStyle: {
|
|
338
|
-
backgroundColor:
|
|
339
|
-
borderRadius:
|
|
340
|
-
|
|
341
|
-
|
|
336
|
+
backgroundColor: "rgba(120, 120, 128, 0.22)",
|
|
337
|
+
borderRadius: 4,
|
|
338
|
+
borderWidth: 0.5,
|
|
339
|
+
borderColor: "rgba(120, 120, 128, 0.35)",
|
|
340
|
+
paddingHorizontal: 4,
|
|
341
|
+
paddingVertical: 1,
|
|
342
342
|
},
|
|
343
343
|
});
|
|
344
344
|
}, [theme]);
|
|
@@ -834,7 +834,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
834
834
|
if (!lastMessage) return null;
|
|
835
835
|
let messageText: string | JSX.Element = "";
|
|
836
836
|
messageText = ChatConfigurator.getDataSource().getLastConversationMessage(conversations, theme);
|
|
837
|
-
|
|
837
|
+
|
|
838
838
|
// Detect block-level elements in text messages before stripMarkdown flattens them
|
|
839
839
|
let blockType: 'blockquote' | 'codeBlock' | 'list' | null = null;
|
|
840
840
|
let codeBlockLine = '';
|
|
@@ -912,6 +912,17 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
912
912
|
{messageText}
|
|
913
913
|
</Text>
|
|
914
914
|
);
|
|
915
|
+
} else if (messageText && typeof messageText !== 'string') {
|
|
916
|
+
// JSX element from rich text formatter — wrap with truncation
|
|
917
|
+
messageText = (
|
|
918
|
+
<Text
|
|
919
|
+
style={[mergedStyles.itemStyle.subtitleStyle, { flexShrink: 2 }]}
|
|
920
|
+
numberOfLines={1}
|
|
921
|
+
ellipsizeMode='tail'
|
|
922
|
+
>
|
|
923
|
+
{messageText}
|
|
924
|
+
</Text>
|
|
925
|
+
);
|
|
915
926
|
}
|
|
916
927
|
|
|
917
928
|
let groupText = "";
|
|
@@ -929,9 +940,9 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
929
940
|
<>
|
|
930
941
|
{groupText && (
|
|
931
942
|
<Text
|
|
932
|
-
style={[mergedStyles.itemStyle.subtitleStyle, { flexShrink:
|
|
943
|
+
style={[mergedStyles.itemStyle.subtitleStyle, { flexShrink: 0, maxWidth: '40%' }]}
|
|
933
944
|
numberOfLines={1}
|
|
934
|
-
ellipsizeMode='
|
|
945
|
+
ellipsizeMode='tail'
|
|
935
946
|
>
|
|
936
947
|
{groupText}
|
|
937
948
|
</Text>
|
|
@@ -964,39 +975,9 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
964
975
|
messageTextTmp = stripMarkdown(subtitle);
|
|
965
976
|
}
|
|
966
977
|
let allFormatters = [...(textFormatters || [])];
|
|
967
|
-
// Detect presence of @all alias token in raw subtitle string (before formatting)
|
|
968
|
-
const containsAllAlias = /<@all:(.*?)>/.test(subtitle);
|
|
969
|
-
|
|
970
|
-
if (message.getMentionedUsers().length || containsAllAlias) {
|
|
971
|
-
let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
|
|
972
|
-
mentionsFormatter.setContext("conversation");
|
|
973
|
-
mentionsFormatter.setLoggedInUser(CometChatUIKit.loggedInUser!);
|
|
974
|
-
mentionsFormatter.setMentionsStyle(mergedStyles.mentionsStyles);
|
|
975
|
-
mentionsFormatter.setTargetElement(MentionsTargetElement.conversation);
|
|
976
|
-
mentionsFormatter.setMessage(message);
|
|
977
|
-
|
|
978
|
-
// Inject alias suggestion item if needed so formatter can render styled @All
|
|
979
|
-
if (containsAllAlias) {
|
|
980
|
-
const match = subtitle.match(/<@all:(.*?)>/);
|
|
981
|
-
const aliasLabel = match && match[1] ? match[1] : "all";
|
|
982
|
-
let existing = mentionsFormatter.getSuggestionItems();
|
|
983
|
-
const underlyingText = `<@all:${aliasLabel}>`;
|
|
984
|
-
const already = existing.find((it: any) => it.underlyingText === underlyingText);
|
|
985
|
-
if (!already) {
|
|
986
|
-
const aliasItem = new SuggestionItem({
|
|
987
|
-
id: aliasLabel,
|
|
988
|
-
name: aliasLabel,
|
|
989
|
-
promptText: aliasLabel,
|
|
990
|
-
trackingCharacter: "@",
|
|
991
|
-
underlyingText,
|
|
992
|
-
hideLeadingIcon: true,
|
|
993
|
-
});
|
|
994
|
-
mentionsFormatter.setSuggestionItems([...existing, aliasItem]);
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
978
|
|
|
998
|
-
|
|
999
|
-
|
|
979
|
+
// Apply mentions formatting using shared helper (DRY — same as CometChatMessagePreview)
|
|
980
|
+
messageTextTmp = applyMentionsFormatting(message, messageTextTmp, subtitle, mergedStyles.mentionsStyles);
|
|
1000
981
|
|
|
1001
982
|
if (
|
|
1002
983
|
message instanceof CometChat.TextMessage &&
|
|
@@ -761,7 +761,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
761
761
|
|
|
762
762
|
mentionMap.current = hashMap;
|
|
763
763
|
setMessagePreview({
|
|
764
|
-
message:
|
|
764
|
+
message: message,
|
|
765
765
|
mode: ConversationOptionConstants.edit,
|
|
766
766
|
});
|
|
767
767
|
|
|
@@ -2306,7 +2306,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
2306
2306
|
{messagePreview && (
|
|
2307
2307
|
<CometChatMessagePreview
|
|
2308
2308
|
messagePreviewTitle={t("EDIT_MESSAGE")}
|
|
2309
|
-
|
|
2309
|
+
message={messagePreview?.message}
|
|
2310
2310
|
showCloseIcon={true}
|
|
2311
2311
|
closeIconURL={ICONS.CLOSE}
|
|
2312
2312
|
onCloseClick={() => {
|
|
@@ -76,6 +76,7 @@ import { CometChatBadge } from "../shared/views/CometChatBadge";
|
|
|
76
76
|
import { CometChatDate } from "../shared/views/CometChatDate";
|
|
77
77
|
import { CometChatMessageBubble } from "../shared/views/CometChatMessageBubble";
|
|
78
78
|
import { getModerationStatus, ModerationBottomView, MimeErrorBottomView } from "../shared/utils/MessageUtils";
|
|
79
|
+
import { stripMarkdown } from "../shared/utils/MarkdownUtils";
|
|
79
80
|
import { CometChatReactions } from "../shared/views/CometChatReactions";
|
|
80
81
|
import { useTheme, useThemeInternal } from "../theme";
|
|
81
82
|
import { MessageSkeleton } from "./Skeleton";
|
|
@@ -126,6 +127,24 @@ const safeGetMuid = (item: any): string | undefined => {
|
|
|
126
127
|
|
|
127
128
|
|
|
128
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Fetches a conversation if it exists, returning null for new users
|
|
132
|
+
* who haven't exchanged any messages yet (ERR_CONVERSATION_NOT_ACCESSIBLE).
|
|
133
|
+
*/
|
|
134
|
+
async function getConversationIfExists(
|
|
135
|
+
convId: string,
|
|
136
|
+
conversationType: string
|
|
137
|
+
): Promise<CometChat.Conversation | null> {
|
|
138
|
+
try {
|
|
139
|
+
return await CometChat.getConversation(convId, conversationType);
|
|
140
|
+
} catch (e: any) {
|
|
141
|
+
if (e?.code === "ERR_CONVERSATION_NOT_ACCESSIBLE") {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
throw e;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
129
148
|
/**
|
|
130
149
|
* Batch state updates using requestAnimationFrame
|
|
131
150
|
* It delays the callback until the next animation frame,
|
|
@@ -1319,7 +1338,8 @@ export const CometChatMessageList = memo(
|
|
|
1319
1338
|
|
|
1320
1339
|
if (!convId) return;
|
|
1321
1340
|
|
|
1322
|
-
const conversation = await
|
|
1341
|
+
const conversation = await getConversationIfExists(convId, conversationType);
|
|
1342
|
+
if (!conversation) return;
|
|
1323
1343
|
const unreadCount = conversation.getUnreadMessageCount();
|
|
1324
1344
|
setUnreadCount(unreadCount);
|
|
1325
1345
|
|
|
@@ -1741,7 +1761,8 @@ export const CometChatMessageList = memo(
|
|
|
1741
1761
|
conversationType = CometChat.RECEIVER_TYPE.GROUP;
|
|
1742
1762
|
}
|
|
1743
1763
|
//getting convesation using conversationId=Uid and conversationType
|
|
1744
|
-
|
|
1764
|
+
getConversationIfExists(convId, conversationType).then((conversation) => {
|
|
1765
|
+
if (!conversation) return;
|
|
1745
1766
|
// Emitting conversation update event
|
|
1746
1767
|
CometChatUIEventHandler.emitConversationEvent(
|
|
1747
1768
|
CometChatConversationEvents.ccUpdateConversation,
|
|
@@ -2011,8 +2032,13 @@ export const CometChatMessageList = memo(
|
|
|
2011
2032
|
* minimizing unnecessary network calls during active scrolling or bottom-positioned interactions.
|
|
2012
2033
|
* A fallback mechanism reverts to local state comparison if the network request fails, ensuring robustness.
|
|
2013
2034
|
*/
|
|
2014
|
-
|
|
2035
|
+
getConversationIfExists(conversationWith, conversationType)
|
|
2015
2036
|
.then((conversation) => {
|
|
2037
|
+
if (!conversation) {
|
|
2038
|
+
// No conversation yet (fresh user) — treat as sequence correct
|
|
2039
|
+
processMessage(true);
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2016
2042
|
const convLastMsg = conversation?.getLastMessage();
|
|
2017
2043
|
// Check if the last message in our list matches the conversation's last message
|
|
2018
2044
|
// This ensures we don't have a gap
|
|
@@ -2301,11 +2327,11 @@ export const CometChatMessageList = memo(
|
|
|
2301
2327
|
|
|
2302
2328
|
if (convId && conversationType) {
|
|
2303
2329
|
|
|
2304
|
-
const conversation = await
|
|
2330
|
+
const conversation = await getConversationIfExists(
|
|
2305
2331
|
convId,
|
|
2306
2332
|
conversationType
|
|
2307
2333
|
);
|
|
2308
|
-
if (conversation.getUnreadMessageCount() > 0) {
|
|
2334
|
+
if (conversation && conversation.getUnreadMessageCount() > 0) {
|
|
2309
2335
|
setUnreadCount(conversation.getUnreadMessageCount());
|
|
2310
2336
|
const lastReadMessageId = conversation.getLastReadMessageId();
|
|
2311
2337
|
//if lastReadMessageId is 0, it means no messages have been read yet
|
|
@@ -3407,7 +3433,7 @@ export const CometChatMessageList = memo(
|
|
|
3407
3433
|
const shareMedia = async (messageObject: CometChat.MediaMessage | any) => {
|
|
3408
3434
|
let _plainString = getPlainString(messageObject?.getData()["text"] || "", messageObject);
|
|
3409
3435
|
|
|
3410
|
-
let textMessage = _plainString;
|
|
3436
|
+
let textMessage = stripMarkdown(_plainString);
|
|
3411
3437
|
let fileUrl = messageObject.getData()["url"];
|
|
3412
3438
|
|
|
3413
3439
|
const getFileName = () => {
|
|
@@ -3658,9 +3684,17 @@ export const CometChatMessageList = memo(
|
|
|
3658
3684
|
: getStatusInfoView(message, bubbleAlignment, currentIndex);
|
|
3659
3685
|
}, [hasTemplate, message, bubbleAlignment, currentIndex, getStatusInfoView]);
|
|
3660
3686
|
|
|
3687
|
+
|
|
3661
3688
|
const ReplyView = useMemo(() => {
|
|
3689
|
+
if (templates && templates.length > 0) {
|
|
3690
|
+
return ChatConfigurator.dataSource.getReplyView?.(message, mergedTheme, {
|
|
3691
|
+
onReplyClick: (messageId: string) => {
|
|
3692
|
+
scrollToMessage(messageId);
|
|
3693
|
+
},
|
|
3694
|
+
}) || null;
|
|
3695
|
+
}
|
|
3662
3696
|
return hasTemplate?.ReplyView?.(message, bubbleAlignment) || null;
|
|
3663
|
-
}, [hasTemplate, message, bubbleAlignment]);
|
|
3697
|
+
}, [hasTemplate, message, bubbleAlignment, mergedTheme, templates]);
|
|
3664
3698
|
|
|
3665
3699
|
if (hasTemplate) {
|
|
3666
3700
|
if (hasTemplate?.BubbleView) return hasTemplate?.BubbleView(message);
|
|
@@ -62,7 +62,7 @@ export const emailPattern =
|
|
|
62
62
|
|
|
63
63
|
export const urlPattern =
|
|
64
64
|
`((https?://|ftp://|www\\.|pic\\.)[-\\w;/?:@&=+$\\|\\_.!~*\\|'()\\[\\]%#,☺]+[\\w/#](\\(\\))?` +
|
|
65
|
-
`|[a-zA-Z0-9][-a-zA-Z0-9]*(?:\\.[a-zA-Z0-9][-a-zA-Z0-9]*)*\\.[a-zA-Z]{2,}(?:[:/][-\\w;/?:@&=+$\\|\\_.!~*\\|'()\\[\\]%#,☺]*[\\w/#](\\(\\))?)?)` +
|
|
65
|
+
`|[a-zA-Z][a-zA-Z0-9]*[-a-zA-Z0-9]*(?:\\.[a-zA-Z0-9][-a-zA-Z0-9]*)*\\.[a-zA-Z]{2,}(?:[:/][-\\w;/?:@&=+$\\|\\_.!~*\\|'()\\[\\]%#,☺]*[\\w/#](\\(\\))?)?)` +
|
|
66
66
|
wordBoundary.end;
|
|
67
67
|
|
|
68
68
|
export const phoneNumPattern =
|
|
@@ -399,10 +399,12 @@ export class CometChatMentionsFormatter extends CometChatTextFormatter {
|
|
|
399
399
|
?.fetchNext()
|
|
400
400
|
.then((users: CometChat.User[]) => {
|
|
401
401
|
let structuredData = this.convertCCUsersToSuggestionsItem(users);
|
|
402
|
-
//
|
|
403
|
-
this.searchData
|
|
404
|
-
|
|
405
|
-
|
|
402
|
+
// Deduplicate: only add items whose id is not already present
|
|
403
|
+
const existingIds = new Set(this.searchData.map((item) => item.id));
|
|
404
|
+
const uniqueNewItems = structuredData.filter(
|
|
405
|
+
(item) => !existingIds.has(item.id)
|
|
406
|
+
);
|
|
407
|
+
this.searchData = [...this.searchData, ...uniqueNewItems];
|
|
406
408
|
this.setSearchData(this.searchData);
|
|
407
409
|
})
|
|
408
410
|
.catch((err) => {
|
|
@@ -29,7 +29,7 @@ const LINK_REGEX = /\[([^\]]+)\]\(([^)]+)\)/;
|
|
|
29
29
|
const URL_PROTOCOL_REGEX = /^(https?|mailto|tel):/i;
|
|
30
30
|
// Patterns for detecting list items inside blockquote content (ENG-31998)
|
|
31
31
|
const QUOTE_BULLET_REGEX = /^- (.*)$/;
|
|
32
|
-
const QUOTE_ORDERED_REGEX = /^(\d+)\.\s(.*)$/;
|
|
32
|
+
const QUOTE_ORDERED_REGEX = /^(\s*)(\d+)\.\s(.*)$/;
|
|
33
33
|
// Mention pattern — used to exclude mention UIDs from markdown marker detection
|
|
34
34
|
const MENTION_PATTERN_REGEX = /<@(?:uid|all):[^>]*>/g;
|
|
35
35
|
|
|
@@ -38,6 +38,49 @@ const LIST_ROW_STYLE = { flexDirection: 'row' as const, flexShrink: 1 as const }
|
|
|
38
38
|
const BULLET_MARKER_STYLE = { width: 18 };
|
|
39
39
|
const ORDERED_MARKER_STYLE = { width: 24 };
|
|
40
40
|
const LIST_CONTENT_STYLE = { flexShrink: 1, flexGrow: 1 };
|
|
41
|
+
|
|
42
|
+
/** Converts a number to lowercase alpha (1→a, 2→b, ..., 26→z, 27→aa) */
|
|
43
|
+
function toAlpha(n: number): string {
|
|
44
|
+
let result = '';
|
|
45
|
+
while (n > 0) {
|
|
46
|
+
n--;
|
|
47
|
+
result = String.fromCharCode(97 + (n % 26)) + result;
|
|
48
|
+
n = Math.floor(n / 26);
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Converts a number to lowercase roman numerals */
|
|
54
|
+
function toRoman(n: number): string {
|
|
55
|
+
const vals = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
|
|
56
|
+
const syms = ['m', 'cm', 'd', 'cd', 'c', 'xc', 'l', 'xl', 'x', 'ix', 'v', 'iv', 'i'];
|
|
57
|
+
let result = '';
|
|
58
|
+
for (let i = 0; i < vals.length; i++) {
|
|
59
|
+
while (n >= vals[i]) {
|
|
60
|
+
result += syms[i];
|
|
61
|
+
n -= vals[i];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Formats a list counter based on nesting level (0→decimal, 1→alpha, 2+→roman) */
|
|
68
|
+
function formatListMarker(count: number, level: number): string {
|
|
69
|
+
if (level === 0) return `${count}. `;
|
|
70
|
+
if (level === 1) return `${toAlpha(count)}. `;
|
|
71
|
+
return `${toRoman(count)}. `;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Indentation width per nesting level for nested lists */
|
|
75
|
+
const NESTED_LIST_INDENT = 20;
|
|
76
|
+
|
|
77
|
+
/** Detect indentation level from leading spaces (4 spaces = 1 level) */
|
|
78
|
+
function getIndentLevel(line: string): number {
|
|
79
|
+
const match = line.match(/^(\s*)/);
|
|
80
|
+
if (!match) return 0;
|
|
81
|
+
return Math.floor(match[1].length / 4);
|
|
82
|
+
}
|
|
83
|
+
|
|
41
84
|
const BQ_TEXT_ROW_STYLE = { flexDirection: 'row' as const, flexShrink: 1 as const };
|
|
42
85
|
|
|
43
86
|
// Blockquote container styles — matches Figma spec (node 14736:1573987)
|
|
@@ -93,10 +136,12 @@ const defaultRichTextStyle: RichTextStyle = {
|
|
|
93
136
|
color: "#6852D6",
|
|
94
137
|
},
|
|
95
138
|
inlineCodeContainerStyle: {
|
|
96
|
-
backgroundColor: "
|
|
97
|
-
borderRadius:
|
|
98
|
-
|
|
99
|
-
|
|
139
|
+
backgroundColor: "rgba(120, 120, 128, 0.22)",
|
|
140
|
+
borderRadius: 4,
|
|
141
|
+
borderWidth: 0.5,
|
|
142
|
+
borderColor: "rgba(120, 120, 128, 0.35)",
|
|
143
|
+
paddingHorizontal: 4,
|
|
144
|
+
paddingVertical: 1,
|
|
100
145
|
},
|
|
101
146
|
codeBlockStyle: {
|
|
102
147
|
fontFamily: Platform.OS === "ios" ? "Menlo" : "monospace",
|
|
@@ -296,14 +341,14 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
296
341
|
}
|
|
297
342
|
// Render blockquote content — detect list items (ENG-31998)
|
|
298
343
|
const quoteContent: JSX.Element[] = [];
|
|
299
|
-
|
|
344
|
+
const quoteLevelCounters: Map<number, number> = new Map();
|
|
300
345
|
for (let i = 0; i < quoteLines.length; i++) {
|
|
301
346
|
const ql = quoteLines[i];
|
|
302
347
|
const bulletMatch = ql.match(QUOTE_BULLET_REGEX);
|
|
303
348
|
const orderedMatch = ql.match(QUOTE_ORDERED_REGEX);
|
|
304
349
|
if (bulletMatch) {
|
|
305
350
|
// Bullet items inside blockquote: render with marker + flex row
|
|
306
|
-
// Don't reset
|
|
351
|
+
// Don't reset quoteLevelCounters — numbering continues across bullet interruptions (Slack behavior)
|
|
307
352
|
quoteContent.push(
|
|
308
353
|
<View key={`ql-${i}`} style={LIST_ROW_STYLE}>
|
|
309
354
|
<Text style={BULLET_MARKER_STYLE}>{"‧ "}</Text>
|
|
@@ -313,20 +358,27 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
313
358
|
</View>
|
|
314
359
|
);
|
|
315
360
|
} else if (orderedMatch) {
|
|
316
|
-
// Numbered item inside blockquote:
|
|
317
|
-
|
|
361
|
+
// Numbered item inside blockquote: supports nested numbering (1. → a. → i.)
|
|
362
|
+
const level = Math.floor(orderedMatch[1].length / 4);
|
|
363
|
+
// Reset counters for deeper levels when returning to a shallower level
|
|
364
|
+
for (const [k] of quoteLevelCounters) {
|
|
365
|
+
if (k > level) quoteLevelCounters.delete(k);
|
|
366
|
+
}
|
|
367
|
+
const currentCount = (quoteLevelCounters.get(level) ?? 0) + 1;
|
|
368
|
+
quoteLevelCounters.set(level, currentCount);
|
|
369
|
+
const indent = level * NESTED_LIST_INDENT;
|
|
318
370
|
quoteContent.push(
|
|
319
|
-
<View key={`ql-${i}`} style={LIST_ROW_STYLE}>
|
|
320
|
-
<Text style={ORDERED_MARKER_STYLE}>{
|
|
371
|
+
<View key={`ql-${i}`} style={[LIST_ROW_STYLE, indent > 0 ? { marginLeft: indent } : undefined]}>
|
|
372
|
+
<Text style={ORDERED_MARKER_STYLE}>{formatListMarker(currentCount, level)}</Text>
|
|
321
373
|
<Text style={LIST_CONTENT_STYLE}>
|
|
322
|
-
{orderedMatch[
|
|
374
|
+
{orderedMatch[3].trim() === '' ? ' ' : this.parseInlineFormats(orderedMatch[3])}
|
|
323
375
|
</Text>
|
|
324
376
|
</View>
|
|
325
377
|
);
|
|
326
378
|
} else {
|
|
327
379
|
// Plain blockquote text — inline formats supported (Req 15.3)
|
|
328
380
|
// Wrap in View with flex:1 so long text wraps within blockquote bounds
|
|
329
|
-
|
|
381
|
+
quoteLevelCounters.clear();
|
|
330
382
|
quoteContent.push(
|
|
331
383
|
<View key={`ql-${i}`} style={BQ_TEXT_ROW_STYLE}>
|
|
332
384
|
<Text style={LIST_CONTENT_STYLE}>
|
|
@@ -360,24 +412,26 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
360
412
|
continue;
|
|
361
413
|
}
|
|
362
414
|
|
|
363
|
-
// Bullet lists (- ) —
|
|
415
|
+
// Bullet lists (- ) — supports nested lists via indentation (4 spaces per level)
|
|
364
416
|
if (isBulletLine(line)) {
|
|
365
417
|
hasViewChildren = true;
|
|
366
|
-
const listItems: string
|
|
418
|
+
const listItems: Array<{ text: string; level: number }> = [];
|
|
367
419
|
while (lineIndex < lines.length && isBulletLine(lines[lineIndex])) {
|
|
368
420
|
const raw = lines[lineIndex];
|
|
369
|
-
|
|
421
|
+
const level = getIndentLevel(raw);
|
|
370
422
|
const trimmed = raw.trim();
|
|
371
423
|
const itemText = trimmed.startsWith("- ") ? trimmed.substring(2) : "";
|
|
372
|
-
listItems.push(itemText);
|
|
424
|
+
listItems.push({ text: itemText, level });
|
|
373
425
|
lineIndex++;
|
|
374
426
|
}
|
|
375
427
|
for (let i = 0; i < listItems.length; i++) {
|
|
428
|
+
const { text: itemText, level } = listItems[i];
|
|
429
|
+
const indent = level * NESTED_LIST_INDENT;
|
|
376
430
|
elements.push(
|
|
377
|
-
<View key={`bullet-${elements.length}`} style={LIST_ROW_STYLE}>
|
|
431
|
+
<View key={`bullet-${elements.length}`} style={[LIST_ROW_STYLE, indent > 0 ? { marginLeft: indent } : undefined]}>
|
|
378
432
|
<Text style={BULLET_MARKER_STYLE}>{"‧ "}</Text>
|
|
379
433
|
<Text style={LIST_CONTENT_STYLE}>
|
|
380
|
-
{
|
|
434
|
+
{itemText.trim() === '' ? ' ' : this.parseInlineFormats(itemText)}
|
|
381
435
|
</Text>
|
|
382
436
|
</View>
|
|
383
437
|
);
|
|
@@ -387,27 +441,39 @@ export class CometChatRichTextFormatter extends CometChatTextFormatter {
|
|
|
387
441
|
continue;
|
|
388
442
|
}
|
|
389
443
|
|
|
390
|
-
// Ordered lists (1. ) —
|
|
444
|
+
// Ordered lists (1. ) — supports nested lists via indentation (4 spaces per level)
|
|
391
445
|
const orderedMatch = trimmedLine.match(ORDERED_LIST_REGEX);
|
|
392
446
|
if (orderedMatch) {
|
|
393
447
|
hasViewChildren = true;
|
|
394
|
-
|
|
448
|
+
// Collect all consecutive ordered list lines with their indentation levels
|
|
449
|
+
const listItems: Array<{ text: string; level: number }> = [];
|
|
395
450
|
while (lineIndex < lines.length) {
|
|
396
|
-
const
|
|
451
|
+
const rawLine = lines[lineIndex];
|
|
452
|
+
const itemMatch = rawLine.trim().match(ORDERED_LIST_REGEX);
|
|
397
453
|
if (itemMatch) {
|
|
398
|
-
|
|
454
|
+
const level = getIndentLevel(rawLine);
|
|
455
|
+
listItems.push({ text: itemMatch[2] ?? '', level });
|
|
399
456
|
lineIndex++;
|
|
400
457
|
} else {
|
|
401
458
|
break;
|
|
402
459
|
}
|
|
403
460
|
}
|
|
461
|
+
// Track counters per nesting level
|
|
462
|
+
const levelCounters: Map<number, number> = new Map();
|
|
404
463
|
for (let i = 0; i < listItems.length; i++) {
|
|
405
|
-
|
|
464
|
+
const { text: itemText, level } = listItems[i];
|
|
465
|
+
// Reset counters for deeper levels when we go back to a shallower level
|
|
466
|
+
for (const [k] of levelCounters) {
|
|
467
|
+
if (k > level) levelCounters.delete(k);
|
|
468
|
+
}
|
|
469
|
+
const currentCount = (levelCounters.get(level) ?? 0) + 1;
|
|
470
|
+
levelCounters.set(level, currentCount);
|
|
471
|
+
const indent = level * NESTED_LIST_INDENT;
|
|
406
472
|
elements.push(
|
|
407
|
-
<View key={`ordered-${elements.length}`} style={LIST_ROW_STYLE}>
|
|
408
|
-
<Text style={ORDERED_MARKER_STYLE}>{
|
|
473
|
+
<View key={`ordered-${elements.length}`} style={[LIST_ROW_STYLE, indent > 0 ? { marginLeft: indent } : undefined]}>
|
|
474
|
+
<Text style={ORDERED_MARKER_STYLE}>{formatListMarker(currentCount, level)}</Text>
|
|
409
475
|
<Text style={LIST_CONTENT_STYLE}>
|
|
410
|
-
{
|
|
476
|
+
{itemText.trim() === '' ? ' ' : this.parseInlineFormats(itemText)}
|
|
411
477
|
</Text>
|
|
412
478
|
</View>
|
|
413
479
|
);
|
|
@@ -75,8 +75,14 @@ export class CometChatUrlsFormatter extends CometChatTextFormatter {
|
|
|
75
75
|
if (!inputText) {
|
|
76
76
|
return null;
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
try {
|
|
79
|
+
let formattedText = this.getFormatTextForLinks({ str: inputText, style: this.style });
|
|
80
|
+
return formattedText;
|
|
81
|
+
} catch {
|
|
82
|
+
// Gracefully handle regex stack overflow on Android Hermes for very long messages.
|
|
83
|
+
// Return the input as-is rather than crashing the app.
|
|
84
|
+
return inputText;
|
|
85
|
+
}
|
|
80
86
|
}
|
|
81
87
|
|
|
82
88
|
getFormatTextForLinks = ({ str, style }: any): any => {
|
|
@@ -1054,6 +1054,15 @@ export class MessageDataSource implements DataSource {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
};
|
|
1056
1056
|
|
|
1057
|
+
// Mentions style for reply preview — derived from theme tokens so customers can
|
|
1058
|
+
// override via CometChatThemeProvider. Uses same tokens as outgoing bubble mentions.
|
|
1059
|
+
const replyMentionsStyle = isOutgoingMessage
|
|
1060
|
+
? {
|
|
1061
|
+
textStyle: { color: theme.color.sendBubbleTextHighlight },
|
|
1062
|
+
backgroundColor: 'rgba(255, 255, 255, 0.25)',
|
|
1063
|
+
}
|
|
1064
|
+
: undefined;
|
|
1065
|
+
|
|
1057
1066
|
const previewComponent = (
|
|
1058
1067
|
<CometChatMessagePreview
|
|
1059
1068
|
message={hasQuotedMessage}
|
|
@@ -1069,6 +1078,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1069
1078
|
}}
|
|
1070
1079
|
showCloseIcon={false}
|
|
1071
1080
|
isDeletedMessage={isQuotedMessageDeleted}
|
|
1081
|
+
mentionsStyle={replyMentionsStyle}
|
|
1072
1082
|
/>
|
|
1073
1083
|
);
|
|
1074
1084
|
|
|
@@ -7,6 +7,7 @@ import { getCometChatTranslation } from "../../resources/CometChatLocalizeNew/Lo
|
|
|
7
7
|
import { Icon } from "../../icons/Icon";
|
|
8
8
|
import { stripMarkdown, preparePreviewText } from "../MarkdownUtils";
|
|
9
9
|
import { CometChatRichTextFormatter } from "../../formatters/CometChatRichTextFormatter";
|
|
10
|
+
import { applyMentionsFormatting } from "../MessageUtils";
|
|
10
11
|
|
|
11
12
|
const t = getCometChatTranslation();
|
|
12
13
|
|
|
@@ -37,6 +38,9 @@ interface CometChatMessagePreviewProps {
|
|
|
37
38
|
|
|
38
39
|
// Deleted message indicator
|
|
39
40
|
isDeletedMessage?: boolean;
|
|
41
|
+
|
|
42
|
+
// Mentions style override for reply preview context
|
|
43
|
+
mentionsStyle?: any;
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
/**
|
|
@@ -56,7 +60,8 @@ const CometChatMessagePreview = (props: CometChatMessagePreviewProps) => {
|
|
|
56
60
|
style,
|
|
57
61
|
subtitleIcon,
|
|
58
62
|
titleStyle,
|
|
59
|
-
isDeletedMessage = false
|
|
63
|
+
isDeletedMessage = false,
|
|
64
|
+
mentionsStyle,
|
|
60
65
|
} = props;
|
|
61
66
|
|
|
62
67
|
const theme = useTheme();
|
|
@@ -105,31 +110,25 @@ const CometChatMessagePreview = (props: CometChatMessagePreviewProps) => {
|
|
|
105
110
|
case CometChat.MESSAGE_TYPE.TEXT:
|
|
106
111
|
const textMessage = message as CometChat.TextMessage;
|
|
107
112
|
let text = (typeof textMessage.getText === 'function' ? textMessage.getText() : (textMessage as any).text) || "";
|
|
108
|
-
try {
|
|
109
|
-
if (textMessage.getMentionedUsers && textMessage.getMentionedUsers().length > 0) {
|
|
110
|
-
const mentionedUsers = textMessage.getMentionedUsers();
|
|
111
|
-
const uidMap = new Map();
|
|
112
|
-
mentionedUsers.forEach(user => {
|
|
113
|
-
uidMap.set(user.getUid(), user.getName());
|
|
114
|
-
});
|
|
115
|
-
text = text.replace(/<@uid:(.*?)>/g, (match: string, uid: string): string => {
|
|
116
|
-
if (uidMap.has(uid)) {
|
|
117
|
-
return `@${uidMap.get(uid)}`;
|
|
118
|
-
}
|
|
119
|
-
return match;
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
text = text.replace(/<@all:(.*?)>/g, (match: string, alias: string): string => {
|
|
123
|
-
return `@${alias}`;
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
} catch (e) {
|
|
127
|
-
console.warn("Error formatting mentions in preview:", e);
|
|
128
|
-
}
|
|
129
113
|
|
|
130
114
|
// Prepare text for preview: collapse code blocks, strip block markers, flatten to single line
|
|
131
115
|
const previewResult = preparePreviewText(text);
|
|
132
116
|
const cleanText = previewResult.text;
|
|
117
|
+
// Set inline code styles for the preview context — uses theme's textPrimary
|
|
118
|
+
// which is white for outgoing (set by getReplyView) and dark for composer tray.
|
|
119
|
+
previewFormatter.setStyle({
|
|
120
|
+
inlineCodeStyle: {
|
|
121
|
+
fontSize: 14,
|
|
122
|
+
fontWeight: '400',
|
|
123
|
+
color: finalTheme?.color?.textPrimary as string || '#141414',
|
|
124
|
+
},
|
|
125
|
+
inlineCodeContainerStyle: {
|
|
126
|
+
backgroundColor: finalTheme?.color?.previewInlineCodeBackground ?? finalTheme?.color?.background3 ?? 'rgba(120, 120, 128, 0.18)',
|
|
127
|
+
borderRadius: 4,
|
|
128
|
+
borderWidth: 0.5,
|
|
129
|
+
borderColor: finalTheme?.color?.borderDefault ?? 'rgba(120, 120, 128, 0.3)',
|
|
130
|
+
},
|
|
131
|
+
});
|
|
133
132
|
const formatted = previewFormatter.getFormattedText(cleanText || null);
|
|
134
133
|
|
|
135
134
|
// Resolve subtitle content
|
|
@@ -140,6 +139,10 @@ const CometChatMessagePreview = (props: CometChatMessagePreviewProps) => {
|
|
|
140
139
|
subtitleContent = (formatted as string) || stripMarkdown(text);
|
|
141
140
|
}
|
|
142
141
|
|
|
142
|
+
// Apply mentions formatter using shared helper (DRY — same as conversation list)
|
|
143
|
+
// mentionsStyle prop is passed from the caller (e.g., getReplyView in MessageDataSource)
|
|
144
|
+
subtitleContent = applyMentionsFormatting(textMessage, subtitleContent, text, mentionsStyle);
|
|
145
|
+
|
|
143
146
|
// For code blocks (first rich block): render compact code block container
|
|
144
147
|
if (previewResult.codeBlockFirstLine !== null) {
|
|
145
148
|
isCodeBlockPreview = true;
|
|
@@ -330,7 +333,7 @@ const CometChatMessagePreview = (props: CometChatMessagePreviewProps) => {
|
|
|
330
333
|
{iconToShow && <View>{iconToShow}</View>}
|
|
331
334
|
{isCodeBlockPreview ? (
|
|
332
335
|
<View style={previewBlockStyles.codeBlockRow}>
|
|
333
|
-
<View style={[previewBlockStyles.codeBlockBadge, { backgroundColor: finalTheme?.color?.background2 as string || '#FAFAFA', borderColor: finalTheme?.color?.borderDefault as string || '#E8E8E8' }]}>
|
|
336
|
+
<View style={[previewBlockStyles.codeBlockBadge, { backgroundColor: (finalTheme?.color?.previewCodeBlockBackground ?? finalTheme?.color?.background2) as string || '#FAFAFA', borderColor: (finalTheme?.color?.previewCodeBlockBorder ?? finalTheme?.color?.borderDefault) as string || '#E8E8E8' }]}>
|
|
334
337
|
<Text numberOfLines={1} ellipsizeMode='tail' style={[previewBlockStyles.codeBlockText, { color: finalTheme?.color?.textPrimary as string || '#141414' }]}>
|
|
335
338
|
{codeBlockLine + '..'}
|
|
336
339
|
</Text>
|
|
@@ -60,7 +60,11 @@ export function stripMarkdown(text: string): string {
|
|
|
60
60
|
// 9. Remove numbered list markers at start of lines
|
|
61
61
|
result = result.replace(/^\d+\.\s/gm, '');
|
|
62
62
|
|
|
63
|
-
// 10.
|
|
63
|
+
// 10. Strip HTML tags (e.g., <u>, <b>, <i>, <s>, <em>, <strong>, <del>, <br>, etc.)
|
|
64
|
+
result = result.replace(/<br\s*\/?>/gi, '\n');
|
|
65
|
+
result = result.replace(/<[^>]+>/g, '');
|
|
66
|
+
|
|
67
|
+
// 11. Remove any remaining backslash escapes (e.g., \* \_ \` \~)
|
|
64
68
|
result = result.replace(/\\([*_`~>\\])/g, '$1');
|
|
65
69
|
|
|
66
70
|
return result;
|
|
@@ -5,6 +5,7 @@ import { MessageBubbleAlignmentType } from "../base";
|
|
|
5
5
|
import {
|
|
6
6
|
CometChatCustomMessageTypes,
|
|
7
7
|
MessageCategoryConstants,
|
|
8
|
+
MentionsTargetElement,
|
|
8
9
|
MessageReceipt,
|
|
9
10
|
MessageTypeConstants,
|
|
10
11
|
} from "../constants/UIKitConstants";
|
|
@@ -13,7 +14,9 @@ import { Icon, IconName } from "../icons/Icon";
|
|
|
13
14
|
import { CometChatMessageTemplate } from "../modals";
|
|
14
15
|
import { CometChatMessageBubble } from "../views/CometChatMessageBubble";
|
|
15
16
|
import { BubbleStyles, CometChatTheme, OutgoingBubbleStyles } from "../../theme/type";
|
|
16
|
-
import { CometChatUIKit } from "../CometChatUiKit";
|
|
17
|
+
import { CometChatUIKit } from "../CometChatUiKit/CometChatUIKit";
|
|
18
|
+
import { SuggestionItem } from "../views/CometChatSuggestionList/SuggestionItem";
|
|
19
|
+
import { CommonUtils } from "./CommonUtils";
|
|
17
20
|
import { deepMerge } from "../helper/helperFunctions";
|
|
18
21
|
import { CometChatDate } from "../views/CometChatDate";
|
|
19
22
|
import { CometChatAvatar, CometChatReceipt } from "../views";
|
|
@@ -376,6 +379,68 @@ export const getMessagePreviewInternal = (
|
|
|
376
379
|
);
|
|
377
380
|
};
|
|
378
381
|
|
|
382
|
+
/**
|
|
383
|
+
* Applies mentions formatting to message content.
|
|
384
|
+
* Shared helper used by CometChatConversations subtitle and CometChatMessagePreview
|
|
385
|
+
* to ensure consistent @mention styling across the UI.
|
|
386
|
+
*
|
|
387
|
+
* @param message - The message containing mentioned users
|
|
388
|
+
* @param content - The current formatted content (string or JSX)
|
|
389
|
+
* @param rawText - The raw message text (for detecting @all alias tokens)
|
|
390
|
+
* @param mentionsStyle - Optional style overrides for mentions
|
|
391
|
+
* @returns The content with styled mentions applied
|
|
392
|
+
*/
|
|
393
|
+
export const applyMentionsFormatting = (
|
|
394
|
+
message: CometChat.BaseMessage,
|
|
395
|
+
content: string | JSX.Element,
|
|
396
|
+
rawText: string,
|
|
397
|
+
mentionsStyle?: any,
|
|
398
|
+
): string | JSX.Element => {
|
|
399
|
+
const containsAllAlias = /<@all:(.*?)>/.test(rawText);
|
|
400
|
+
if (!message.getMentionedUsers?.().length && !containsAllAlias) {
|
|
401
|
+
return content;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
try {
|
|
405
|
+
let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
|
|
406
|
+
mentionsFormatter.setContext("conversation");
|
|
407
|
+
mentionsFormatter.setLoggedInUser(CometChatUIKit.loggedInUser!);
|
|
408
|
+
mentionsFormatter.setTargetElement(MentionsTargetElement.conversation);
|
|
409
|
+
mentionsFormatter.setMessage(message);
|
|
410
|
+
if (mentionsStyle) {
|
|
411
|
+
mentionsFormatter.setMentionsStyle(mentionsStyle);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (containsAllAlias) {
|
|
415
|
+
const match = rawText.match(/<@all:(.*?)>/);
|
|
416
|
+
const aliasLabel = match && match[1] ? match[1] : "all";
|
|
417
|
+
let existing = mentionsFormatter.getSuggestionItems();
|
|
418
|
+
const underlyingText = `<@all:${aliasLabel}>`;
|
|
419
|
+
const already = existing.find((it: any) => it.underlyingText === underlyingText);
|
|
420
|
+
if (!already) {
|
|
421
|
+
const aliasItem = new SuggestionItem({
|
|
422
|
+
id: aliasLabel,
|
|
423
|
+
name: aliasLabel,
|
|
424
|
+
promptText: aliasLabel,
|
|
425
|
+
trackingCharacter: "@",
|
|
426
|
+
underlyingText,
|
|
427
|
+
hideLeadingIcon: true,
|
|
428
|
+
});
|
|
429
|
+
mentionsFormatter.setSuggestionItems([...existing, aliasItem]);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
let suggestionUsers = mentionsFormatter.getSuggestionItems();
|
|
434
|
+
mentionsFormatter.setMessage(message);
|
|
435
|
+
if (suggestionUsers.length > 0) mentionsFormatter.setSuggestionItems(suggestionUsers);
|
|
436
|
+
let _formatter = CommonUtils.clone(mentionsFormatter);
|
|
437
|
+
return _formatter.getFormattedText(content, mentionsStyle);
|
|
438
|
+
} catch (e) {
|
|
439
|
+
console.warn("Error applying mentions formatting:", e);
|
|
440
|
+
return content;
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
|
|
379
444
|
export const getModerationStatus = (message: CometChat.BaseMessage | any): string => {
|
|
380
445
|
if (message?.getModerationStatus) {
|
|
381
446
|
try {
|
|
@@ -94,6 +94,7 @@ export const CometChatSuggestionList = (props: CometChatSuggestionListInterface)
|
|
|
94
94
|
<FlatList
|
|
95
95
|
data={data}
|
|
96
96
|
renderItem={_render}
|
|
97
|
+
keyExtractor={(item, index) => `${item.id}_${index}`}
|
|
97
98
|
onMomentumScrollEnd={(event) => {
|
|
98
99
|
const contentOffsetY = event.nativeEvent.contentOffset.y; // The current scroll position
|
|
99
100
|
const contentHeight = event.nativeEvent.contentSize.height; // Total height of the content
|
|
@@ -159,7 +159,29 @@ export const CometChatTextBubbleText = (
|
|
|
159
159
|
const isViewBased = React.isValidElement(formattedText) &&
|
|
160
160
|
(formattedText as React.ReactElement<any>).type === View;
|
|
161
161
|
|
|
162
|
-
//
|
|
162
|
+
// For View-based content, count children to determine truncatability and slice when collapsed.
|
|
163
|
+
// This avoids pixel-based clipping that cuts through the middle of list items.
|
|
164
|
+
const viewChildren = useMemo(() => {
|
|
165
|
+
if (!isViewBased) return null;
|
|
166
|
+
const children = React.Children.toArray(
|
|
167
|
+
(formattedText as React.ReactElement<any>).props.children
|
|
168
|
+
).filter(React.isValidElement) as React.ReactElement<any>[];
|
|
169
|
+
return children;
|
|
170
|
+
}, [isViewBased, formattedText]);
|
|
171
|
+
|
|
172
|
+
const viewChildCount = viewChildren?.length ?? 0;
|
|
173
|
+
const isViewTruncatable = isViewBased && viewChildCount > collapseLines;
|
|
174
|
+
|
|
175
|
+
// Memoize styled children to avoid re-running applyTextStyleDeep on every render/toggle
|
|
176
|
+
const styledViewChildren = useMemo(() => {
|
|
177
|
+
if (!viewChildren) return null;
|
|
178
|
+
return viewChildren.map((child) => {
|
|
179
|
+
if (!React.isValidElement(child)) return child;
|
|
180
|
+
return applyTextStyleDeep(child as React.ReactElement<any>, textStyle);
|
|
181
|
+
});
|
|
182
|
+
}, [viewChildren, textStyle]);
|
|
183
|
+
|
|
184
|
+
// Only measure string content via onTextLayout — View-based uses child count instead
|
|
163
185
|
const needsMeasurement = containerWidth !== null && !isViewBased && !measuredCacheRef.current[hiddenTextKey];
|
|
164
186
|
|
|
165
187
|
return (
|
|
@@ -181,15 +203,9 @@ export const CometChatTextBubbleText = (
|
|
|
181
203
|
)}
|
|
182
204
|
|
|
183
205
|
{/* Visible text — View-based content (blockquotes, lists) rendered directly */}
|
|
184
|
-
{isViewBased ? (
|
|
206
|
+
{isViewBased && styledViewChildren ? (
|
|
185
207
|
<View style={VIEW_BASED_WRAPPER_STYLE}>
|
|
186
|
-
{
|
|
187
|
-
(formattedText as React.ReactElement<any>).props.children,
|
|
188
|
-
(child) => {
|
|
189
|
-
if (!React.isValidElement(child)) return child;
|
|
190
|
-
return applyTextStyleDeep(child as React.ReactElement<any>, textStyle);
|
|
191
|
-
}
|
|
192
|
-
)}
|
|
208
|
+
{isExpanded || !isViewTruncatable ? styledViewChildren : styledViewChildren.slice(0, collapseLines)}
|
|
193
209
|
</View>
|
|
194
210
|
) : (
|
|
195
211
|
<Text
|
|
@@ -202,7 +218,7 @@ export const CometChatTextBubbleText = (
|
|
|
202
218
|
)}
|
|
203
219
|
|
|
204
220
|
{/* Toggle - only show after measurement is complete to prevent flicker */}
|
|
205
|
-
{measurementComplete && isTruncatable && (
|
|
221
|
+
{((measurementComplete && isTruncatable) || isViewTruncatable) && (
|
|
206
222
|
<View style={[{ alignItems: "flex-end", marginTop: 6 }, toggleContainerStyle]}>
|
|
207
223
|
<TouchableOpacity onPress={toggle} accessibilityRole='button'>
|
|
208
224
|
<Text style={[{ alignSelf: "flex-end" }, textStyle, toggleTextStyle]}>
|
|
@@ -267,6 +267,15 @@ export class CometChatThemeHelper {
|
|
|
267
267
|
color.receiveBubbleIcon =
|
|
268
268
|
color.receiveBubbleIcon === undefined ? color.primary : color.receiveBubbleIcon;
|
|
269
269
|
|
|
270
|
+
color.previewInlineCodeBackground =
|
|
271
|
+
color.previewInlineCodeBackground === undefined ? defaultColor.previewInlineCodeBackground : color.previewInlineCodeBackground;
|
|
272
|
+
|
|
273
|
+
color.previewCodeBlockBackground =
|
|
274
|
+
color.previewCodeBlockBackground === undefined ? defaultColor.previewCodeBlockBackground : color.previewCodeBlockBackground;
|
|
275
|
+
|
|
276
|
+
color.previewCodeBlockBorder =
|
|
277
|
+
color.previewCodeBlockBorder === undefined ? defaultColor.previewCodeBlockBorder : color.previewCodeBlockBorder;
|
|
278
|
+
|
|
270
279
|
return color;
|
|
271
280
|
}
|
|
272
281
|
|
|
@@ -40,6 +40,12 @@ const staticColors = {
|
|
|
40
40
|
staticWhite: "#FFFFFF",
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
const overlayColors = {
|
|
44
|
+
overlayLight: neutralColors.neutral300,
|
|
45
|
+
overlayCodeBlock: "rgba(255, 255, 255, 0.20)",
|
|
46
|
+
overlayCodeBlockBorder: "rgba(255, 255, 255, 0.30)",
|
|
47
|
+
};
|
|
48
|
+
|
|
43
49
|
export const defaultColorDark: Color = {
|
|
44
50
|
primary: primaryColor,
|
|
45
51
|
...extendedPrimaryColors,
|
|
@@ -96,4 +102,11 @@ export const defaultColorDark: Color = {
|
|
|
96
102
|
receiveBubbleLink: alertColors.info,
|
|
97
103
|
receiveBubbleTimestamp: neutralColors.neutral600,
|
|
98
104
|
receiveBubbleIcon: primaryColor,
|
|
105
|
+
|
|
106
|
+
// Reply preview inline code background
|
|
107
|
+
previewInlineCodeBackground: overlayColors.overlayLight,
|
|
108
|
+
// Reply preview code block background
|
|
109
|
+
previewCodeBlockBackground: overlayColors.overlayCodeBlock,
|
|
110
|
+
// Reply preview code block border
|
|
111
|
+
previewCodeBlockBorder: overlayColors.overlayCodeBlockBorder,
|
|
99
112
|
};
|
|
@@ -40,6 +40,12 @@ const staticColors = {
|
|
|
40
40
|
staticWhite: "#FFFFFF",
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
const overlayColors = {
|
|
44
|
+
overlayLight: "rgba(120, 120, 128, 0.70)",
|
|
45
|
+
overlayCodeBlock: "rgba(255, 255, 255, 0.20)",
|
|
46
|
+
overlayCodeBlockBorder: neutralColors.neutral300,
|
|
47
|
+
};
|
|
48
|
+
|
|
43
49
|
export const defaultColorLight = {
|
|
44
50
|
primary: primaryColor,
|
|
45
51
|
...extendedPrimaryColors,
|
|
@@ -96,8 +102,14 @@ export const defaultColorLight = {
|
|
|
96
102
|
receiveBubbleLink: alertColors.info,
|
|
97
103
|
receiveBubbleTimestamp: neutralColors.neutral600,
|
|
98
104
|
receiveBubbleIcon: primaryColor,
|
|
99
|
-
};
|
|
100
105
|
|
|
106
|
+
// Reply preview inline code background
|
|
107
|
+
previewInlineCodeBackground: overlayColors.overlayLight,
|
|
108
|
+
// Reply preview code block background
|
|
109
|
+
previewCodeBlockBackground: overlayColors.overlayCodeBlock,
|
|
110
|
+
// Reply preview code block border
|
|
111
|
+
previewCodeBlockBorder: overlayColors.overlayCodeBlockBorder,
|
|
112
|
+
};
|
|
101
113
|
type EachColorValue<T extends typeof defaultColorLight> = {
|
|
102
114
|
[P in keyof T]: ColorValue;
|
|
103
115
|
};
|