react-mention-input 1.1.16 → 1.1.17
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/demo.tsx +3 -3
- package/package.json +1 -1
- package/src/ShowMessageCard.tsx +13 -11
package/demo.tsx
CHANGED
|
@@ -8,14 +8,14 @@ const Demo: React.FC = () => {
|
|
|
8
8
|
name: 'John Doe',
|
|
9
9
|
date: '2 hours ago',
|
|
10
10
|
comment: 'Updated the status to Draft. Need <span class="mention-highlight">@team-leads</span> review before proceeding. <span class="hashtag-highlight">#urgent</span> <span class="hashtag-highlight">#review</span>',
|
|
11
|
-
|
|
11
|
+
objectName: '26may_item001 (A)',
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
id: 2,
|
|
15
15
|
name: 'Mike Johnson',
|
|
16
16
|
date: '1 day ago',
|
|
17
17
|
comment: 'Revision A completed successfully. Ready for next phase. <span class="hashtag-highlight">#milestone</span>',
|
|
18
|
-
|
|
18
|
+
objectName: '26may_item001 (A)',
|
|
19
19
|
}
|
|
20
20
|
]);
|
|
21
21
|
|
|
@@ -48,7 +48,7 @@ const Demo: React.FC = () => {
|
|
|
48
48
|
imageUrl: messageData.imageUrl,
|
|
49
49
|
tags: messageData.tags,
|
|
50
50
|
mentions: messageData.userSelectListName,
|
|
51
|
-
|
|
51
|
+
objectName: 'new_item001 (A)', // You can customize this or make it dynamic
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
setMessages([...messages, newMessage]);
|
package/package.json
CHANGED
package/src/ShowMessageCard.tsx
CHANGED
|
@@ -12,7 +12,7 @@ interface ShowMessageCardProps {
|
|
|
12
12
|
commentKey?: string; // Custom key for comment
|
|
13
13
|
imgSrcKey?: string; // Custom key for image source
|
|
14
14
|
imageUrlKey?: string; // Custom key for attached image URL
|
|
15
|
-
|
|
15
|
+
objectNameKey?: string; // Custom key for object identifier (top-right)
|
|
16
16
|
containerClassName?: string; // Class for the outermost container
|
|
17
17
|
containerStyle?: CSSProperties; // Style for the outermost container
|
|
18
18
|
cardClassName?: string; // Class for the card
|
|
@@ -35,8 +35,8 @@ interface ShowMessageCardProps {
|
|
|
35
35
|
attachedImageStyle?: CSSProperties; // Style for the attached image
|
|
36
36
|
attachedImageContainerClassName?: string; // Class for the attached image container
|
|
37
37
|
attachedImageContainerStyle?: CSSProperties; // Style for the attached image container
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
objectNameClassName?: string; // Class for the object name (top-right)
|
|
39
|
+
objectNameStyle?: CSSProperties; // Style for the object name (top-right)
|
|
40
40
|
renderItem?: (element: MessageCardProps) => ReactNode; // Custom render function
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -47,7 +47,7 @@ export const ShowMessageCard: React.FC<ShowMessageCardProps> = ({
|
|
|
47
47
|
commentKey = "comment",
|
|
48
48
|
imgSrcKey = "imgSrc",
|
|
49
49
|
imageUrlKey = "imageUrl", // Default key for attached image
|
|
50
|
-
|
|
50
|
+
objectNameKey = "objectName", // Default key for object identifier
|
|
51
51
|
containerClassName,
|
|
52
52
|
containerStyle,
|
|
53
53
|
cardClassName,
|
|
@@ -70,10 +70,12 @@ export const ShowMessageCard: React.FC<ShowMessageCardProps> = ({
|
|
|
70
70
|
attachedImageStyle,
|
|
71
71
|
attachedImageContainerClassName,
|
|
72
72
|
attachedImageContainerStyle,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
objectNameClassName,
|
|
74
|
+
objectNameStyle,
|
|
75
75
|
renderItem, // Custom render function
|
|
76
76
|
}) => {
|
|
77
|
+
|
|
78
|
+
console.log(data, "data==");
|
|
77
79
|
// State to manage initials for images that fail to load
|
|
78
80
|
const [initialsState, setInitialsState] = useState<{ [key: string]: boolean }>(
|
|
79
81
|
{}
|
|
@@ -175,13 +177,13 @@ export const ShowMessageCard: React.FC<ShowMessageCardProps> = ({
|
|
|
175
177
|
</div>
|
|
176
178
|
</div>
|
|
177
179
|
|
|
178
|
-
{/*
|
|
179
|
-
{item[
|
|
180
|
+
{/* Object identifier in top-right corner */}
|
|
181
|
+
{item[objectNameKey] && (
|
|
180
182
|
<div
|
|
181
|
-
className={`message-card-item-name ${
|
|
182
|
-
style={
|
|
183
|
+
className={`message-card-item-name ${objectNameClassName || ""}`}
|
|
184
|
+
style={objectNameStyle}
|
|
183
185
|
>
|
|
184
|
-
{item[
|
|
186
|
+
{item[objectNameKey]}
|
|
185
187
|
</div>
|
|
186
188
|
)}
|
|
187
189
|
</div>
|