Skip to content

Commit

Permalink
support multiple lines of preview text component(#1032)
Browse files Browse the repository at this point in the history
  • Loading branch information
lushanyanYX authored Sep 25, 2020
1 parent 6b65fbb commit d8df7db
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/react-shared-components/src/PreviewText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export const PreviewText: React.FC<IPreviewTextProps> & {
value = String(
props.value === undefined || props.value === null ? '' : props.value
)
// 如果有换行符,拆分成多行
if (value.match('\n')) {
value = value
.split('\n')
.map((subStr, index) => <div key={index}>{subStr}</div>)
}
}
}
const placeholder = isFn(context.previewPlaceholder)
Expand Down

0 comments on commit d8df7db

Please sign in to comment.