Skip to content

Commit

Permalink
Revert "fix(EuiCode): Remove reducing two or more consecutive empty l…
Browse files Browse the repository at this point in the history
…ines to a single one when using the Copy button"

This reverts commit 8a90215c81432514493b1bb29ecd314d6792a05d.
  • Loading branch information
tkajtoch committed Jun 1, 2023
1 parent e94af41 commit da540ee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/code/code_block_copy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ export const useCopy = ({
const [innerTextRef, _innerText] = useInnerText('');
const innerText = useMemo(
() =>
// Normalize line terminations to match native JS format
_innerText?.replace(NEW_LINE_REGEX_GLOBAL, '\n') || '',
_innerText
// Normalize line terminations to match native JS format
?.replace(NEW_LINE_REGEX_GLOBAL, '\n')
// Reduce two or more consecutive new line characters to a single one
.replace(/\n{2,}/g, '\n') || '',
[_innerText]
);
const textToCopy = isVirtualized ? `${children}` : innerText; // Virtualized code blocks do not have inner text
Expand Down

0 comments on commit da540ee

Please sign in to comment.