Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `wrapLines` prop to `EuiCodeBlock` ([#3009](https://github.com/elastic/eui/pull/3009))
- Updated `EuiFilterSelect` to retain the order of its filters ([#3063](https://github.com/elastic/eui/pull/3063))
- Added `href` prop to `EuiBadge` ([#3009](https://github.com/elastic/eui/pull/3009))
- Added props descriptions for `EuiComboBox` ([#3007](https://github.com/elastic/eui/pull/3007))
Expand Down
9 changes: 9 additions & 0 deletions src/components/code/_code_block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ interface Props {
overflowHeight?: number;
paddingSize: PaddingSize;
transparentBackground: boolean;
/**
* specify how white-space inside the element is handled
Comment thread
anishagg17 marked this conversation as resolved.
Outdated
*/
wrapLines?: 'nowrap' | 'normal' | 'pre';
}

interface State {
Expand Down Expand Up @@ -152,6 +156,7 @@ export class EuiCodeBlockImpl extends Component<Props, State> {
paddingSize,
transparentBackground,
isCopyable,
wrapLines,
...otherProps
} = this.props;

Expand All @@ -175,6 +180,10 @@ export class EuiCodeBlockImpl extends Component<Props, State> {
optionalStyles.maxHeight = overflowHeight;
}

if (wrapLines) {
optionalStyles.whiteSpace = wrapLines;
Comment thread
anishagg17 marked this conversation as resolved.
Outdated
}

const codeSnippet = (
<code
ref={ref => {
Expand Down