File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ import { MessageBox } from 'react-chat-elements'
113113| notch | true | boolean | message box notch |
114114| avatar | none | url | message box avatar url |
115115| renderAddCmp | none | function (component) | adding custom components to message box |
116+ | copiableDate | false | boolean | message box date text copiable |
116117
117118
118119## SystemMessage Component
Original file line number Diff line number Diff line change 11{
22 "name" : " react-chat-elements" ,
3- "version" : " 0.8.1 " ,
3+ "version" : " 0.8.2 " ,
44 "description" : " Reactjs chat components" ,
55 "author" : " Avare Kodcu <abdurrahmaneker58@gmail.com>" ,
66 "main" : " dist/main.js" ,
Original file line number Diff line number Diff line change 9696 bottom : -5px ;
9797}
9898
99+ .rce-mbox-time .non-copiable : before {
100+ content : attr (data-text);
101+ }
102+
99103.rce-mbox-time-block {
100104 /*position: relative;*/
101105 right : 0 ;
Original file line number Diff line number Diff line change @@ -25,6 +25,12 @@ export class MessageBox extends Component {
2525 var positionCls = classNames ( 'rce-mbox' , { 'rce-mbox-right' : this . props . position === 'right' } ) ;
2626 var thatAbsoluteTime = this . props . type !== 'text' && this . props . type !== 'file' && ! ( this . props . type === 'location' && this . props . text ) ;
2727
28+
29+ const dateText = this . props . date && ! isNaN ( this . props . date ) && (
30+ this . props . dateString ||
31+ moment ( this . props . date ) . fromNow ( )
32+ ) ;
33+
2834 return (
2935 < div
3036 className = { classNames ( 'rce-container-mbox' , this . props . className ) }
@@ -130,8 +136,15 @@ export class MessageBox extends Component {
130136 uri = { this . props . uri || this . props . text } />
131137 }
132138
133- < div className = { classNames ( 'rce-mbox-time' , { 'rce-mbox-time-block' : thatAbsoluteTime } ) } >
139+ < div
140+ className = { classNames (
141+ 'rce-mbox-time' ,
142+ { 'rce-mbox-time-block' : thatAbsoluteTime } ,
143+ { 'non-copiable' : ! this . props . copiableDate } ,
144+ ) }
145+ data-text = { this . props . copiableDate ? undefined : dateText } >
134146 {
147+ this . props . copiableDate &&
135148 this . props . date &&
136149 ! isNaN ( this . props . date ) &&
137150 (
@@ -213,6 +226,7 @@ MessageBox.defaultProps = {
213226 notch : true ,
214227 avatar : null ,
215228 renderAddCmp : null ,
229+ copiableDate : false ,
216230} ;
217231
218232
You can’t perform that action at this time.
0 commit comments