Skip to content

Commit eaf6ff4

Browse files
committed
Respect isHtml prop in primary output
1 parent 5acd92c commit eaf6ff4

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Dnn.AdminExperience/ClientSide/Prompt.Web/src/components/Output.jsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,9 @@ export class Output extends Component {
4242

4343
return result;
4444
}
45-
else if (props.isHtml) {
46-
return <TextLine key={DomKey.get("output")} txt={props.output}/>;
47-
}
4845
else if (props.output) {
49-
const style = props.isError ? "dnn-prompt-error" : `dnn-prompt-${props.style === "cmd" ? "cmd" : "ok"}`;
50-
return <TextLine key={DomKey.get("output")} txt={props.output} css={style}/>;
46+
const style = props.isHtml ? '' : props.isError ? "dnn-prompt-error" : `dnn-prompt-${props.style === "cmd" ? "cmd" : "ok"}`;
47+
return <TextLine key={DomKey.get("output")} txt={props.output} css={style} isHtml={props.isHtml}/>;
5148
}
5249
}
5350

Dnn.AdminExperience/ClientSide/Prompt.Web/src/components/TextLine.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import PropTypes from "prop-types";
33
import Html from "./Html";
44
import DomKey from "../services/DomKey";
55

6-
const TextLine = ({txt, css}) => {
6+
const TextLine = ({txt, css, isHtml}) => {
77
if (!txt) {
88
return null;
99
}
1010
const textLines = txt.split("\\n");
11-
const rows = textLines.map((line) => line ? <span key={DomKey.get("textline")} className={css}><Html html={line} /></span> : null).reduce((prev,current) => {
11+
const rows = textLines.map((line) => line ? <span key={DomKey.get("textline")} className={css}>{isHtml ? <Html html={line} /> : line}</span> : null)
12+
.reduce((prev,current) => {
1213
if (current !== "" && current !== null && current !== undefined) {
1314
return [...prev,current];
1415
}
@@ -21,7 +22,8 @@ TextLine.defaultProps = { css: "dnn-prompt-cmd" };
2122

2223
TextLine.propTypes = {
2324
txt: PropTypes.string.isRequired,
24-
css: PropTypes.string
25+
css: PropTypes.string,
26+
isHtml: PropTypes.bool
2527
};
2628

2729
export default TextLine;

0 commit comments

Comments
 (0)