react-truncate icon indicating copy to clipboard operation
react-truncate copied to clipboard

Bug with <span>text</span> in children

Open panrahk opened this issue 8 years ago • 0 comments

Hello, i have this code for truncate

<Truncate
        key="body"
        lines={!this.state.expanded && 5}
        className={classnames({
          [s.expand]: !this.state.expanded,
        })}
        ellipsis={
          <div className={s.readMore} onClick={this.onTruncatedExpandClick}>
            {'Read more'}
          </div>
        }
        onTruncate={this.onTruncate}
      >
        {children.split('\n').map((item, key) => <span key={key}>{item}{childrenRows !== (key + 1) ? <br /> : '' }</span>)}
        {status === 'edited' ? (
          <span className={s.edited}>{`${this.props.intl.formatMessage(messages.edited)}`}</span>
        ) : null}
      </Truncate>

if text lines more than 5, Read more is displayed and after expand i have this result image

But if text lines 1, Edited text dispalyed as text without image

How can i fix it?

panrahk avatar Oct 13 '17 12:10 panrahk