From d35879944a7aee41a79044f6fdb40107638cca45 Mon Sep 17 00:00:00 2001 From: Gabriel Hernandez Date: Thu, 21 Dec 2023 11:17:03 -0600 Subject: [PATCH] fix formatting of script output (#15757) relates to #15515 fix the formatting of the script output by replacing the `\r` characters with `\n` characters. - [x] Changes file added for user-visible changes in `changes/` or `orbit/changes/`. - [x] Manual QA for all new/changed functionality --- changes/issue-15515-fix-script-output-formatting | 1 + frontend/components/Textarea/Textarea.tsx | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 changes/issue-15515-fix-script-output-formatting diff --git a/changes/issue-15515-fix-script-output-formatting b/changes/issue-15515-fix-script-output-formatting new file mode 100644 index 0000000000..7332dc4cdd --- /dev/null +++ b/changes/issue-15515-fix-script-output-formatting @@ -0,0 +1 @@ +- improve script output text formatting. diff --git a/frontend/components/Textarea/Textarea.tsx b/frontend/components/Textarea/Textarea.tsx index 6c18599454..5a068bd624 100644 --- a/frontend/components/Textarea/Textarea.tsx +++ b/frontend/components/Textarea/Textarea.tsx @@ -10,6 +10,13 @@ interface ITextareaProps { // A textarea component that encapsulates common styles and functionality. const Textarea = ({ children, className }: ITextareaProps) => { + // this is to preserve line breaks when we encounter a carriage return character. + // We could not find a way to preserve line breaks in the CSS alone for this + // character. + if (typeof children === "string") { + children = children.replace(/\r/g, "\n"); + } + const classNames = classnames(baseClass, className); return
{children}
; };