Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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 `whiteSpace ` prop to `EuiCodeBlock` ([#3103](https://github.com/elastic/eui/pull/3103))
- Added `Enter` key press functionality to `EuiSuperDatePicker` ([#3048](https://github.com/elastic/eui/pull/3048))

## [`21.1.0`](https://github.com/elastic/eui/tree/v21.1.0)
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
*/
whiteSpace?: 'pre' | 'pre-wrap';
}

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

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

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

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