Show More
@@ -50,7 +50,7 b' define([' | |||||
50 | /** |
|
50 | /** | |
51 | * Contains and manages cells. |
|
51 | * Contains and manages cells. | |
52 | * @class Notebook |
|
52 | * @class Notebook | |
53 |
* @param { |
|
53 | * @param {string} selector | |
54 | * @param {dictionary} options - Dictionary of keyword arguments. |
|
54 | * @param {dictionary} options - Dictionary of keyword arguments. | |
55 | * events: $(Events) instance |
|
55 | * events: $(Events) instance | |
56 | * keyboard_manager: KeyboardManager instance |
|
56 | * keyboard_manager: KeyboardManager instance | |
@@ -315,7 +315,7 b' define([' | |||||
315 | }; |
|
315 | }; | |
316 |
|
316 | |||
317 | /** |
|
317 | /** | |
318 |
* |
|
318 | * Trigger a warning dialog about missing functionality from newer minor versions | |
319 | */ |
|
319 | */ | |
320 | Notebook.prototype.warn_nbformat_minor = function (event) { |
|
320 | Notebook.prototype.warn_nbformat_minor = function (event) { | |
321 | var v = 'v' + this.nbformat + '.'; |
|
321 | var v = 'v' + this.nbformat + '.'; | |
@@ -354,9 +354,9 b' define([' | |||||
354 | /** |
|
354 | /** | |
355 | * Scroll the top of the page to a given cell. |
|
355 | * Scroll the top of the page to a given cell. | |
356 | * |
|
356 | * | |
357 |
* @param { |
|
357 | * @param {number} cell_number An index of the cell to view | |
358 |
* @param { |
|
358 | * @param {number} time Animation time in milliseconds | |
359 |
* @return { |
|
359 | * @return {number} Pixel offset from the top of the container | |
360 | */ |
|
360 | */ | |
361 | Notebook.prototype.scroll_to_cell = function (cell_number, time) { |
|
361 | Notebook.prototype.scroll_to_cell = function (cell_number, time) { | |
362 | var cells = this.get_cells(); |
|
362 | var cells = this.get_cells(); | |
@@ -384,6 +384,10 b' define([' | |||||
384 |
|
384 | |||
385 | // Edit Notebook metadata |
|
385 | // Edit Notebook metadata | |
386 |
|
386 | |||
|
387 | /** | |||
|
388 | * Display a dialog that allows the user to edit the Notebook's metadata. | |||
|
389 | * @return {null} | |||
|
390 | */ | |||
387 | Notebook.prototype.edit_metadata = function () { |
|
391 | Notebook.prototype.edit_metadata = function () { | |
388 | var that = this; |
|
392 | var that = this; | |
389 | dialog.edit_metadata({ |
|
393 | dialog.edit_metadata({ | |
@@ -410,7 +414,7 b' define([' | |||||
410 | /** |
|
414 | /** | |
411 | * Get a particular cell element. |
|
415 | * Get a particular cell element. | |
412 | * |
|
416 | * | |
413 |
* @param { |
|
417 | * @param {number} index An index of a cell to select | |
414 | * @return {jQuery} A selector of the given cell. |
|
418 | * @return {jQuery} A selector of the given cell. | |
415 | */ |
|
419 | */ | |
416 | Notebook.prototype.get_cell_element = function (index) { |
|
420 | Notebook.prototype.get_cell_element = function (index) { | |
@@ -425,7 +429,7 b' define([' | |||||
425 | /** |
|
429 | /** | |
426 | * Try to get a particular cell by msg_id. |
|
430 | * Try to get a particular cell by msg_id. | |
427 | * |
|
431 | * | |
428 |
* @param { |
|
432 | * @param {string} msg_id A message UUID | |
429 | * @return {Cell} Cell or null if no cell was found. |
|
433 | * @return {Cell} Cell or null if no cell was found. | |
430 | */ |
|
434 | */ | |
431 | Notebook.prototype.get_msg_cell = function (msg_id) { |
|
435 | Notebook.prototype.get_msg_cell = function (msg_id) { | |
@@ -435,7 +439,7 b' define([' | |||||
435 | /** |
|
439 | /** | |
436 | * Count the cells in this notebook. |
|
440 | * Count the cells in this notebook. | |
437 | * |
|
441 | * | |
438 |
* @return { |
|
442 | * @return {number} The number of cells in this notebook | |
439 | */ |
|
443 | */ | |
440 | Notebook.prototype.ncells = function () { |
|
444 | Notebook.prototype.ncells = function () { | |
441 | return this.get_cell_elements().length; |
|
445 | return this.get_cell_elements().length; | |
@@ -457,7 +461,7 b' define([' | |||||
457 | /** |
|
461 | /** | |
458 | * Get a Cell object from this notebook. |
|
462 | * Get a Cell object from this notebook. | |
459 | * |
|
463 | * | |
460 |
* @param { |
|
464 | * @param {number} index An index of a cell to retrieve | |
461 | * @return {Cell} Cell or null if no cell was found. |
|
465 | * @return {Cell} Cell or null if no cell was found. | |
462 | */ |
|
466 | */ | |
463 | Notebook.prototype.get_cell = function (index) { |
|
467 | Notebook.prototype.get_cell = function (index) { | |
@@ -503,7 +507,7 b' define([' | |||||
503 | * Get the numeric index of a given cell. |
|
507 | * Get the numeric index of a given cell. | |
504 | * |
|
508 | * | |
505 | * @param {Cell} cell The provided cell |
|
509 | * @param {Cell} cell The provided cell | |
506 |
* @return { |
|
510 | * @return {number} The cell's numeric index or null if no cell was found. | |
507 | */ |
|
511 | */ | |
508 | Notebook.prototype.find_cell_index = function (cell) { |
|
512 | Notebook.prototype.find_cell_index = function (cell) { | |
509 | var result = null; |
|
513 | var result = null; | |
@@ -518,8 +522,8 b' define([' | |||||
518 | /** |
|
522 | /** | |
519 | * Get a given index , or the selected index if none is provided. |
|
523 | * Get a given index , or the selected index if none is provided. | |
520 | * |
|
524 | * | |
521 |
* @param { |
|
525 | * @param {number} index A cell's index | |
522 |
* @return { |
|
526 | * @return {number} The given index, or selected index if none is provided. | |
523 | */ |
|
527 | */ | |
524 | Notebook.prototype.index_or_selected = function (index) { |
|
528 | Notebook.prototype.index_or_selected = function (index) { | |
525 | var i; |
|
529 | var i; | |
@@ -546,7 +550,7 b' define([' | |||||
546 | /** |
|
550 | /** | |
547 | * Check whether a cell index is valid. |
|
551 | * Check whether a cell index is valid. | |
548 | * |
|
552 | * | |
549 |
* @param { |
|
553 | * @param {number} index A cell index | |
550 | * @return True if the index is valid, false otherwise |
|
554 | * @return True if the index is valid, false otherwise | |
551 | */ |
|
555 | */ | |
552 | Notebook.prototype.is_valid_cell_index = function (index) { |
|
556 | Notebook.prototype.is_valid_cell_index = function (index) { | |
@@ -560,7 +564,7 b' define([' | |||||
560 | /** |
|
564 | /** | |
561 | * Get the index of the currently selected cell. |
|
565 | * Get the index of the currently selected cell. | |
562 |
|
566 | |||
563 |
* @return { |
|
567 | * @return {number} The selected cell's numeric index | |
564 | */ |
|
568 | */ | |
565 | Notebook.prototype.get_selected_index = function () { |
|
569 | Notebook.prototype.get_selected_index = function () { | |
566 | var result = null; |
|
570 | var result = null; | |
@@ -578,7 +582,7 b' define([' | |||||
578 | /** |
|
582 | /** | |
579 | * Programmatically select a cell. |
|
583 | * Programmatically select a cell. | |
580 | * |
|
584 | * | |
581 |
* @param { |
|
585 | * @param {number} index A cell's index | |
582 | * @return {Notebook} This notebook |
|
586 | * @return {Notebook} This notebook | |
583 | */ |
|
587 | */ | |
584 | Notebook.prototype.select = function (index) { |
|
588 | Notebook.prototype.select = function (index) { | |
@@ -635,7 +639,7 b' define([' | |||||
635 | /** |
|
639 | /** | |
636 | * Gets the index of the cell that is in edit mode. |
|
640 | * Gets the index of the cell that is in edit mode. | |
637 | * |
|
641 | * | |
638 | * @return index {int} |
|
642 | * @return index {integer} | |
639 | **/ |
|
643 | **/ | |
640 | Notebook.prototype.get_edit_index = function () { |
|
644 | Notebook.prototype.get_edit_index = function () { | |
641 | var result = null; |
|
645 | var result = null; | |
@@ -650,7 +654,7 b' define([' | |||||
650 | /** |
|
654 | /** | |
651 | * Handle when a a cell blurs and the notebook should enter command mode. |
|
655 | * Handle when a a cell blurs and the notebook should enter command mode. | |
652 | * |
|
656 | * | |
653 |
* @param |
|
657 | * @param {Cell} [cell] Cell to enter command mode on. | |
654 | **/ |
|
658 | **/ | |
655 | Notebook.prototype.handle_command_mode = function (cell) { |
|
659 | Notebook.prototype.handle_command_mode = function (cell) { | |
656 | if (this.mode !== 'command') { |
|
660 | if (this.mode !== 'command') { | |
@@ -677,7 +681,7 b' define([' | |||||
677 | /** |
|
681 | /** | |
678 | * Handle when a cell fires it's edit_mode event. |
|
682 | * Handle when a cell fires it's edit_mode event. | |
679 | * |
|
683 | * | |
680 |
* @param |
|
684 | * @param {Cell} [cell] Cell to enter edit mode on. | |
681 | **/ |
|
685 | **/ | |
682 | Notebook.prototype.handle_edit_mode = function (cell) { |
|
686 | Notebook.prototype.handle_edit_mode = function (cell) { | |
683 | if (cell && this.mode !== 'edit') { |
|
687 | if (cell && this.mode !== 'edit') { | |
@@ -713,7 +717,7 b' define([' | |||||
713 | /** |
|
717 | /** | |
714 | * Move given (or selected) cell up and select it. |
|
718 | * Move given (or selected) cell up and select it. | |
715 | * |
|
719 | * | |
716 |
* @param |
|
720 | * @param {integer} [index] cell index | |
717 | * @return {Notebook} This notebook |
|
721 | * @return {Notebook} This notebook | |
718 | **/ |
|
722 | **/ | |
719 | Notebook.prototype.move_cell_up = function (index) { |
|
723 | Notebook.prototype.move_cell_up = function (index) { | |
@@ -737,7 +741,7 b' define([' | |||||
737 | /** |
|
741 | /** | |
738 | * Move given (or selected) cell down and select it |
|
742 | * Move given (or selected) cell down and select it | |
739 | * |
|
743 | * | |
740 |
* @param |
|
744 | * @param {integer} [index] cell index | |
741 | * @return {Notebook} This notebook |
|
745 | * @return {Notebook} This notebook | |
742 | **/ |
|
746 | **/ | |
743 | Notebook.prototype.move_cell_down = function (index) { |
|
747 | Notebook.prototype.move_cell_down = function (index) { | |
@@ -763,7 +767,7 b' define([' | |||||
763 | /** |
|
767 | /** | |
764 | * Delete a cell from the notebook. |
|
768 | * Delete a cell from the notebook. | |
765 | * |
|
769 | * | |
766 |
* @param [index] |
|
770 | * @param {integer} [index] cell's numeric index | |
767 | * @return {Notebook} This notebook |
|
771 | * @return {Notebook} This notebook | |
768 | */ |
|
772 | */ | |
769 | Notebook.prototype.delete_cell = function (index) { |
|
773 | Notebook.prototype.delete_cell = function (index) { | |
@@ -846,10 +850,10 b' define([' | |||||
846 | * |
|
850 | * | |
847 | * Index will be brought back into the accessible range [0,n] |
|
851 | * Index will be brought back into the accessible range [0,n] | |
848 | * |
|
852 | * | |
849 |
* @param |
|
853 | * @param {string} [type] in ['code','markdown', 'raw'], defaults to 'code' | |
850 |
* @param [index] |
|
854 | * @param {integer} [index] a valid index where to insert cell | |
851 | * |
|
855 | * | |
852 |
* @return |
|
856 | * @return {Cell|null} created cell or null | |
853 | **/ |
|
857 | **/ | |
854 | Notebook.prototype.insert_cell_at_index = function(type, index){ |
|
858 | Notebook.prototype.insert_cell_at_index = function(type, index){ | |
855 |
|
859 | |||
@@ -917,9 +921,9 b' define([' | |||||
917 | * Insert an element at given cell index. |
|
921 | * Insert an element at given cell index. | |
918 | * return true if everything whent fine. |
|
922 | * return true if everything whent fine. | |
919 | * |
|
923 | * | |
920 | * @param element {dom_element} a cell element |
|
|||
921 | * @param [index] {int} a valid index where to inser cell |
|
|||
922 | * @private |
|
924 | * @private | |
|
925 | * @param {HTMLElement} element - a cell element | |||
|
926 | * @param {integer} [index] a valid index where to inser cell | |||
923 | **/ |
|
927 | **/ | |
924 | Notebook.prototype._insert_element_at_index = function(element, index){ |
|
928 | Notebook.prototype._insert_element_at_index = function(element, index){ | |
925 | if (element === undefined){ |
|
929 | if (element === undefined){ | |
@@ -954,10 +958,10 b' define([' | |||||
954 | * |
|
958 | * | |
955 | * default index value is the one of currently selected cell |
|
959 | * default index value is the one of currently selected cell | |
956 | * |
|
960 | * | |
957 |
* @param |
|
961 | * @param {string} [type] cell type | |
958 |
* @param |
|
962 | * @param {integer} [index] | |
959 | * |
|
963 | * | |
960 | * @return handle to created cell or null |
|
964 | * @return {Cell|null} handle to created cell or null | |
961 | **/ |
|
965 | **/ | |
962 | Notebook.prototype.insert_cell_above = function (type, index) { |
|
966 | Notebook.prototype.insert_cell_above = function (type, index) { | |
963 | index = this.index_or_selected(index); |
|
967 | index = this.index_or_selected(index); | |
@@ -970,10 +974,10 b' define([' | |||||
970 | * |
|
974 | * | |
971 | * default index value is the one of currently selected cell |
|
975 | * default index value is the one of currently selected cell | |
972 | * |
|
976 | * | |
973 |
* @param |
|
977 | * @param {string} [type] cell type | |
974 |
* @param |
|
978 | * @param {integer} [index] | |
975 | * |
|
979 | * | |
976 | * @return handle to created cell or null |
|
980 | * @return {Cell|null} handle to created cell or null | |
977 | **/ |
|
981 | **/ | |
978 | Notebook.prototype.insert_cell_below = function (type, index) { |
|
982 | Notebook.prototype.insert_cell_below = function (type, index) { | |
979 | index = this.index_or_selected(index); |
|
983 | index = this.index_or_selected(index); | |
@@ -984,9 +988,9 b' define([' | |||||
984 | /** |
|
988 | /** | |
985 | * Insert cell at end of notebook |
|
989 | * Insert cell at end of notebook | |
986 | * |
|
990 | * | |
987 |
* @param { |
|
991 | * @param {string} type cell type | |
988 | * |
|
992 | * | |
989 | * @return the added cell; or null |
|
993 | * @return {Cell|null} the added cell; or null | |
990 | **/ |
|
994 | **/ | |
991 | Notebook.prototype.insert_cell_at_bottom = function (type){ |
|
995 | Notebook.prototype.insert_cell_at_bottom = function (type){ | |
992 | var len = this.ncells(); |
|
996 | var len = this.ncells(); | |
@@ -996,7 +1000,7 b' define([' | |||||
996 | /** |
|
1000 | /** | |
997 | * Turn a cell into a code cell. |
|
1001 | * Turn a cell into a code cell. | |
998 | * |
|
1002 | * | |
999 |
* @param { |
|
1003 | * @param {number} [index] A cell's index | |
1000 | */ |
|
1004 | */ | |
1001 | Notebook.prototype.to_code = function (index) { |
|
1005 | Notebook.prototype.to_code = function (index) { | |
1002 | var i = this.index_or_selected(index); |
|
1006 | var i = this.index_or_selected(index); | |
@@ -1027,7 +1031,7 b' define([' | |||||
1027 | /** |
|
1031 | /** | |
1028 | * Turn a cell into a Markdown cell. |
|
1032 | * Turn a cell into a Markdown cell. | |
1029 | * |
|
1033 | * | |
1030 |
* @param { |
|
1034 | * @param {number} [index] A cell's index | |
1031 | */ |
|
1035 | */ | |
1032 | Notebook.prototype.to_markdown = function (index) { |
|
1036 | Notebook.prototype.to_markdown = function (index) { | |
1033 | var i = this.index_or_selected(index); |
|
1037 | var i = this.index_or_selected(index); | |
@@ -1064,7 +1068,7 b' define([' | |||||
1064 | /** |
|
1068 | /** | |
1065 | * Turn a cell into a raw text cell. |
|
1069 | * Turn a cell into a raw text cell. | |
1066 | * |
|
1070 | * | |
1067 |
* @param { |
|
1071 | * @param {number} [index] A cell's index | |
1068 | */ |
|
1072 | */ | |
1069 | Notebook.prototype.to_raw = function (index) { |
|
1073 | Notebook.prototype.to_raw = function (index) { | |
1070 | var i = this.index_or_selected(index); |
|
1074 | var i = this.index_or_selected(index); | |
@@ -1095,11 +1099,11 b' define([' | |||||
1095 | } |
|
1099 | } | |
1096 | }; |
|
1100 | }; | |
1097 |
|
1101 | |||
|
1102 | /** | |||
|
1103 | * warn about heading cells being removed | |||
|
1104 | * @private | |||
|
1105 | */ | |||
1098 | Notebook.prototype._warn_heading = function () { |
|
1106 | Notebook.prototype._warn_heading = function () { | |
1099 | /** |
|
|||
1100 | * warn about heading cells being removed |
|
|||
1101 | * @private |
|
|||
1102 | */ |
|
|||
1103 | dialog.modal({ |
|
1107 | dialog.modal({ | |
1104 | notebook: this, |
|
1108 | notebook: this, | |
1105 | keyboard_manager: this.keyboard_manager, |
|
1109 | keyboard_manager: this.keyboard_manager, | |
@@ -1116,13 +1120,13 b' define([' | |||||
1116 | }); |
|
1120 | }); | |
1117 | }; |
|
1121 | }; | |
1118 |
|
1122 | |||
1119 | Notebook.prototype.to_heading = function (index, level) { |
|
|||
1120 | /** |
|
1123 | /** | |
1121 | * Turn a cell into a markdown cell with a heading. |
|
1124 | * Turn a cell into a markdown cell with a heading. | |
1122 | * |
|
1125 | * | |
1123 |
* @param { |
|
1126 | * @param {number} [index] A cell's index | |
1124 |
* @param { |
|
1127 | * @param {number} [level] A heading level (e.g., 1 for h1) | |
1125 | */ |
|
1128 | */ | |
|
1129 | Notebook.prototype.to_heading = function (index, level) { | |||
1126 | this.to_markdown(index); |
|
1130 | this.to_markdown(index); | |
1127 | level = level || 1; |
|
1131 | level = level || 1; | |
1128 | var i = this.index_or_selected(index); |
|
1132 | var i = this.index_or_selected(index); | |
@@ -1313,7 +1317,7 b' define([' | |||||
1313 | /** |
|
1317 | /** | |
1314 | * Hide a cell's output. |
|
1318 | * Hide a cell's output. | |
1315 | * |
|
1319 | * | |
1316 |
* @param { |
|
1320 | * @param {integer} index - A cell's numeric index | |
1317 | */ |
|
1321 | */ | |
1318 | Notebook.prototype.collapse_output = function (index) { |
|
1322 | Notebook.prototype.collapse_output = function (index) { | |
1319 | var i = this.index_or_selected(index); |
|
1323 | var i = this.index_or_selected(index); | |
@@ -1340,7 +1344,7 b' define([' | |||||
1340 | /** |
|
1344 | /** | |
1341 | * Show a cell's output. |
|
1345 | * Show a cell's output. | |
1342 | * |
|
1346 | * | |
1343 |
* @param { |
|
1347 | * @param {integer} index - A cell's numeric index | |
1344 | */ |
|
1348 | */ | |
1345 | Notebook.prototype.expand_output = function (index) { |
|
1349 | Notebook.prototype.expand_output = function (index) { | |
1346 | var i = this.index_or_selected(index); |
|
1350 | var i = this.index_or_selected(index); | |
@@ -1367,7 +1371,7 b' define([' | |||||
1367 | /** |
|
1371 | /** | |
1368 | * Clear the selected CodeCell's output area. |
|
1372 | * Clear the selected CodeCell's output area. | |
1369 | * |
|
1373 | * | |
1370 |
* @param { |
|
1374 | * @param {integer} index - A cell's numeric index | |
1371 | */ |
|
1375 | */ | |
1372 | Notebook.prototype.clear_output = function (index) { |
|
1376 | Notebook.prototype.clear_output = function (index) { | |
1373 | var i = this.index_or_selected(index); |
|
1377 | var i = this.index_or_selected(index); | |
@@ -1393,7 +1397,7 b' define([' | |||||
1393 | /** |
|
1397 | /** | |
1394 | * Scroll the selected CodeCell's output area. |
|
1398 | * Scroll the selected CodeCell's output area. | |
1395 | * |
|
1399 | * | |
1396 |
* @param { |
|
1400 | * @param {integer} index - A cell's numeric index | |
1397 | */ |
|
1401 | */ | |
1398 | Notebook.prototype.scroll_output = function (index) { |
|
1402 | Notebook.prototype.scroll_output = function (index) { | |
1399 | var i = this.index_or_selected(index); |
|
1403 | var i = this.index_or_selected(index); | |
@@ -1419,7 +1423,7 b' define([' | |||||
1419 |
|
1423 | |||
1420 | /** Toggle whether a cell's output is collapsed or expanded. |
|
1424 | /** Toggle whether a cell's output is collapsed or expanded. | |
1421 | * |
|
1425 | * | |
1422 |
* @param { |
|
1426 | * @param {integer} index - A cell's numeric index | |
1423 | */ |
|
1427 | */ | |
1424 | Notebook.prototype.toggle_output = function (index) { |
|
1428 | Notebook.prototype.toggle_output = function (index) { | |
1425 | var i = this.index_or_selected(index); |
|
1429 | var i = this.index_or_selected(index); | |
@@ -1446,7 +1450,7 b' define([' | |||||
1446 | /** |
|
1450 | /** | |
1447 | * Toggle a scrollbar for long cell outputs. |
|
1451 | * Toggle a scrollbar for long cell outputs. | |
1448 | * |
|
1452 | * | |
1449 |
* @param { |
|
1453 | * @param {integer} index - A cell's numeric index | |
1450 | */ |
|
1454 | */ | |
1451 | Notebook.prototype.toggle_output_scroll = function (index) { |
|
1455 | Notebook.prototype.toggle_output_scroll = function (index) { | |
1452 | var i = this.index_or_selected(index); |
|
1456 | var i = this.index_or_selected(index); | |
@@ -1676,8 +1680,8 b' define([' | |||||
1676 | /** |
|
1680 | /** | |
1677 | * Execute a contiguous range of cells. |
|
1681 | * Execute a contiguous range of cells. | |
1678 | * |
|
1682 | * | |
1679 |
* @param { |
|
1683 | * @param {integer} start - Index of the first cell to execute (inclusive) | |
1680 |
* @param { |
|
1684 | * @param {integer} end - Index of the last cell to execute (exclusive) | |
1681 | */ |
|
1685 | */ | |
1682 | Notebook.prototype.execute_cell_range = function (start, end) { |
|
1686 | Notebook.prototype.execute_cell_range = function (start, end) { | |
1683 | this.command_mode(); |
|
1687 | this.command_mode(); | |
@@ -1692,7 +1696,7 b' define([' | |||||
1692 | /** |
|
1696 | /** | |
1693 | * Getter method for this notebook's name. |
|
1697 | * Getter method for this notebook's name. | |
1694 | * |
|
1698 | * | |
1695 |
* @return { |
|
1699 | * @return {string} This notebook's name (excluding file extension) | |
1696 | */ |
|
1700 | */ | |
1697 | Notebook.prototype.get_notebook_name = function () { |
|
1701 | Notebook.prototype.get_notebook_name = function () { | |
1698 | var nbname = this.notebook_name.substring(0,this.notebook_name.length-6); |
|
1702 | var nbname = this.notebook_name.substring(0,this.notebook_name.length-6); | |
@@ -1702,7 +1706,7 b' define([' | |||||
1702 | /** |
|
1706 | /** | |
1703 | * Setter method for this notebook's name. |
|
1707 | * Setter method for this notebook's name. | |
1704 | * |
|
1708 | * | |
1705 |
* @param { |
|
1709 | * @param {string} name A new name for this notebook | |
1706 | */ |
|
1710 | */ | |
1707 | Notebook.prototype.set_notebook_name = function (name) { |
|
1711 | Notebook.prototype.set_notebook_name = function (name) { | |
1708 | var parent = utils.url_path_split(this.notebook_path)[0]; |
|
1712 | var parent = utils.url_path_split(this.notebook_path)[0]; | |
@@ -1713,8 +1717,8 b' define([' | |||||
1713 | /** |
|
1717 | /** | |
1714 | * Check that a notebook's name is valid. |
|
1718 | * Check that a notebook's name is valid. | |
1715 | * |
|
1719 | * | |
1716 |
* @param { |
|
1720 | * @param {string} nbname - A name for this notebook | |
1717 |
* @return { |
|
1721 | * @return {boolean} True if the name is valid, false if invalid | |
1718 | */ |
|
1722 | */ | |
1719 | Notebook.prototype.test_notebook_name = function (nbname) { |
|
1723 | Notebook.prototype.test_notebook_name = function (nbname) { | |
1720 | nbname = nbname || ''; |
|
1724 | nbname = nbname || ''; | |
@@ -1728,7 +1732,7 b' define([' | |||||
1728 | /** |
|
1732 | /** | |
1729 | * Load a notebook from JSON (.ipynb). |
|
1733 | * Load a notebook from JSON (.ipynb). | |
1730 | * |
|
1734 | * | |
1731 | * @param {Object} data JSON representation of a notebook |
|
1735 | * @param {Object} data - JSON representation of a notebook | |
1732 | */ |
|
1736 | */ | |
1733 | Notebook.prototype.fromJSON = function (data) { |
|
1737 | Notebook.prototype.fromJSON = function (data) { | |
1734 |
|
1738 | |||
@@ -1814,7 +1818,7 b' define([' | |||||
1814 | /** |
|
1818 | /** | |
1815 | * Start an autosave timer, for periodically saving the notebook. |
|
1819 | * Start an autosave timer, for periodically saving the notebook. | |
1816 | * |
|
1820 | * | |
1817 |
* @param { |
|
1821 | * @param {integer} interval - the autosave interval in milliseconds | |
1818 | */ |
|
1822 | */ | |
1819 | Notebook.prototype.set_autosave_interval = function (interval) { |
|
1823 | Notebook.prototype.set_autosave_interval = function (interval) { | |
1820 | var that = this; |
|
1824 | var that = this; | |
@@ -1882,8 +1886,8 b' define([' | |||||
1882 | /** |
|
1886 | /** | |
1883 | * Success callback for saving a notebook. |
|
1887 | * Success callback for saving a notebook. | |
1884 | * |
|
1888 | * | |
1885 |
* @param { |
|
1889 | * @param {integer} start - Time when the save request start | |
1886 | * @param {Object} data JSON representation of a notebook |
|
1890 | * @param {Object} data - JSON representation of a notebook | |
1887 | */ |
|
1891 | */ | |
1888 | Notebook.prototype.save_notebook_success = function (start, data) { |
|
1892 | Notebook.prototype.save_notebook_success = function (start, data) { | |
1889 | this.set_dirty(false); |
|
1893 | this.set_dirty(false); | |
@@ -1922,7 +1926,7 b' define([' | |||||
1922 | /** |
|
1926 | /** | |
1923 | * update the autosave interval based on how long the last save took |
|
1927 | * update the autosave interval based on how long the last save took | |
1924 | * |
|
1928 | * | |
1925 |
* @param { |
|
1929 | * @param {integer} timestamp - when the save request started | |
1926 | * @private |
|
1930 | * @private | |
1927 | */ |
|
1931 | */ | |
1928 | Notebook.prototype._update_autosave_interval = function (start) { |
|
1932 | Notebook.prototype._update_autosave_interval = function (start) { | |
@@ -1941,7 +1945,6 b' define([' | |||||
1941 |
|
1945 | |||
1942 | /** |
|
1946 | /** | |
1943 | * Explicitly trust the output of this notebook. |
|
1947 | * Explicitly trust the output of this notebook. | |
1944 | * |
|
|||
1945 | */ |
|
1948 | */ | |
1946 | Notebook.prototype.trust_notebook = function () { |
|
1949 | Notebook.prototype.trust_notebook = function () { | |
1947 | var body = $("<div>").append($("<p>") |
|
1950 | var body = $("<div>").append($("<p>") | |
@@ -2044,7 +2047,7 b' define([' | |||||
2044 | /** |
|
2047 | /** | |
2045 | * Request a notebook's data from the server. |
|
2048 | * Request a notebook's data from the server. | |
2046 | * |
|
2049 | * | |
2047 |
* @param { |
|
2050 | * @param {string} notebook_path - A notebook to load | |
2048 | */ |
|
2051 | */ | |
2049 | Notebook.prototype.load_notebook = function (notebook_path) { |
|
2052 | Notebook.prototype.load_notebook = function (notebook_path) { | |
2050 | this.notebook_path = notebook_path; |
|
2053 | this.notebook_path = notebook_path; | |
@@ -2268,7 +2271,7 b' define([' | |||||
2268 | /** |
|
2271 | /** | |
2269 | * Success callback for listing checkpoints. |
|
2272 | * Success callback for listing checkpoints. | |
2270 | * |
|
2273 | * | |
2271 | * @param {Object} data JSON representation of a checkpoint |
|
2274 | * @param {Object} data - JSON representation of a checkpoint | |
2272 | */ |
|
2275 | */ | |
2273 | Notebook.prototype.list_checkpoints_success = function (data) { |
|
2276 | Notebook.prototype.list_checkpoints_success = function (data) { | |
2274 | this.checkpoints = data; |
|
2277 | this.checkpoints = data; | |
@@ -2296,13 +2299,18 b' define([' | |||||
2296 | /** |
|
2299 | /** | |
2297 | * Success callback for creating a checkpoint. |
|
2300 | * Success callback for creating a checkpoint. | |
2298 | * |
|
2301 | * | |
2299 | * @param {Object} data JSON representation of a checkpoint |
|
2302 | * @param {Object} data - JSON representation of a checkpoint | |
2300 | */ |
|
2303 | */ | |
2301 | Notebook.prototype.create_checkpoint_success = function (data) { |
|
2304 | Notebook.prototype.create_checkpoint_success = function (data) { | |
2302 | this.add_checkpoint(data); |
|
2305 | this.add_checkpoint(data); | |
2303 | this.events.trigger('checkpoint_created.Notebook', data); |
|
2306 | this.events.trigger('checkpoint_created.Notebook', data); | |
2304 | }; |
|
2307 | }; | |
2305 |
|
2308 | |||
|
2309 | /** | |||
|
2310 | * Display the restore checkpoint dialog | |||
|
2311 | * @param {string} checkpoint ID | |||
|
2312 | * @return {null} | |||
|
2313 | */ | |||
2306 | Notebook.prototype.restore_checkpoint_dialog = function (checkpoint) { |
|
2314 | Notebook.prototype.restore_checkpoint_dialog = function (checkpoint) { | |
2307 | var that = this; |
|
2315 | var that = this; | |
2308 | checkpoint = checkpoint || this.last_checkpoint; |
|
2316 | checkpoint = checkpoint || this.last_checkpoint; | |
@@ -2347,7 +2355,7 b' define([' | |||||
2347 | /** |
|
2355 | /** | |
2348 | * Restore the notebook to a checkpoint state. |
|
2356 | * Restore the notebook to a checkpoint state. | |
2349 | * |
|
2357 | * | |
2350 |
* @param { |
|
2358 | * @param {string} checkpoint ID | |
2351 | */ |
|
2359 | */ | |
2352 | Notebook.prototype.restore_checkpoint = function (checkpoint) { |
|
2360 | Notebook.prototype.restore_checkpoint = function (checkpoint) { | |
2353 | this.events.trigger('notebook_restoring.Notebook', checkpoint); |
|
2361 | this.events.trigger('notebook_restoring.Notebook', checkpoint); | |
@@ -2371,7 +2379,7 b' define([' | |||||
2371 | /** |
|
2379 | /** | |
2372 | * Delete a notebook checkpoint. |
|
2380 | * Delete a notebook checkpoint. | |
2373 | * |
|
2381 | * | |
2374 |
* @param { |
|
2382 | * @param {string} checkpoint ID | |
2375 | */ |
|
2383 | */ | |
2376 | Notebook.prototype.delete_checkpoint = function (checkpoint) { |
|
2384 | Notebook.prototype.delete_checkpoint = function (checkpoint) { | |
2377 | this.events.trigger('notebook_restoring.Notebook', checkpoint); |
|
2385 | this.events.trigger('notebook_restoring.Notebook', checkpoint); |
General Comments 0
You need to be logged in to leave comments.
Login now