Skip to content

Commit 2594076

Browse files
committed
Merge pull request #412 from jdfreder/dontclobber
Don't clobber the Notebook's require/requirejs/define instances
2 parents 0dded42 + 5de0376 commit 2594076

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased]
6+
### Fixed
7+
- Offline mode will no longer delete the Jupyter Notebook's require, requirejs, and define variables.
68

79
## [1.9.6] - 2016-02-18
810
### Updated

Diff for: plotly/offline/offline.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ def init_notebook_mode():
6161

6262
global __PLOTLY_OFFLINE_INITIALIZED
6363
if not __PLOTLY_OFFLINE_INITIALIZED:
64-
display(HTML('<script type="text/javascript">' +
65-
# ipython's includes `require` as a global, which
66-
# conflicts with plotly.js. so, unrequire it.
67-
'require=requirejs=define=undefined;' +
68-
'</script>' +
69-
'<script type="text/javascript">' +
64+
display(HTML("<script type='text/javascript'>" +
65+
"define('plotly', function(require, exports, module) {" +
7066
get_plotlyjs() +
71-
'</script>'))
67+
"});" +
68+
"require(['plotly'], function(Plotly) {" +
69+
"window.Plotly = Plotly;" +
70+
"});" +
71+
"</script>"))
7272
__PLOTLY_OFFLINE_INITIALIZED = True
7373

7474

0 commit comments

Comments
 (0)