diff --git a/src/datascience-ui/interactive-common/cellOutput.tsx b/src/datascience-ui/interactive-common/cellOutput.tsx index 5f3450df4147..7bed5cfffdf3 100644 --- a/src/datascience-ui/interactive-common/cellOutput.tsx +++ b/src/datascience-ui/interactive-common/cellOutput.tsx @@ -345,59 +345,64 @@ export class CellOutput extends React.Component { // tslint:disable-next-line: max-func-body-length private renderOutputs(outputs: nbformat.IOutput[]): JSX.Element[] { - return outputs.map(this.renderOutput); + return [this.renderOutput(outputs)]; } - private renderOutput = (output: nbformat.IOutput, index: number): JSX.Element => { - const transformed = this.transformOutput(output); - let mimetype = transformed.mimeType; - - // If that worked, use the transform - if (mimetype) { - // Get the matching React.Component for that mimetype - const Transform = transforms[mimetype]; - - // Create a default set of properties - const style: React.CSSProperties = { - }; - - // Create a scrollbar style if necessary - if (transformed.renderWithScrollbars && this.props.maxTextSize) { - style.overflowX = 'auto'; - style.overflowY = 'auto'; - style.maxHeight = `${this.props.maxTextSize}px`; - } - - let className = transformed.isText ? 'cell-output-text' : 'cell-output-html'; - className = transformed.isError ? `${className} cell-output-error` : className; - - // If we are not theming plots then wrap them in a white span - if (transformed.outputSpanClassName) { - return ( -
- + private renderOutput = (outputs: nbformat.IOutput[]): JSX.Element => { + const buffer: JSX.Element[] = []; + const transformedList = outputs.map(this.transformOutput); + + transformedList.forEach(transformed => { + let mimetype = transformed.mimeType; + + // If that worked, use the transform + if (mimetype) { + // Get the matching React.Component for that mimetype + const Transform = transforms[mimetype]; + + let className = transformed.isText ? 'cell-output-text' : 'cell-output-html'; + className = transformed.isError ? `${className} cell-output-error` : className; + + // If we are not theming plots then wrap them in a white span + if (transformed.outputSpanClassName) { + buffer.push( +
+ + {transformed.extraButton} + + +
+ ); + } else { + buffer.push( +
{transformed.extraButton} - -
- ); +
+ ); + } } else { - return ( -
- {transformed.extraButton} - -
- ); + if (transformed.data) { + const keys = Object.keys(transformed.data); + mimetype = keys.length > 0 ? keys[0] : 'unknown'; + } else { + mimetype = 'unknown'; + } + const str: string = this.getUnknownMimeTypeFormatString().format(mimetype); + buffer.push(
{str}
); } - } + }); - if (output.data) { - const keys = Object.keys(output.data); - mimetype = keys.length > 0 ? keys[0] : 'unknown'; - } else { - mimetype = 'unknown'; + // Create a default set of properties + const style: React.CSSProperties = { + }; + + // Create a scrollbar style if necessary + if (transformedList.some(transformed => transformed.renderWithScrollbars) && this.props.maxTextSize) { + style.overflowY = 'auto'; + style.maxHeight = `${this.props.maxTextSize}px`; } - const str: string = this.getUnknownMimeTypeFormatString().format(mimetype); - return
{str}
; + + return
{buffer}
; } }