From 0b39c73a2056658e7b4ca6b270faf3085780093a Mon Sep 17 00:00:00 2001 From: Avare Kodcu Date: Fri, 9 Feb 2018 10:14:42 +0300 Subject: [PATCH 1/2] MessageBox copiableDate prop has been added. (#51) --- README.md | 1 + src/MessageBox/MessageBox.css | 4 ++++ src/MessageBox/MessageBox.js | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fd37b518..04875ab1 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ import { MessageBox } from 'react-chat-elements' | notch | true | boolean | message box notch | | avatar | none | url | message box avatar url | | renderAddCmp | none | function (component) | adding custom components to message box | +| copiableDate | false | boolean | message box date text copiable | ## SystemMessage Component diff --git a/src/MessageBox/MessageBox.css b/src/MessageBox/MessageBox.css index 2fc17e75..409fb8fd 100644 --- a/src/MessageBox/MessageBox.css +++ b/src/MessageBox/MessageBox.css @@ -96,6 +96,10 @@ bottom: -5px; } +.rce-mbox-time.non-copiable:before { + content: attr(data-text); +} + .rce-mbox-time-block { /*position: relative;*/ right: 0; diff --git a/src/MessageBox/MessageBox.js b/src/MessageBox/MessageBox.js index 977be801..811d7f3c 100644 --- a/src/MessageBox/MessageBox.js +++ b/src/MessageBox/MessageBox.js @@ -25,6 +25,12 @@ export class MessageBox extends Component { var positionCls = classNames('rce-mbox', { 'rce-mbox-right': this.props.position === 'right' }); var thatAbsoluteTime = this.props.type !== 'text' && this.props.type !== 'file' && !(this.props.type === 'location' && this.props.text); + + const dateText = this.props.date && !isNaN(this.props.date) && ( + this.props.dateString || + moment(this.props.date).fromNow() + ); + return (
} -
+
{ + this.props.copiableDate && this.props.date && !isNaN(this.props.date) && ( @@ -213,6 +226,7 @@ MessageBox.defaultProps = { notch: true, avatar: null, renderAddCmp: null, + copiableDate: false, }; From 9e92b2ac3e35fdd28b9b18fabfe3ab12aa94c591 Mon Sep 17 00:00:00 2001 From: abdurrahmanekr Date: Fri, 9 Feb 2018 10:15:16 +0300 Subject: [PATCH 2/2] version upgrade --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5e6cd87a..d7efc1dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-chat-elements", - "version": "0.8.1", + "version": "0.8.2", "description": "Reactjs chat components", "author": "Avare Kodcu ", "main": "dist/main.js",