File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ export class OutputWidget extends Widget {
4242 const { resources : [ props ] } = this . _data . get ( this . _mimeType ) ;
4343 // const metadata = this._metadata.get(this._mimeType);
4444 if ( props ) ReactDOM . render ( < JSONTable { ...props } /> , this . node ) ;
45+ // Inject static HTML into mime bundle
4546 this . _data . set (
4647 'text/html' ,
4748 ReactDOMServer . renderToStaticMarkup ( < JSONTable { ...props } /> )
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import ReactDOM from 'react-dom' ;
3+ import ReactDOMServer from 'react-dom/server' ;
34import { VirtualizedTable as JSONTable } from 'jupyterlab_table_react' ;
45import './index.css' ;
56
@@ -28,7 +29,14 @@ export function register_renderer(notebook) {
2829 const type = MIME_TYPE ;
2930 const toinsert = this . create_output_subarea ( md , CLASS_NAME , type ) ;
3031 this . keyboard_manager . register_events ( toinsert ) ;
31- render ( json , toinsert [ ( 0 ) ] ) ;
32+ render ( json , toinsert [ 0 ] ) ;
33+ // Inject static HTML into mime bundle
34+ this . outputs . filter ( output => output . data [ MIME_TYPE ] ) . forEach ( output => {
35+ const { resources : [ props ] } = json ;
36+ ReactDOMServer . renderToStaticMarkup (
37+ < JSONTable { ...props } />
38+ )
39+ } ) ;
3240 element . append ( toinsert ) ;
3341 return toinsert ;
3442 } ;
You can’t perform that action at this time.
0 commit comments