##// END OF EJS Templates
Fix asyncy nbconvert to download
Thomas Kluyver -
Show More
@@ -69,17 +69,21 b' define(['
69 MenuBar.prototype._nbconvert = function (format, download) {
69 MenuBar.prototype._nbconvert = function (format, download) {
70 download = download || false;
70 download = download || false;
71 var notebook_path = this.notebook.notebook_path;
71 var notebook_path = this.notebook.notebook_path;
72 if (this.notebook.dirty) {
73 this.notebook.save_notebook({async : false});
74 }
75 var url = utils.url_join_encode(
72 var url = utils.url_join_encode(
76 this.base_url,
73 this.base_url,
77 'nbconvert',
74 'nbconvert',
78 format,
75 format,
79 notebook_path
76 notebook_path
80 ) + "?download=" + download.toString();
77 ) + "?download=" + download.toString();
81
78
82 window.open(url);
79 var w = window.open()
80 if (this.notebook.dirty) {
81 this.notebook.save_notebook().then(function() {
82 w.location = url;
83 });
84 } else {
85 w.location = url;
86 }
83 };
87 };
84
88
85 MenuBar.prototype.bind_events = function () {
89 MenuBar.prototype.bind_events = function () {
@@ -1922,7 +1922,7 b' define(['
1922 var start = new Date().getTime();
1922 var start = new Date().getTime();
1923
1923
1924 var that = this;
1924 var that = this;
1925 this.contents.save(this.notebook_path, model).then(
1925 return this.contents.save(this.notebook_path, model).then(
1926 $.proxy(this.save_notebook_success, this, start),
1926 $.proxy(this.save_notebook_success, this, start),
1927 function (error) {
1927 function (error) {
1928 that.events.trigger('notebook_save_failed.Notebook', error);
1928 that.events.trigger('notebook_save_failed.Notebook', error);
General Comments 0
You need to be logged in to leave comments. Login now