Skip to content

Don't clobber the Notebook's require/requirejs/define instances #412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

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

## [1.9.6] - 2016-02-18
### Updated
Expand Down
14 changes: 7 additions & 7 deletions plotly/offline/offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ def init_notebook_mode():

global __PLOTLY_OFFLINE_INITIALIZED
if not __PLOTLY_OFFLINE_INITIALIZED:
display(HTML('<script type="text/javascript">' +
# ipython's includes `require` as a global, which
# conflicts with plotly.js. so, unrequire it.
'require=requirejs=define=undefined;' +
'</script>' +
'<script type="text/javascript">' +
display(HTML("<script type='text/javascript'>" +
"define('plotly', function(require, exports, module) {" +
get_plotlyjs() +
'</script>'))
"});" +
"require(['plotly'], function(Plotly) {" +
"window.Plotly = Plotly;" +
"});" +
"</script>"))
__PLOTLY_OFFLINE_INITIALIZED = True


Expand Down