|
| 1 | +define(['base/js/namespace', 'jquery'], function(Jupyter, $) { |
| 2 | + function add_cell_to_snippet_manager() { |
| 3 | + } |
| 4 | + |
| 5 | + function add_cell_from_snippet_manager() { |
| 6 | + } |
| 7 | + |
| 8 | + function place_snippet_manager_buttons() { |
| 9 | + if (!Jupyter.toolbar) { |
| 10 | + $([Jupyter.events]).on("app_initialized.NotebookApp", place_snippet_manager_buttons); |
| 11 | + return; |
| 12 | + } |
| 13 | + |
| 14 | + if ($(".snippet-manager-buttons").length === 0) { |
| 15 | + Jupyter.toolbar.add_buttons_group([ |
| 16 | + { |
| 17 | + 'label': 'Add Cell to Snippet Manager', |
| 18 | + 'icon': 'fa-arrow-circle-up', |
| 19 | + 'callback': add_cell_to_snippet_manager, |
| 20 | + 'id': 'add-cell-to-snippet-manager', |
| 21 | + 'class': 'snippet-manager-buttons' |
| 22 | + }, |
| 23 | + { |
| 24 | + 'label': 'Add Cell from Snippet Manager', |
| 25 | + 'icon': 'fa-arrow-circle-down', |
| 26 | + 'callback': add_cell_from_snippet_manager, |
| 27 | + 'id': 'add-cell-from-snippet-manager', |
| 28 | + 'class': 'snippet-manager-buttons' |
| 29 | + } |
| 30 | + ]); |
| 31 | + } |
| 32 | + } |
| 33 | + |
| 34 | + function load_ipython_extension() { |
| 35 | + console.log("Loading notebook-snippet-manager extension..."); |
| 36 | + place_snippet_manager_buttons(); |
| 37 | + } |
| 38 | + |
| 39 | + return { |
| 40 | + load_ipython_extension: load_ipython_extension |
| 41 | + }; |
| 42 | +}); |
0 commit comments