Skip to content

Commit 98a63e0

Browse files
committed
Inject static HTML in mime bundle in classic notebook
1 parent 151b2ad commit 98a63e0

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

labextension/src/output.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export class OutputWidget extends Widget {
4141
_render() {
4242
const { data, schema } = this._data.get(this._mimeType);
4343
// const metadata = this._metadata.get(this._mimeType);
44-
// if (data)
4544
ReactDOM.render(<JSONTable data={data} schema={schema} />, this.node);
45+
// Inject static HTML into mime bundle
4646
this._data.set(
4747
'text/html',
4848
ReactDOMServer.renderToStaticMarkup(<JSONTable data={data} schema={schema} />)

nbextension/src/renderer.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ export function register_renderer(notebook) {
3232
render(json, toinsert[0]);
3333
// Inject static HTML into mime bundle
3434
this.outputs.filter(output => output.data[MIME_TYPE]).forEach(output => {
35-
const { resources: [ props ] } = json;
3635
ReactDOMServer.renderToStaticMarkup(
37-
<JSONTable {...props} />
36+
<JSONTable data={data} schema={schema} />
3837
)
3938
});
4039
element.append(toinsert);
@@ -65,9 +64,9 @@ export function render_cells(notebook) {
6564
notebook.get_cells().forEach(cell => {
6665
// If a cell has output data of 'application/vnd.dataresource+json' mime type
6766
if (
68-
cell.output_area &&
69-
cell.output_area.outputs.find(output =>
70-
output.data && output.data[MIME_TYPE]
67+
cell.output_area &&
68+
cell.output_area.outputs.find(
69+
output => output.data && output.data[MIME_TYPE]
7170
)
7271
) {
7372
// Re-render the cell by executing it

0 commit comments

Comments
 (0)