Skip to content
This repository has been archived by the owner on Oct 26, 2019. It is now read-only.

Commit

Permalink
Updates to work with Jupyterlab 0.1.3
Browse files Browse the repository at this point in the history
This version of Jupyterlab fixes issues we were seeing with matplotlib

(c) Copyright IBM Corp. 2016
  • Loading branch information
jhpedemonte committed Aug 2, 2016
1 parent ec19212 commit 7afdf1a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions client/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

var $ = require('jquery');
var AnsiParser = require('ansi-parser');
var Services = require('jupyter-js-services');
var defaultSanitizer = require('jupyterlab/lib/sanitizer').defaultSanitizer;
var OutputArea = require('jupyterlab/lib/notebook/output-area');
var RenderMime = require('jupyterlab/lib/rendermime').RenderMime;
var renderers = require('jupyterlab/lib/renderers');
var Services = require('jupyter-js-services');
var PhWidget = require('phosphor-widget');

var Widgets = require('jupyter-js-widgets');
Expand Down Expand Up @@ -148,10 +149,17 @@ if (Element && !Element.prototype.matches) {
// HTML to the DOM; this does run inline scripts.
(function() {
var r = new renderers.HTMLRenderer();
r.render = function(mimetype, data) {
r.render = function(options) {
var source = options.source;
if (options.sanitizer) {
source = options.sanitizer.sanitize(source);
}
var widget = new PhWidget.Widget();
widget.onAfterAttach = function() {
$(widget.node).html(data);
$(widget.node).html(source);
if (options.resolver) {
renderers.resolveUrls(widget.node, options.resolver);
}
};
return widget;
};
Expand All @@ -170,7 +178,11 @@ if (Element && !Element.prototype.matches) {
mimeMap[m] = t;
});
});
return new RenderMime({ renderers: mimeMap, order: order });
return new RenderMime({
renderers: mimeMap,
order: order,
sanitizer: defaultSanitizer
});
}

// shim kernel object on notebook for backward compatibility
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"http-proxy": "^1.12.0",
"jupyter-js-services": "^0.15.2",
"jupyter-js-widgets": "^1.2.0",
"jupyterlab": "^0.1.0",
"jupyterlab": "0.1.3",
"morgan": "^1.6.1",
"nconf": "^0.8.2",
"passport": "^0.3.2",
Expand Down

0 comments on commit 7afdf1a

Please sign in to comment.