Skip to content

Commit fe27738

Browse files
committed
Added alert on snippet upload
1 parent fb4072b commit fe27738

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

notebook-snippet-manager.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
1-
define(['base/js/namespace', 'jquery'], function(Jupyter, $) {
1+
define(['base/js/namespace', 'jquery', 'base/js/dialog'], function(Jupyter, $, dialog) {
22
function add_cell_to_snippet_manager() {
3+
var selected_cell = Jupyter.notebook.get_selected_cell();
4+
var selected_content = selected_cell.get_text();
5+
6+
var modal_content = $('<p/>').html("Please provide a name for this snippet.");
7+
modal_content.append($('<br><br>'));
8+
modal_content.append($('<input type="text" name="snippet-name"/>'));
9+
10+
Jupyter.keyboard_manager.register_events(modal_content);
11+
12+
dialog.modal({
13+
title: 'Add Code Cell to Snippet Manager',
14+
body: modal_content,
15+
buttons: {
16+
Cancel: {
17+
'class': 'btn-danger'
18+
},
19+
OK: {
20+
'class': 'btn-primary',
21+
'click': function() {
22+
console.log('Adding to snippet manager...');
23+
}
24+
}
25+
}
26+
});
327
}
428

529
function add_cell_from_snippet_manager() {

0 commit comments

Comments
 (0)