You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
884 B

4 years ago
  1. /*
  2. * Copyright (c) 2018, Voila Contributors
  3. * Copyright (c) 2018, QuantStack
  4. *
  5. * Distributed under the terms of the BSD 3-Clause License.
  6. *
  7. * The full license is in the file LICENSE, distributed with this software.
  8. */
  9. define(['jquery', 'base/js/namespace'], function($, Jupyter) {
  10. "use strict";
  11. var open_voila = function() {
  12. Jupyter.notebook.save_notebook().then(function () {
  13. let voila_url = Jupyter.notebook.base_url + "voila/render/" + Jupyter.notebook.notebook_path;
  14. window.open(voila_url)
  15. });
  16. }
  17. var load_ipython_extension = function() {
  18. Jupyter.toolbar.add_buttons_group([{
  19. id : 'toggle_codecells',
  20. label : 'Voila',
  21. icon : 'fa-desktop',
  22. callback : open_voila
  23. }]);
  24. };
  25. return {
  26. load_ipython_extension : load_ipython_extension
  27. };
  28. });