Unverified Commit 9bf818a9 authored by niko's avatar niko Committed by GitHub

Add overflow-wrap & wordWrap for ? character break line. Fix: #1767 (#1808)

parent e1e0a7d2
...@@ -8,6 +8,11 @@ import styles from './index.less'; ...@@ -8,6 +8,11 @@ import styles from './index.less';
const isSupportLineClamp = document.body.style.webkitLineClamp !== undefined; const isSupportLineClamp = document.body.style.webkitLineClamp !== undefined;
const TooltipOverlayStyle = {
overflowWrap: 'break-word',
wordWrap: 'break-word',
};
export const getStrFullLength = (str = '') => { export const getStrFullLength = (str = '') => {
return str.split('').reduce((pre, cur) => { return str.split('').reduce((pre, cur) => {
const charCode = cur.charCodeAt(0); const charCode = cur.charCodeAt(0);
...@@ -54,7 +59,7 @@ const EllipsisText = ({ text, length, tooltip, fullWidthRecognition, ...other }) ...@@ -54,7 +59,7 @@ const EllipsisText = ({ text, length, tooltip, fullWidthRecognition, ...other })
if (tooltip) { if (tooltip) {
return ( return (
<Tooltip overlayStyle={{ wordBreak: 'break-all' }} title={text}> <Tooltip overlayStyle={TooltipOverlayStyle} title={text}>
<span> <span>
{displayText} {displayText}
{tail} {tail}
...@@ -223,7 +228,7 @@ export default class Ellipsis extends Component { ...@@ -223,7 +228,7 @@ export default class Ellipsis extends Component {
<div id={id} className={cls} {...restProps}> <div id={id} className={cls} {...restProps}>
<style>{style}</style> <style>{style}</style>
{tooltip ? ( {tooltip ? (
<Tooltip overlayStyle={{ wordBreak: 'break-all' }} title={children}> <Tooltip overlayStyle={TooltipOverlayStyle} title={children}>
{children} {children}
</Tooltip> </Tooltip>
) : ( ) : (
...@@ -244,7 +249,7 @@ export default class Ellipsis extends Component { ...@@ -244,7 +249,7 @@ export default class Ellipsis extends Component {
<div {...restProps} ref={this.handleRoot} className={cls}> <div {...restProps} ref={this.handleRoot} className={cls}>
<div ref={this.handleContent}> <div ref={this.handleContent}>
{tooltip ? ( {tooltip ? (
<Tooltip overlayStyle={{ wordBreak: 'break-all' }} title={text}> <Tooltip overlayStyle={TooltipOverlayStyle} title={text}>
{childNode} {childNode}
</Tooltip> </Tooltip>
) : ( ) : (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment